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

Image pasted twice when copy from browsers #4924

Closed
easygolabs opened this issue Oct 6, 2021 · 14 comments
Closed

Image pasted twice when copy from browsers #4924

easygolabs opened this issue Oct 6, 2021 · 14 comments
Labels
resolution:duplicate A duplicate of an already reported issue. type:bug A bug.

Comments

@easygolabs
Copy link

Type of report

Bug

Provide detailed reproduction steps (if any)

The investigation of the browsers behavior showed that the different browsers insert images in different ways. The picture was inserted twice or once (randomly) : it is not clear why the one picture was inserted once and the other twice. So, solved the problem for one browser, can be created to another. Any ideas how it should be solved based on the investigation on the screenshot?

image

1 - if comment the line d.insertElement(b) in ckeditor/ckeditor.js -> function h(a, d)
2 - without changes

Безымянный

Expected result

It should be pasted just once.

Actual result

Pasted twice

Other details

  • Browser: Chrome Firefox Edge Explorer
  • OS: Windows 10 Pro 20H2 19042.1266
  • CKEditor version: 4.14.1
  • Installed CKEditor plugins: a11yhelp, about, autocomplete, autolink, base64image, ckwebspeech, clipboard, colordialog, dialog, div, fakeobjects, find, flash, forms, iframe, image, insertimage, link, lifestyle, magicline, pagebreak, pastebase64, pastefromword, pastetools, preview, scayt, setstyle, showblocks, smiley, specialchar, table, tabletools, templates, textmatch, wsc
@easygolabs easygolabs added the type:bug A bug. label Oct 6, 2021
@Comandeer
Copy link
Member

It could be caused by #4874. Could you disable all custom plugins for inserting/pasting images (base64image, pastebase64 and insertimage) to the editor and check if issue's still present?

Issue can be also caused by the fact that you use more than one plugin to handle image pasting.

@easygolabs
Copy link
Author

It could be caused by #4874. Could you disable all custom plugins for inserting/pasting images (base64image, pastebase64 and insertimage) to the editor and check if issue's still present?

Issue can be also caused by the fact that you use more than one plugin to handle image pasting.

I will try and then will write about the result

@easygolabs
Copy link
Author

easygolabs commented Oct 7, 2021

It could be caused by #4874. Could you disable all custom plugins for inserting/pasting images (base64image, pastebase64 and insertimage) to the editor and check if issue's still present?

Issue can be also caused by the fact that you use more than one plugin to handle image pasting.

If disable pastebase64 the issue is not present, but i can't copy from the clipboard. If make the same changes as in #4896, then in which file should I paste this code?:

CKEDITOR.replace( 'editor', {
	// Allow 3rd party plugins to handle image pasting
	clipboard_handleImagePasting: false,
	extraPlugins: "customImagePasteHandlerPlugin"
} );

@Comandeer
Copy link
Member

You can download the nightly version to check if the issue is resolved.

From the code you mentioned above you need only clipboard_handleImagePasting option and it should be added to your code for initializing the editor. It will disable built-in image pasting and then pastebase64 plugin should work normally, pasting only one image.

@easygolabs
Copy link
Author

I have downloaded the nightly version (4.17.0 Standard package) and it had been pasting once before i have extracted the downloaded plugin pastebase64 into the plugins folder and have added config.extraPlugins = 'pastebase64'; into the ckeditor\config.js file. After that, still pasted twice.

@Comandeer
Copy link
Member

Have you added config.clibpoard_handleImagePasting = false; to your config?

@easygolabs
Copy link
Author

Have you added config.clibpoard_handleImagePasting = false; to your config?

Yes, it works, thanks, very helpful

@Comandeer
Copy link
Member

Ok, so I'm closing it as a duplicate of #4874.

Please note that the fix will be officially released in 4.17.0, the nightly version is still experimental.

@Comandeer Comandeer added the resolution:duplicate A duplicate of an already reported issue. label Oct 8, 2021
@easygolabs
Copy link
Author

easygolabs commented Jan 4, 2022

@Comandeer, hi, i have downloaded the 4.17.1 version and added config.clipboard_handleImages = false; to config.js. Reloaded the page and opened the /ckeditor/samples/ for test and the image is pasting twice. Do I missing something? It had worked for the nightly version. (what has been mentioned in the previous discussion)

Безымянный

@Comandeer
Copy link
Member

Could you provide some demo of the issue?

@easygolabs
Copy link
Author

easygolabs commented Jan 5, 2022

Could you provide some demo of the issue?

Of course, you can view at this link: https://drive.google.com/file/d/1eFJhPFD2TLHIVxQAAt2egeZ3gIGTtb4c/view

The custom build archive is available at: https://ckeditor.com/cke4/builder/download/47dd77c081dd00b601b21dbc4acf395e

@Comandeer
Copy link
Member

@easygolabs, sorry for the delayed response. After quick debugging it seems that the issue is connected with pastebase64 plugin. After removing it, the image was pasted correctly.

@easygolabs
Copy link
Author

@Comandeer right, is this issue could be confirmed and there will be one more fix? Or the reason of this is incorrect use of plugins and it needs to avoid using pastebase64 plugin with the similar.

@Comandeer
Copy link
Member

It's an issue with a third-party plugin, pastebase64. Without it setting config.handleImages to false seems to work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution:duplicate A duplicate of an already reported issue. type:bug A bug.
Projects
None yet
Development

No branches or pull requests

2 participants