Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Edge] No HTML is pasted/copied (only plain text available) #2660

Closed
Reinmar opened this issue Apr 24, 2017 · 16 comments
Closed

[Edge] No HTML is pasted/copied (only plain text available) #2660

Reinmar opened this issue Apr 24, 2017 · 16 comments
Labels
package:clipboard type:bug This issue reports a buggy (incorrect) behavior.
Milestone

Comments

@Reinmar
Copy link
Member

Reinmar commented Apr 24, 2017

Edge still doesn't support Clipboard API: https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/suggestions/6515107-clipboard-api (https://developer.microsoft.com/en-us/microsoft-edge/platform/status/clipboardapi/?filter=f3f0000bf&search=clipboard).

Without a proper support for Clipboard API you can only paste or copy a plain text from the editor. To workaround this we'd need copybin and pastebin which require quite a lot of work to be implemented and they will be used only for Edge...

@Reinmar
Copy link
Member Author

Reinmar commented May 4, 2017

Edge 15 will support Clipboard API... but there's a question how stable this support will be:

image

https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/suggestions/6515107-clipboard-api

@Reinmar
Copy link
Member Author

Reinmar commented Jun 22, 2017

@Mgsy could you check it? Edge 15 might've fixed the copy&paste issues.

@Mgsy
Copy link
Member

Mgsy commented Jun 22, 2017

@Reinmar, copying and pasting styled content in the editor deletes its styling. Also, pasting i.e. bolded text from external website makes that some long HTML/CSS code appears in the editor.

@Reinmar
Copy link
Member Author

Reinmar commented Jun 22, 2017

This is what we get on paste:

Version:1.0
StartHTML:000000183
EndHTML:000004078
StartFragment:000003679
EndFragment:000004022
StartSelection:000003679
EndSelection:000004012
SourceURL:http://www.meteo.pl/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD> <!-- <meta http-equiv="X-UA-Compatible" content="IE=9"> //--> <TITLE>METEO.PL</TITLE> <LINK href="/css/style.20101021.css" rel="stylesheet" type="text/css"> 
<SCRIPT language="JavaScript">var WAMCOAMPS_YYYY=2017;var WAMCOAMPS_MM=6;var WAMCOAMPS_DD=22;var WAMCOAMPS_ST=0;var WAMCOAMPS_SYYYY="2017";var WAMCOAMPS_SMM="06";var WAMCOAMPS_SDD="22";var WAMCOAMPS_SST="00";</SCRIPT>
 
<SCRIPT language="JavaScript" src="advajax.js"></SCRIPT>
 
<SCRIPT language="JavaScript">

var lang="pl";

function otworz2() {
        pre0004=window.open("./komentarze/index1.php","info","width=900,height=500,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,left=100,top=10")
}

function otworz3() {
        pre0005=window.open("./komentarze/ogloszenie1.php","info","width=800,height=600,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,left=100,top=10")
}

function otworz4() {
        pre0006=window.open("http://mapy.meteo.pl/faq/","info","width=1024,height=800,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,left=100,top=10")
}

//-------------------------------------------------------------------
// �ADOWANIE ZDALNE
//-------------------------------------------------------------------

//----------------------------------------------------------------------
//----------------------------------------------------------------------

var pierwszy=new Array(3);
pierwszy[0]='meteorogram_um';
pierwszy[1]='meteorogram_coamps';
pierwszy[2]='szczegolowe_wamcoamps';

var model_info=new Array(3);
model_info[0]='info_um';
model_info[1]='info_coamps';
model_info[2]='info_wamcoamps';

var act_model=-1;

function loadDIV(filename,name,force_load) {

if (document.getElementById(name).ajaxLoad==filename && force_load==0) { 

} else {

advAJAX.get({
    url: filename+".php",

    onSuccess : function(obj) { document.getElementById(name).innerHTML = obj.responseText; document.getElementById(name).ajaxLoad=filename; },
    onError : function(obj) { alert("Error: " + obj.status); }
});

var oScript = document.createElement("script");
oScript.src = filename+"_js.php";
oScript.id = filename+"_js.php";
document.body.appendChild(oScript);
}
}

function loadModel(name,force_load) {

if (name!=act_model) {

act_model=name;
b_model_name=pierwszy[name];

} else { b_model_name=document.getElementById('kon_3c_b').ajaxLoad; };

loadDIV(b_model_name,'kon_3c_b',force_load);
loadDIV(model_info[name],'kon_3c_b_model',force_load);

}

//------------------------------------------------------------------------
// OBS�UGA PRZE�ĄCZANIA MODELI
//------------------------------------------------------------------------

function loadKomentarz() {

advAJAX.get({
    url: "./komentarze/komentarz_skrot.php",
    onSuccess : function(obj) { document.getElementById('komentarz').innerHTML = obj.responseText; },
	onError : function(obj) { alert("Error: " + obj.status); }
});

setTimeout("loadKomentarz()",600000);

}

function make_width() {

if (document.body.clientWidth<1024) document.getElementById('all').style.width =  1024;
else document.getElementById('all').style.width =  "100%";

}

</SCRIPT>
 </HEAD><BODY onload="make_width(); loadKomentarz();" onresize="make_width()"><DIV id="all" style="position: absolute; top:0px; left:0px; margin: 0px; padding: 0px; padding-top: 20px; width: 100%;"><DIV id="kon_3a"><DIV id="kon_3c"><DIV class="tab_big_model" id="kon_3c_b_model" style="visibility: visible"><!--StartFragment--><BR><BR><DIV style="font-size: 12pt; color: #000000; font-weight: normal;margin:20px;"><P><B>Prognozy ICM w nowej odsłonie!</B><P> Zapraszamy do serwisu map pogodowych <A href="http://mapy.meteo.pl/">mapy.meteo.pl</A>. Oprócz wyników naszych modeli (starych i nowych) udostępniamy 10-dniową prognozę globalnego modelu GFS.  <P></P></DIV><!--EndFragment--></DIV></DIV></DIV></DIV></BODY></HTML>
clipboard.js (140,1)```

@Reinmar
Copy link
Member Author

Reinmar commented Jun 22, 2017

This is what ends up in the editor:

image

It means that there's also a bug on our side that we stringify the source of <script>.

As for how to workaround the messy HTML produced by Edge, we can use the <!--StartFragment--> and <!--EndFragment--> comments to get the clean part only. Let's see how we do that in CKEditor 4 (I think we use there pastbin still but it's worth refreshing the memory).

@Reinmar
Copy link
Member Author

Reinmar commented Jun 27, 2017

It turns out that we need to wait a bit longer for https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11780845/ to be released. Without it, copy from the editor will only handle plain text (or HTML if we change the order of calls).

@Reinmar
Copy link
Member Author

Reinmar commented Aug 27, 2017

@Mgsy could you check it on Edge preview (16.16xxx)? It's the latest version available on https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/.

@Mgsy
Copy link
Member

Mgsy commented Aug 28, 2017

@Mgsy could you check it on Edge preview (16.16xxx)?

I checked it and unfortunately this issue still occurs on Edge 16.16257.

bug_cke5

@Reinmar
Copy link
Member Author

Reinmar commented Oct 1, 2017

God... I completely lost patience to that. I don't know why but I wanted to check the JSFiddle again in Edge 15 and I got this:

image

@Reinmar
Copy link
Member Author

Reinmar commented Oct 1, 2017

BTW, I checked the other editors and it seems that none of them is trying to set any data to the clipboard.

@Reinmar
Copy link
Member Author

Reinmar commented Oct 1, 2017

Quoting myself from https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11780845/:

I’ve just checked the fiddle that I posted in one of my previous comments (I’d paste the link if I could) in Edge 16.16257 and I compared the results with Edge 15.15063.

So, in Edge 15 the last setData() call has precedence. In Edge 16… the first. The other calls seem to be ignored.

AFAICS, this ticket should be reopened.

Please tell me, this is not happening 😱

@Reinmar
Copy link
Member Author

Reinmar commented Oct 1, 2017

I mentioned that this is broken in Edge in the Browser Compat guides. And I'm moving this ticket to it13. But, frankly speaking, looking at the pace we should not expect a patch for this until Edge 17 (Edge 16 is still not released) so a year from now... I don't know.

The good thing, though, is that in Edge 16 the first setData() call takes precedence, so copy&paste within the editor works fine (because we first set text/html). However, you (again!!!) can't copy&paste from the editor to some plain-text editor.

I also checked that https://github.com/ckeditor/ckeditor5-clipboard/issues/20#issuecomment-310370365 should not be a problem anymore. This is good news.

@Reinmar
Copy link
Member Author

Reinmar commented Mar 27, 2018

@Mgsy could you check how these things work in the lastest Edge version?

@Mgsy
Copy link
Member

Mgsy commented Mar 27, 2018

Quick summary for the current version (Edge 16.16299):

What does work:

  • Pasting HTML copied from the editor to the another editor within the Edge
  • Pasting HTML copied from an external source

What doesn't work:

  • Pasting HTML copied from the editor opened in Edge to the editor opened in a different browser (content from Edge is pasted as plain text in e.g. Chrome)

I've checked copy/paste in the developer's preview Edge 17 and it looks like all problems have been solved. Copy/paste works as expected.

@Reinmar
Copy link
Member Author

Reinmar commented Mar 27, 2018

Thanks. So I think we can finally close this.

@Reinmar Reinmar closed this as completed Mar 27, 2018
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-clipboard Oct 9, 2019
@mlewand mlewand added this to the iteration 15 milestone Oct 9, 2019
@mlewand mlewand added status:confirmed type:bug This issue reports a buggy (incorrect) behavior. package:clipboard labels Oct 9, 2019
@hotcpufox
Copy link

hotcpufox commented Dec 21, 2019

I realize this was closed, however, oddly 12/21/2019

Edge is still not pasting html properly, but only for SOME subset of pages I have been testing vs same site and paragraph with embedded html links vs Chrome. Primarily example for the paste, that I require and tested is Evernote. Evernote allows two modes - one with html, RTF and native formatting, the other to match style of current font, but always "plain text". And yes, I was consistent with the proper html paste on all tests performed.

Can anyone comment? Ideally, someone who is following the API question, or capable of confirming this or who would like to try a variety of sites.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:clipboard type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

No branches or pull requests

4 participants