Ckeditor4: Your browser doesn't allow you to paste this way. Press Ctrl+V to paste.

Created on 5 Jun 2017  ยท  42Comments  ยท  Source: ckeditor/ckeditor4

Are you reporting a feature or a bug?

Bug

Check if the issue is already reported

Put all reference links hereโ€ฆ

Provide detailed reproduction steps (if any)

  1. Copy plain text to clipboard
  2. Using CKEditor, try to paste using "Paste" option after mouse right click or using editor's "Paste" options

Expected result

Text is pasted normally.

Actual result

Message "Your browser doesn't allow you to paste this way. Press Ctrl+V to paste." is showed.

Other details

  • Browser: Google Chrome 58, Mozilla Firefox 51, Microsoft Edge 38
  • OS: MS Windows 10 64 bits
  • CKEditor version: 4.7.0 (this issue was not showed in 4.6.2 version)
  • Installed CKEditor plugins: Copy Formatting, Paste from Word, Paste from Excel
upstream

Most helpful comment

I think the problem here is the "button" now doesn't do anything, and it confuses the end-user. The functionality is there, but you can't have a Paste as Plain Text or Paste from Word button anymore. I think the right solution would be a Clean Up button, which can function with a Dialog, where you are able to specify exactly what you'd like cleaned-up after pasting. The "paste-from-word" would then work silently in the background (with no button) and then further cleanup would be performed based on user preference? For one I don't like having the Word styles coming in. But I want to maintain specific styles generated from the CKEditor.

All 42 comments

I'm experiencing the same issue

This is actually working by design. With 4.7.0 release we decided to finally drop our good old Paste dialog to simplify pasting process as much as possible.

Ideally we'd like the browser to _just paste_ and that's it - however, due the security reasons, modern browsers do not expose any means to paste other than using native ways, so:

  • Platform specific hotkey ctrl/cmd + v
  • Native context menu

Will trigger paste, but the website can not initiate it on it's own.

The exception here would be Internet Explorer family, as it supports triggering paste command which we use.

So in short this is as close as it gets, and we're unable to push it further. As soon as browser provides APIs for us to trigger the paste, we're happy to utilize that.

Thanks.

And also another problem with shortcuts. They not always work.

A button "paste as plain text" doesn't work in windows firefox now. It says "Your browser does not allow you to paste plain text this way. Press Ctrl+Shift+V to paste."
And shortcut ctrl+shift+v is also used by AddBlockPlus :(

So there is no way to paste plain text in CKEditor 4.7 :(

In 4.6.2 button works fine in Firefox.

After using 4.7 for several days, I had to revert all my sites back to 4.6.2

@stalker780 This behaviour is explained in the comment above.

When it comes to shortcuts conflicts the Ctrl + Shift + V is a native Firefox shortcut for Paste as plain text (as you can see here https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly#w_editing) so it is an AddBlockPlus issue that it overwrites it.

@f1ames

I understand this. I will write to ABP developer.

But CKEditor's plain text paste is also broken in Android Firefox. It is used not often, but sometimes it is very handy to paste & edit texts from tablet. But in 4.7 paste from clipboard doesn't work at all.

Maybe it is possible to leave old paste dialog as optional plugin?

@stalker780 Firefox on Android is not officially supported (http://docs.ckeditor.com/#!/guide/dev_browsers). However, it might be the issue also in other mobile environments so we will have to take a closer look.

Could I ask you to report it (the Android Firefox case) as a separate issue?

@f1ames done. https://github.com/ckeditor/ckeditor-dev/issues/595

As for ABP shortcut conflict, it is discussed since 2012...

And still all installations of ABP have Ctrl + Shift + V as default shortcut and no GUI to reassign it. It can be changed only in about:config :(

Thanks for reporting @stalker780.

As for ABP shortcut conflict, Ctrl + Shift + V is a native FF shortcut so it also breaks a native experience of the browsers, which could be troublesome in many cases. As we are trying to be consistent with native behaviour in most cases to make using editor as intuitive as possible we are not planning to change these shortcuts. Still, it is good to know that such conflicts may occur so we will keep it in mind.

@f1ames You are quite right. But documentation and standards are just theory here :) In real life it turns out quite different from what it planned to be.

Paste as plaintext toolbutton with dialog and it's stable work in all OS and browsers is one of unique useful features of CKEditor, and a reason why I used it for last 4 years in all my projects. All my clients are very used to it. If this feature doesn't work any longer the way it was, I have only 2 ways - try to write own plugin with old functionality or move to another editor :( don't even imagine what editor it could be :(

I really hope you will find a good solution for this issue :)

This limitation makes it impossible to use CKEditor on a phone (unless you know of a phone with a Ctrl and a V key.

@christophermlne please add a ๐Ÿ‘ reaction to #595 which is an issue where we track this issue.

I have been using CKEditor with Drupal for years. One of the strengths of CKEditor was the 'Paste from Word' button which significantly cleaned up the extra formatting introduced by Word. In the past, I have had issues where users pasted rich text directly into a Drupal document and corrupted the document. I have trained my users to ALWAYS use 'Paste from Word'.

Based on some preliminary testing, it appears CKEditor is doing some cleanup after pasting via Ctrl+V and I can tailor Advanced Content Filter to further remove undesirable rich text tags. Has anyone found a guide that shows the configuration required to re-create the functionality of 'Paste from Word' with CKEDitor 4.7?

Thanks, Norbert

I am also a Drupal Developer. In my use case I would like to swap the functionality of "ctrl+v" with "shift ctrl+v" so that in CK Editor, paste as plain text is performed when "ctrl+v" is pressed.

Another Drupal developer here... @cnovick-doj have you managed to swap "ctrl+v" for "shift+ctrl+v"?

I thought i managed to cleanup work pastings by removing allowedContent for the full html configuration but then it turns out it would strip everything, for example images... so that's not the way to go :(.

I wonder would it be possible not to accept any html tag when people are pasting on the editor side and allowing tags instead when people are pasting in the "code" view?

Same here with 4.8.0. I do not understand, why kill a working solution and replace with a non working method. The Chrome is the most popular browser and the ckeditor after 4.6 is not compatible with it. Nonsense.

@bunnyhu, the current ckeditor 'Paste from Word' strips out a lot of rich text formatting in Chrome - the message it generates is somewhat misleading. In some ways, I prefer it over the previous 'Paste from Word' - it replaces

with

. I am comparing the results of the earlier and current 'Paste from Word' to figure out what additional tuning is required so that I keep the important formatting but get rid off the unnecessary formatting.

@nh905 I miss the paste unformated text, that I used usually then format manual. That function is not working, when I click the button I get the error message without the old dialog box.

This issue is problematic for us as well. At the very least there should be a way to paste as text only.

I think the problem here is the "button" now doesn't do anything, and it confuses the end-user. The functionality is there, but you can't have a Paste as Plain Text or Paste from Word button anymore. I think the right solution would be a Clean Up button, which can function with a Dialog, where you are able to specify exactly what you'd like cleaned-up after pasting. The "paste-from-word" would then work silently in the background (with no button) and then further cleanup would be performed based on user preference? For one I don't like having the Word styles coming in. But I want to maintain specific styles generated from the CKEditor.

@eguerin-ucsf, I couldn't have said it better. Your summary is spot on and I believe your suggestion for a "clean-up text" button combined with a dialog is the best way to handle the issue.

Ideally we'd like the browser to just paste and that's it - however, due the security reasons, modern browsers do not expose any means to paste other than using native ways, so:

Platform specific hotkey ctrl/cmd + v
Native context menu

The fact is that the Paste button in Word online works perfectly in all browsers. Therefore the explanation above is not convincing. I don't know if it is possible to do reverse engineering on the MS code and mimic what they do. Yet the copy and past functionality is fundamental on any editor, and the way it is implemented now (sometimes I don't get it to work even with CTRL+V) is unacceptable.

Paste button in Word online works perfectly in all browsers

Doesn't work for me in Word online. The same like with CKEditor. "Due to security blah blah - you must use the Ctrl+V"

Is it solved or not yet? This paste issue?
I think the most possible solution to this is to remove those buttons.
Use this to remove those buttons.
removeButtons : "Paste,PasteText,PasteFromWord",

I am still using old version with button without any problem. So, that was my solution ...

I am still using old version with button without any problem. So, that was my solution ...

Which version are you using ?

Which version are you using ?

I am on 4.6.2. That is the last version with working paste as plain text button if I am correct.

So how one can replace copy/paste context menu with native menu AND at the same time keep context menu for other plugins like table and nubmered list ?
Most of my users don't know what Ctrl+v is.

PS: I bet 90% dicided to rollback to 4.6.2 :)

Two things to add here:
1) Why is the button still there if the functionality has been removed?
2) On a mac, it still says "use Ctrl-v" even though that doesn't work, you need to use cmd-v.

https://ckeditor.com/ckeditor-4/demo/
demo is working.
But why release version on github doesn't work?

https://ckeditor.com/ckeditor-4/demo/
demo is working.
But why release version on github doesn't work?

None of the examples have the paste buttons, so you will not see anything related to this issue.

Developers shooting into users legs "for better user experience"

I also find it crucial to have a plaintext insert function

to eliminate the need to paste and then clicking the "Remove Format" button.

What I don't fully understand is if the browsers ie Chrome/Edge prevent this or the changes in CKeditor?
If CKEditor, can we hack this to bring this back?

Tried the online demos with version 4.11.3. Even in their demos they have this same issue. It seems they didn't resolve it yet. Any update / solution on this ?

I encountered some pain from clients over the removal of the paste dialog.
I found a way to re-enable the dialog to resolve the issue.

CKEDITOR.on("instanceReady", function(event) {
    event.editor.on("beforePaste", function(event) {
        event.editor._.forcePasteDialog = true;
    })
})

My previous fix caused the paste dialog to show using pasting with Ctrl+Shift+V.
Here's my updated fix:

CKEDITOR.on("instanceReady", function(event) {
    event.editor.on("beforeCommandExec", function(event) {
        // Show the paste dialog for the paste buttons and right-click paste
        if (event.data.name == "paste") {
            event.editor._.forcePasteDialog = true;
        }
        // Don't show the paste dialog for Ctrl+Shift+V
        if (event.data.name == "pastetext" && event.data.commandData.from == "keystrokeHandler") {
            event.cancel();
        }
    })
});

@pixilation
Thanks for a solution. Seems to work fine. But still testing.
That's what we have asked for since 2017. An option to force old paste dialog.
New paste in 4.7 and later versions, broke one of the most used features of CKEditor.

My previous fix caused the paste dialog to show using pasting with Ctrl+Shift+V.
Here's my updated fix:

CKEDITOR.on("instanceReady", function(event) {
  event.editor.on("beforeCommandExec", function(event) {
      // Show the paste dialog for the paste buttons and right-click paste
      if (event.data.name == "paste") {
          event.editor._.forcePasteDialog = true;
      }
      // Don't show the paste dialog for Ctrl+Shift+V
      if (event.data.name == "pastetext" && event.data.commandData.from == "keystrokeHandler") {
          event.cancel();
      }
  })
});

It would be better to make the 2nd if into an elseif, right, because the event.data.name is different? That would mean one less comparison.

@pixilation: Yes, thank you for this code snippet. Where should it be included, in default.js for the pastefromword plugin?

I am using v4.14.1
and when I try to use Cut Copy Paste buttons, cut and copy work, but Paste gives me error -

ckeditor.js?ts=1601170744000:11224 Uncaught TypeError: Cannot read property 'replace' of undefined
    at CKEDITOR.command.exec (ckeditor.js?ts=1601170744000:11224)
    at CKEDITOR.command.exec (ckeditor.js?ts=1601170744000:3455)
    at a.execCommand (ckeditor.js?ts=1601170744000:4720)
    at CKEDITOR.ui.button.CKEDITOR.tools.extend.click (ckeditor.js?ts=1601170744000:10836)
    at Object.execute (ckeditor.js?ts=1601170744000:10854)
    at ckeditor.js?ts=1601170744000:10865
    at ckeditor.js?ts=1601170744000:456
    at Object.callFunction (ckeditor.js?ts=1601170744000:458)
    at HTMLAnchorElement.onclick (view.object.do?ctxtId=89&viewId=567&ctxt=Policy&submitAction=link&prmId=12076&ctxId=12076&prmtId=89&prmt=Policy:1)

This is basically due to this line. I have installed full version of ckeditor.
f = "string" === typeof e ? e : a.lang.clipboard.pasteNotification.replace(/%1/, '\x3ckbd aria-label\x3d"' + m.aria + '"\x3e' + m.display + "\x3c/kbd\x3e"),

Has anybody seen this kind of issue?

I am using v4.15.0
When I try to use Paste from Word buttons its not working.

96348049-99353400-10c3-11eb-8484-630a95a2d1c6

Was this page helpful?
0 / 5 - 0 ratings