From 7b5934670f7060ea90ffc43d2e2c9fc928b6c2d5 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Thu, 18 Jul 2024 12:47:27 +0200 Subject: [PATCH 1/9] Fix: Allow double clicks to propagate. --- .../ckeditor_plugins/cmsplugins/plugin.js | 1 - ... => bundle-a9032984d4.cms.ckeditor.min.js} | 2 +- djangocms_text_ckeditor/widgets.py | 2 +- package-lock.json | 359 +++--------------- 4 files changed, 62 insertions(+), 302 deletions(-) rename djangocms_text_ckeditor/static/djangocms_text_ckeditor/js/dist/{bundle-9f0bbac8ec.cms.ckeditor.min.js => bundle-a9032984d4.cms.ckeditor.min.js} (99%) diff --git a/djangocms_text_ckeditor/static/djangocms_text_ckeditor/ckeditor_plugins/cmsplugins/plugin.js b/djangocms_text_ckeditor/static/djangocms_text_ckeditor/ckeditor_plugins/cmsplugins/plugin.js index 83d617f1b..afaf25668 100644 --- a/djangocms_text_ckeditor/static/djangocms_text_ckeditor/ckeditor_plugins/cmsplugins/plugin.js +++ b/djangocms_text_ckeditor/static/djangocms_text_ckeditor/ckeditor_plugins/cmsplugins/plugin.js @@ -137,7 +137,6 @@ // if event is a jQuery event (touchend), than we mutate // event a bit so we make the payload similar to what ckeditor.event produces var handleEdit = function (event) { - event.stop(); if (event.type === 'touchend' || event.type === 'click') { var cmsPluginNode = $(event.currentTarget).closest('cms-plugin')[0]; diff --git a/djangocms_text_ckeditor/static/djangocms_text_ckeditor/js/dist/bundle-9f0bbac8ec.cms.ckeditor.min.js b/djangocms_text_ckeditor/static/djangocms_text_ckeditor/js/dist/bundle-a9032984d4.cms.ckeditor.min.js similarity index 99% rename from djangocms_text_ckeditor/static/djangocms_text_ckeditor/js/dist/bundle-9f0bbac8ec.cms.ckeditor.min.js rename to djangocms_text_ckeditor/static/djangocms_text_ckeditor/js/dist/bundle-a9032984d4.cms.ckeditor.min.js index 26ea7a08c..99d5f63dd 100644 --- a/djangocms_text_ckeditor/static/djangocms_text_ckeditor/js/dist/bundle-9f0bbac8ec.cms.ckeditor.min.js +++ b/djangocms_text_ckeditor/static/djangocms_text_ckeditor/js/dist/bundle-a9032984d4.cms.ckeditor.min.js @@ -1404,6 +1404,6 @@ CKEDITOR.env.webkit&&e.push("float:none;"),e.push('"'),e.push('align="',CKEDITOR * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ CKEDITOR.plugins.add("cmsresize",{init:function(e){function i(i){var t=i.originalEvent.screenX-s.x,r=i.originalEvent.screenY-s.y,a=d.width,c=d.height,l=a+t*("rtl"==o?-1:1),z=c+r;m&&(a=Math.max(n.resize_minWidth,Math.min(l,n.resize_maxWidth))),h&&(c=Math.max(n.resize_minHeight,Math.min(z,n.resize_maxHeight))),e.resize(m?a:null,c)}function t(){CMS.$(CKEDITOR.document.$).off("pointermove",i),CMS.$(CKEDITOR.document.$).off("pointerup",t),e.document&&(CMS.$(e.document.$).off("pointermove",i),CMS.$(e.document.$).off("pointerup",t))}var n=e.config,r=e.ui.spaceId("resizer"),o=e.element?e.element.getDirection(1):"ltr";if(!n.resize_dir&&(n.resize_dir="vertical"),void 0===n.resize_maxWidth&&(n.resize_maxWidth=3e3),void 0===n.resize_maxHeight&&(n.resize_maxHeight=3e3),void 0===n.resize_minWidth&&(n.resize_minWidth=750),void 0===n.resize_minHeight&&(n.resize_minHeight=250),!1!==n.resize_enabled){var s,d,a=null,m=("both"==n.resize_dir||"horizontal"==n.resize_dir)&&n.resize_minWidth!=n.resize_maxWidth,h=("both"==n.resize_dir||"vertical"==n.resize_dir)&&n.resize_minHeight!=n.resize_maxHeight,c=CKEDITOR.tools.addFunction(function(r){a||(a=e.getResizable()),d={width:a.$.offsetWidth||0,height:a.$.offsetHeight||0},s={x:r.screenX,y:r.screenY},n.resize_minWidth>d.width&&(n.resize_minWidth=d.width),n.resize_minHeight>d.height&&(n.resize_minHeight=d.height),CMS.$(CKEDITOR.document.$).on("pointermove",i),CMS.$(CKEDITOR.document.$).on("pointerup",t),e.document&&(CMS.$(e.document.$).on("pointermove",i),CMS.$(e.document.$).on("pointerup",t)),r.preventDefault&&r.preventDefault()});CMS.$(CKEDITOR.document.$).find("html").attr("data-touch-action","none"),e.on("destroy",function(){CKEDITOR.tools.removeFunction(c)}),e.on("uiSpace",function(i){if("bottom"==i.data.space){var t="";m&&!h&&(t=" cke_resizer_horizontal"),!m&&h&&(t=" cke_resizer_vertical");var n=''+("ltr"==o?"◢":"◣")+"";"ltr"==o&&"ltr"==t?i.data.html+=n:i.data.html=n+i.data.html}},e,null,100),e.on("maximize",function(i){e.ui.space("resizer")[i.data==CKEDITOR.TRISTATE_ON?"hide":"show"]()})}}})}(CMS.$); -!function(e){function t(e){var t=(e.match(/<\s*([^>\s]+)[\s\S]*?>/)||[0,!1]).splice(1),n=t.some(function(e){return e&&CKEDITOR.dtd.$block[e]}),i="span";return n&&(i="div"),i}function n(t,n){t.each(function(t,i){var l,a=e(i);l=e("<"+n+">"),e.each(i.attributes,function(e,t){l.attr(t.nodeName,t.nodeValue)}),l.html(a.html()),a.replaceWith(l)})}CKEDITOR&&CKEDITOR.plugins&&CKEDITOR.plugins.registered&&CKEDITOR.plugins.registered.cmsplugins||CKEDITOR.plugins.add("cmsplugins",{icons:"cmsplugins",init:function(t){var n=this;CKEDITOR.on("instanceReady",function(){var e=[];for(var i in t.widgets.instances)t.widgets.instances.hasOwnProperty(i)&&e.push(t.widgets.instances[i]);n.numberOfChildren=CKEDITOR.tools.array.filter(e,function(e){return"cms-widget"===e.name}).length}),this.unsaved_child_plugins=[];var i=CMS.CKEditor.editors[t.id].settings;if(this.setupCancelCleanupCallback(i),void 0===i||void 0===i.plugins)return!1;this.setupDialog(t),t.ui.add("cmsplugins",CKEDITOR.UI_PANELBUTTON,{toolbar:"cms,0",label:i.lang.toolbar,title:i.lang.toolbar,className:"cke_panelbutton__cmsplugins",modes:{wysiwyg:1},editorFocus:0,panel:{css:[CKEDITOR.skin.getPath("editor")].concat(t.config.contentsCss),attributes:{role:"cmsplugins","aria-label":i.lang.aria}},onBlock:function(i,l){l.element.setHtml(t.plugins.cmsplugins.setupDropdown(t)),e(l.element.$).find(".cke_panel_listItem a").bind("click",function(l){l.preventDefault(),n.addPlugin(e(this),i,t)})}}),t.contextMenu&&this.setupContextMenu(t),t.addCommand("cmspluginsEdit",{exec:function(){var e=n.getElementFromSelection(t),i=n.getPluginWidget(e);i&&n.editPlugin(i,t)}});var l=function(n){if(n.stop(),"touchend"===n.type||"click"===n.type){var i,l=e(n.currentTarget).closest("cms-plugin")[0];i=new CKEDITOR.dom.element(l).getParent(),n.data=n.data||{},t.getSelection().fake(i)}t.execCommand("cmspluginsEdit")};t.on("doubleclick",l),t.on("instanceReady",function(){}),this.setupDataProcessor(t)},getElementFromSelection:function(e){var t=e.getSelection();return t.getSelectedElement()||t.getCommonAncestor().getAscendant("cms-plugin",!0)},getPluginWidget:function(e){return e?e.getAscendant("cms-plugin",!0)||e.findOne("cms-plugin"):null},setupDialog:function(t){var n=this,i=function(){return{title:"",minWidth:200,minHeight:200,contents:[{elements:[{type:"html",html:'