Skip to content

Commit

Permalink
erp5_xhtml_style: CKEditor – Fix duplicate image on paste
Browse files Browse the repository at this point in the history
When pasting an image in CKEditor, the image was displayed twice.
This behaviour is due to the new paste-as-base64 feature implemented in CKE,
which conflict with existing plugins implementing the same feature.

To solve it, add `clipboard_handleImages` option to the CKE configuration object,
which disables its own image-pasting feature.

See ckeditor/ckeditor4#4874 for the corresponding issue on CKEditor’s repository.

/cc @jerome @Romain @tomo
/reviewed-by @jerome
/reviewed-on https://lab.nexedi.com/nexedi/erp5/-/merge_requests/1951
  • Loading branch information
Titouan Soulard authored and fdiary committed Jul 11, 2024
1 parent ecb0f09 commit 9e486f0
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
MOBILE_CONFIGURATION = {
toolbar: TOOLBAR_MOBILE,
disableNativeSpellChecker: false,
// Image pasting is already handled by a plugin
clipboard_handleImages: false,
// Remove the WebSpellChecker and SpellCheckAsYouType (SCAYT) plugins.
removePlugins: 'scayt,wsc',
// Disable ACF to not destroy HTML on mobile
Expand All @@ -48,6 +50,8 @@
DESKTOP_CONFIGURATION = {
toolbar: TOOLBAR_DESKTOP,
disableNativeSpellChecker: false,
// Image pasting is already handled by a plugin
clipboard_handleImages: false,
// Remove the WebSpellChecker and SpellCheckAsYouType (SCAYT) plugins.
removePlugins: 'scayt,wsc',
// Disable ACF to not destroy HTML on mobile
Expand All @@ -59,6 +63,7 @@
READONLY_CONFIGURATION = {
allowedContent: true,
readOnly: true,
clipboard_handleImages: false,
// Remove the WebSpellChecker and SpellCheckAsYouType (SCAYT) plugins.
removePlugins: 'elementspath,scayt,wsc,toolbar,pastefromword,' +
'tableselection,uploadwidget,clipboard,pastetext,' +
Expand Down

0 comments on commit 9e486f0

Please sign in to comment.