ckeditor4 icon indicating copy to clipboard operation
ckeditor4 copied to clipboard

Restrict 'pastebin' usage in widgets plugin only for browsers which really utilizes it

Open f1ames opened this issue 8 years ago • 1 comments

Are you reporting a feature request or a bug?

Task

Check if the issue is already reported

Extracted from #1160.

Provide detailed reproduction steps (if any)

See https://github.com/ckeditor/ckeditor-dev/issues/1160#issuecomment-344580238 for wider context.

The clipboard plugin uses pastebin only for browsers not supporting Clipboard API (IE browsers), but for widgets it is used always. I think we should consider restricting its usage only from browsers which really needs it, especially that:

  1. copySingleWidget is called first and it utilizes CKEDITOR.editable.getHtmlFromRange to prepare HTML which is copied by the browser to a clipboard/dataTransfer.
  2. clipboard plugin listeners are executed, which for browsers supporting Clipboard API, creates CKEDITOR.plugins.clipboard.dataTransfer.
  3. CKEDITOR.plugins.clipboard.dataTransfer object upon creation inserts text/html data to clipboard (using CKEDITOR.editor.getSelectedHtml) overwriting html which was inserted via pastebin.

Also CKEDITOR.editable.getHtmlFromRange is the base of the CKEDITOR.editor.getSelectedHtml method so the output should is the same.

Other details

  • Browser: All
  • OS: All
  • CKEditor version:
  • Installed CKEditor plugins: clipboard, widgets

f1ames avatar Nov 15 '17 12:11 f1ames

I wasn't able to activate pastebin in non-IE browsers. It'd be good to check if the issue is still present.

Comandeer avatar Aug 10 '22 10:08 Comandeer