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

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

Closed
reinaldojv opened this issue Jun 5, 2017 · 51 comments
Closed
Labels
resolution:upstream Issue in the third-party software.

Comments

@reinaldojv
Copy link

reinaldojv commented Jun 5, 2017

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
@Discartyptics
Copy link

I'm experiencing the same issue

@mlewand
Copy link
Contributor

mlewand commented Jun 5, 2017

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.

@mlewand mlewand closed this as completed Jun 5, 2017
@mlewand mlewand added the resolution:upstream Issue in the third-party software. label Jun 5, 2017
@reinaldojv
Copy link
Author

Thanks.

@stalker780
Copy link

stalker780 commented Jul 1, 2017

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

@f1ames
Copy link
Contributor

f1ames commented Jul 3, 2017

@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.

@stalker780
Copy link

stalker780 commented Jul 3, 2017

@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?

@f1ames
Copy link
Contributor

f1ames commented Jul 3, 2017

@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?

@stalker780
Copy link

@f1ames done. #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 :(

@f1ames
Copy link
Contributor

f1ames commented Jul 3, 2017

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.

@stalker780
Copy link

stalker780 commented Jul 3, 2017

@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 :)

@christophermlne
Copy link

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

@mlewand
Copy link
Contributor

mlewand commented Aug 15, 2017

@christophermlne please add a 👍 reaction to #595 which is an issue where we track this issue.

@nh905
Copy link

nh905 commented Oct 15, 2017

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

@cnovick-doj
Copy link

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.

@fede-green
Copy link

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?

@cnovick-doj
Copy link

For Drupal 7 look at https://www.drupal.org/project/pasteformat

@bunnyhu
Copy link

bunnyhu commented Dec 16, 2017

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.

@nh905
Copy link

nh905 commented Dec 16, 2017

@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.

@bunnyhu
Copy link

bunnyhu commented Dec 16, 2017

@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.

@homestar9
Copy link

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

@eguerin-ucsf
Copy link

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.

@homestar9
Copy link

@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.

@davidthegray
Copy link

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.

@LingaTigeen
Copy link

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 ?

@pixilation
Copy link

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;
	})
})

@pixilation
Copy link

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();
		}
	})
});

@stalker780
Copy link

@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.

@mbomb007
Copy link

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.

@uberhacker
Copy link

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

@aviral2311
Copy link

aviral2311 commented Oct 5, 2020

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?

@musheerkhalid
Copy link

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

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

@charlie59
Copy link

I know this is closed, but explaining these kinds of decisions to end-users who rely on this functionality is impossible. It's really a bad choice just to break things that worked fine.

@bunnyhu
Copy link

bunnyhu commented Aug 18, 2021

I know this is closed, but explaining these kinds of decisions to end-users who rely on this functionality is impossible. It's really a bad choice just to break things that worked fine.

Nobody know, why they do it. I just using old version, still working and I do not care what they do with the newest versions. I need this function, and if they do not want to hear the users cry, bad for them.

@Comandeer
Copy link
Member

I just using old version, still working and I do not care what they do with the newest versions.

Unfortunately such an approach lowers the security of your site as newer versions also include security fixes. I'd recommend upgrading to newer versions.

@bunnyhu
Copy link

bunnyhu commented Aug 19, 2021

Unfortunately such an approach lowers the security of your site as newer versions also include security fixes. I'd recommend upgrading to newer versions.

It is on the protected admin side and in a random name folder, I do not care about it. I prefer the old paste method against security patch.

@Ternvein
Copy link

Ternvein commented Dec 5, 2021

@bunnyhu this fix works fine for at least 4.16.2, bringing back old paste dialog.
Although I don't understand why change the not-so-nice but 100% working way of pasting to the one which doesn't work in 90% of browsers. Nonsense.

@josipWebbite
Copy link

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.

Thank you, work excellent!

@mzbyszewska
Copy link

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();
		}
	})
});

Where to put this code?

@mbomb007
Copy link

mbomb007 commented Nov 14, 2022

Not sure, but maybe in ckeditor.js? Also, if you're going to use a fix, use this instead:

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
		else if (event.data.name == "pastetext" && event.data.commandData.from == "keystrokeHandler") {
			event.cancel();
		}
	})
});

@mzbyszewska
Copy link

Not sure, but maybe in ckeditor.js? Also, if you're going to use a fix, use this instead:

CKEDITOR.on("instanceReady", function(event) {
...

Thanks.
ckeditor.js is unfriendly compressed but I'll give a try:-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution:upstream Issue in the third-party software.
Projects
None yet
Development

No branches or pull requests