From d145cb508ab8e8ee89053287fcb52cc06e7fa137 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Thu, 20 Jun 2024 09:08:32 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B07552=20-=20Fix=20regression=20from=20pre?= =?UTF-8?q?vious=20merge=20(f63abd9b)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Can't submit HTML field in the backoffice --- js/ckeditor/src/plugins/disabler/disabler.plugin.ts | 12 +++++++----- js/utils.js | 8 ++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/js/ckeditor/src/plugins/disabler/disabler.plugin.ts b/js/ckeditor/src/plugins/disabler/disabler.plugin.ts index a51bac3be..9ad8ccfa3 100644 --- a/js/ckeditor/src/plugins/disabler/disabler.plugin.ts +++ b/js/ckeditor/src/plugins/disabler/disabler.plugin.ts @@ -1,6 +1,12 @@ import { Plugin } from '@ckeditor/ckeditor5-core'; import {ClassicEditor} from "@ckeditor/ckeditor5-editor-classic"; +interface BlockFieldInterface{ + (element:HTMLElement, isBlocked: boolean):any; +} + +declare var BlockFieldElement: BlockFieldInterface; + export default class Disabler extends Plugin { static get pluginName() { @@ -36,11 +42,7 @@ export default class Disabler extends Plugin { // @ts-ignore const oElement = $(oEditor.ui.element); if(typeof oElement.block === 'function') { - if (oInputElement.disabled) { - oElement.block({message: '', blockMsgClass: '', enableValidation : true, baseZ: 9999, overlayCSS: { backgroundColor: '#ccd6e066'}}); - } else { - oElement.unblock(); - } + BlockFieldElement(oElement, oInputElement.disabled); } // handle ckeditor read only mode diff --git a/js/utils.js b/js/utils.js index 042e118fa..5bb9fc24f 100644 --- a/js/utils.js +++ b/js/utils.js @@ -314,6 +314,14 @@ function BlockField(field_id, bBlocked) { } } +function BlockFieldElement(element, bBlocked) { + if (bBlocked) { + element.block({message: '', enableValidation : true, baseZ: 9999, overlayCSS: { backgroundColor: '#ccd6e066'}}); + } else { + element.unblock(); + } +} + /** * Updates (enables/disables) a "duration" field */