Cannot paste SVG images inside contenteditable
Categories
(Core :: DOM: Editor, defect, P3)
Tracking
()
People
(Reporter: saschanaz, Assigned: mbrodesser-Igalia)
References
(Blocks 1 open bug)
Details
(Keywords: dataloss, parity-chrome)
Attachments
(2 files)
- Open the attachment
- Select and copy the whole line
- Paste it
Expected: A new copy of the line including the images (and selecting SVG ideally should show selection indicator background)
Actual: SVG image becomes blank while <img> manages to be alive
Comment 1•4 years ago
|
||
I think that we should take a look this when we have much time since user may lost important SVG data on some web apps.
Comment 2•4 years ago
|
||
I'm having a similar issue. I can't paste any image to Whatsapp Web and to OneDrive document editor.
Usually I use snipping tool to capture a part of the screen and then I paste it in a OneDrive document or in a Whastapp Web conversation.
The image won't show up.
Assignee | ||
Comment 3•4 years ago
|
||
What's copied to the clipboard, is correct:
"text/html" flavor:
<meta http-equiv="content-type" content="text/html; charset=utf-8">foo
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
<image href="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" height="200" width="200"></image>
</svg>
<img src="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" width="200" height="200">
bar
The error happens on pasting:
foo
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
<image height="200" width="200"></image>
</svg>
<img src="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" width="200" height="200">
bar
the href
is dropped.
Assignee | ||
Comment 4•4 years ago
•
|
||
Can you please provide a concrete example? Which Operating System and which Firefox build are you using?
I'm wondering if the issue you've described is about HTML <img>
s or SVG <image>
s.
Assignee | ||
Comment 5•4 years ago
•
|
||
The href
attribute is removed during tree-sanitization. This is part of the call-stack.
Adding the attribute to kAttributesSVG
fixes the bug.
However, I need to think whether this is the proper fix and if this doesn't break anything else.
Assignee | ||
Updated•4 years ago
|
Comment 6•4 years ago
|
||
Given that we allow it for mathml and we allow the equivalent src for HTML, we should allow href for SVG.
Assignee | ||
Comment 7•4 years ago
|
||
:longsonr: agree. Fix is ready, will create a review once the test is ready.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 8•4 years ago
|
||
This follows the pattern of kAttributesHTML
and kURLAttributesHTML
,
which both contain href
. Now, kAttributesSVG
and kURLAttributesSVG
contain href
too.
Unfortunately, the WPT-support for filling and reading the clipboard is
scanty (see bug 1676643), hence adding a Mochitest.
Comment 10•4 years ago
|
||
bugherder |
Updated•4 years ago
|
Description
•