Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

Copy & Paste of text with images when source is local and target is not not possible anymore?

$
0
0

Hi,

I'm developing for a customer a simple script for his SharePoint. The point of the script was: The customer copies some text from his local documents and then pastes it into a rich text field online. As his documents have different formatting and insert without formatting removes images, he wants me to remove all stylings. This was easy and the main problem was that when pasted images within the text would be converted into this data-URL format

<imgsrc="data:image/png;base64,iVBORw0KGgoAAAA...RU5ErkJggg=="/>

and SharePoint didn't like that and deleted the data-block when saving. I converted the data into a blob uploaded it separately and then linked the newly uploaded image. This worked fine until sometime last week.

When I now copy&paste text with images from a local document it just links some local temporary image like this:

<img width="227" height="174" src="file:///C:/Users/****/AppData/Local/Temp/msohtmlclip1/01/clip_image003.jpg" v:shapes="Grafik_x0020_3">

This is the case for all online editors I could think of testing (Gmail, Google Docs, Word Online, SharePoint) and for Chrome, Edge, IE11.

When I look at the paste-event under Chrome I can see that the clipboard-object contains 'text/plain' (my copied text in plaintext) 'text/html' (my copied text as html with the images linked locally like up there) and 'text/rtf' (text as rtf and the images are inside as huge binary blocks in hex).

So the solution was simple, get the images from the rtf, upload them and replace the locally linked images with links to the uploaded versions.

But now I'm stuck for IE. IE's clipboard-object just supports giving me the plaintext nothing else. And If I just let the browser paste he'll just create those locally linked images.

My Questions are:

  • Did the copy&paste behavior change, or is there a setting someone could have messed up?
  • Why aren't local images converted into the base64 Data-URL anymore? (Pasting a single image still does that)
  • Is there anyway to access the pictures in the clipboard from within IE11 via script?

Steps to reproduce:

  1. Create a new text document.
  2. Write "text <picture> text" in it.
  3. Replace <picture> with an image you have on your hard drive.
  4. Open any online editor that supports pictures (Word Online, Gmail etc)
  5. Select everything in your local document and copy it (Ctrl + A -> Ctrl + C)
  6. Try to paste it into your online editor.
  7. Result should be "text <dead image> text" and the <dead image> should have some "file:\\" src.

Thank you for your time reading,

Daniel Dengler


Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>