Copy highlighted text to clipboard ignores non-inlined CSS styling when pasting as rich text (to HTML editors, MS Word, Excel, Outlook etc.)
Categories
(Core :: DOM: Serializers, defect)
Tracking
()
People
(Reporter: duncan.loveday, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: parity-chrome, testcase, Whiteboard: [platform-rel-Microsoft][platform-rel-Outlook][webcompat])
Attachments
(2 files)
| Reporter | ||
Comment 1•18 years ago
|
||
| Reporter | ||
Comment 2•18 years ago
|
||
Comment 3•18 years ago
|
||
Comment 4•11 years ago
|
||
Comment 5•11 years ago
|
||
Comment 11•11 years ago
|
||
Updated•9 years ago
|
Updated•9 years ago
|
Comment 12•9 years ago
|
||
Updated•9 years ago
|
Comment 13•8 years ago
|
||
Comment 14•7 years ago
|
||
Updated•7 years ago
|
Comment 15•7 years ago
|
||
Migrating Webcompat whiteboard priorities to project flags. See bug 1547409.
Comment 16•7 years ago
|
||
See bug 1547409. Migrating whiteboard priority tags to program flags.
Comment 17•5 years ago
|
||
Kagami, should this block blink-editor-compat?
Comment 18•5 years ago
|
||
It seems Chrome adds inline style="background-color: blue" but only when pasting across apps. cc'ing Mirko who have recently done some copy-paste work, as I'm not quite familiar with clipboard things.
Chrome also adds inline style when copy-pasting within the browser (e.g. to data:text/html,<div contentEditable="true">X</div>). Firefox doesn't.
So this should also block "blink-editor-compat".
Comment 20•5 years ago
|
||
Chrome inlines each element's style a lot. If we do similar things, cannot we apply same style smarter? (I don't have any concrete idea though.)
Updated•3 years ago
|
Comment 21•2 months ago
|
||
+1 - This bug still looks worth prioritizing.
I took a look at a plausible implementation direction, and I think this could be better framed as a scoped "rich-copy fidelity" project, not a
generic serializer change.
Proposed approach:
- Keep plain-text clipboard behavior unchanged.
- In the HTML copy path, clone the selected fragment into an inert
fragment/document. - Inline a conservative allowlist of computed styles before serializing to
text/html. - Prioritize the properties that matter most for real-world paste targets like Gmail / Docs / Outlook / Word / Excel:
color,background-color,font-*,text-decoration,text-align,vertical-align,white-space,border*,padding*,margin*, andtable-related properties. - Focus on table structure + cell formatting first, since that seems to be the highest-value compatibility gap.
- Pref-gate initially and add tests for colored table cells, borders, nested spans, and
contenteditablepaste cases.
A Gecko-native implementation here seems more realistic than trying to mirror all of Blink’s copy behavior. The existing copy encoder / node-fixup code path looks like the right place to experiment, because this should affect clipboard HTML generation specifically, not general HTML serialization.
If maintainers think this direction is reasonable, I’d support filing a new issue dependency for: "Inline allowlisted computed styles during HTML clipboard copy (pref-gated)" so we can start work on this.
Comment 22•2 months ago
|
||
I think it's worth prototyping something like that... But feels a bit whack-a-mole-ish to me.
Description
•