From 13b5c00ed5ede68f2978a2676320c54599ab8f2d Mon Sep 17 00:00:00 2001 From: Luc MULLER Date: Wed, 29 Dec 2021 11:47:56 +0100 Subject: [PATCH] [bugfix/145]Fix disabled button. Solution is parsing of every toolbars, then checking if the command is 'image'. If yes, put the button state at 'off' since button.getState returns undefined --- Resources/Public/JavaScript/Plugins/typo3image.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Resources/Public/JavaScript/Plugins/typo3image.js b/Resources/Public/JavaScript/Plugins/typo3image.js index a962e56..b70a8d6 100644 --- a/Resources/Public/JavaScript/Plugins/typo3image.js +++ b/Resources/Public/JavaScript/Plugins/typo3image.js @@ -30,6 +30,16 @@ $shadowEditor = $('
').append(editor.element.$.innerText), existingImages = $shadowEditor.find('img'); + editor.toolbar.forEach(function(toolbar){ + if(toolbar.items){ + toolbar.items.forEach(function(item){ + if(item.command == 'image'){ + item.setState(CKEDITOR.TRISTATE_OFF) + } + }); + } + }); + if (additionalAttributes.length) { allowedAttributes.push.apply(allowedAttributes, additionalAttributes); }