From 032316d53135a0ece8eefe14a76364d035ac5196 Mon Sep 17 00:00:00 2001 From: Vova Yatsyuk Date: Thu, 9 Nov 2017 14:22:56 +0200 Subject: [PATCH 1/2] Fixed js error when disabling element, but editor is not active --- app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index d0655a98d2586..90dc6b0293c7a 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -94,7 +94,7 @@ define([ this.$wysiwygEditorButton.attr('disabled', status); /* eslint-disable no-undef */ - if (tinyMCE) { + if (tinyMCE && tinyMCE.activeEditor) { _.each(tinyMCE.activeEditor.controlManager.controls, function (property, index, controls) { controls[property.id].setDisabled(status); }); From 3b139c4cdc65d03c3c07a6f22837e222bf9d5315 Mon Sep 17 00:00:00 2001 From: Vova Yatsyuk Date: Thu, 9 Nov 2017 14:23:40 +0200 Subject: [PATCH 2/2] Disable all editor buttons instead of the last one --- app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index 90dc6b0293c7a..b8cd4a0f2c892 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -45,7 +45,8 @@ define([ component: this, selector: 'button' }, function (element) { - this.$wysiwygEditorButton = $(element); + this.$wysiwygEditorButton = this.$wysiwygEditorButton ? + this.$wysiwygEditorButton.add($(element)) : $(element); }.bind(this)); return this;