image icon indicating copy to clipboard operation
image copied to clipboard

Copying Images from Word or Google Doc

Open Joseph-Azzam opened this issue 1 year ago • 0 comments

I am trying to copy content (text + images) from a google doc and google chrome.

I am using editorjs v2.28.2 and image tool v2.9.0

I implemented image file and image url upload. Uploading files by pasting a URL or dragging and dropping a file works.

Copying an image from MS World works. However copying multiple images or a text with an image result in only copying the text. Copying an image from Google Doc does not work, and copying a text with images results in only copying the text.

From digging deeper, here's a dump ofmy clipboard after copying an image from a google doc, (I tweaked the img url here for privacy concerns):

Version:0.9
StartHTML:0000000105
EndHTML:0000000904
StartFragment:0000000141
EndFragment:0000000868
<html>

<body>
    <!--StartFragment-->
    <meta charset="utf-8"><b style="font-weight:normal;"
        id="docs-internal-guid-46c08795-7fff-8f23-32c5-fd87086484f1">
        <span
            style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;"><span
                style="border:none;display:inline-block;overflow:hidden;width:624px;height:264px;">
                <img
                    src="https://lh7-us.googleusercontent.com/P3ulY2IdCoIsZJg13W_Pdfl2tEH3i2rks1xXaK4T32ah8Nfq9WwXgDnsUwIgg6KXdXbfCz8t61KveRRlDG5RjFb4soD4UxH7LBgH6nr7-JttvXIf7wefwefzCPWHhbw"
                    width="624" height="351"
                    style="margin-left:0px;margin-top:-44px;" />
                </span>
            </span>
        </b><!--EndFragment-->
</body>

</html>

This does not trigger any onPaste Event.

Joseph-Azzam avatar Feb 14 '24 01:02 Joseph-Azzam