From 38e3527bbe541b6b704b648d312ae7e22bb2c136 Mon Sep 17 00:00:00 2001 From: Fabrizio Balliano Date: Tue, 25 Apr 2023 18:22:50 +0100 Subject: [PATCH] renames plugin javascript files --- .../Mage/Adminhtml/Block/Cms/Block/Edit.php | 2 +- .../core/Mage/Adminhtml/Block/Cms/Page/Edit.php | 2 +- .../core/Mage/Core/Model/Variable/Config.php | 2 +- .../core/Mage/Widget/Model/Widget/Config.php | 2 +- .../editor_plugin.js => openmagevariable.js} | 0 .../editor_plugin.js => openmagewidget.js} | 17 +++++++++-------- 6 files changed, 13 insertions(+), 12 deletions(-) rename js/mage/adminhtml/wysiwyg/tinymce/plugins/{openmagevariable/editor_plugin.js => openmagevariable.js} (100%) rename js/mage/adminhtml/wysiwyg/tinymce/plugins/{openmagewidget/editor_plugin.js => openmagewidget.js} (76%) diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit.php b/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit.php index da6739c8ae0..245281997f9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit.php @@ -40,7 +40,7 @@ public function __construct() $this->_formScripts[] = " function toggleEditor() { if (tinymce.get('block_content') === null) { - tinymce.init({selector: 'textarea#block_content', branding: false, promotion: false, plugins: 'lists advlist directionality image link media nonbreaking preview quickbars openmagevariable'}); + tinymce.init({selector: 'textarea#block_content', branding: false, promotion: false, plugins: 'lists advlist directionality image link media nonbreaking preview quickbars openmagevariable openmagewidget'}); } else { tinymce.get('block_content').remove(); } diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit.php b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit.php index 8173a6190c5..5dc4857fd17 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit.php @@ -106,7 +106,7 @@ protected function _prepareLayout() $this->_formScripts[] = " function toggleEditor() { if (tinymce.get('page_content') === null) { - tinymce.init({selector: 'textarea#page_content', branding: false, promotion: false, plugins: 'lists advlist directionality image link media nonbreaking preview quickbars openmagevariable'}); + tinymce.init({selector: 'textarea#page_content', branding: false, promotion: false, plugins: 'lists advlist directionality image link media nonbreaking preview quickbars openmagevariable openmagewidget'}); } else { tinymce.get('page_content').remove(); } diff --git a/app/code/core/Mage/Core/Model/Variable/Config.php b/app/code/core/Mage/Core/Model/Variable/Config.php index 3524cd72a90..56709e3ee00 100644 --- a/app/code/core/Mage/Core/Model/Variable/Config.php +++ b/app/code/core/Mage/Core/Model/Variable/Config.php @@ -54,7 +54,7 @@ public function getWysiwygPluginSettings($config) */ public function getWysiwygJsPluginSrc() { - return Mage::getBaseUrl('js') . 'mage/adminhtml/wysiwyg/tinymce/plugins/openmagevariable/editor_plugin.js'; + return Mage::getBaseUrl('js') . 'mage/adminhtml/wysiwyg/tinymce/plugins/openmagevariable.js'; } /** diff --git a/app/code/core/Mage/Widget/Model/Widget/Config.php b/app/code/core/Mage/Widget/Model/Widget/Config.php index b84aaf4a37c..a27cb8c7122 100644 --- a/app/code/core/Mage/Widget/Model/Widget/Config.php +++ b/app/code/core/Mage/Widget/Model/Widget/Config.php @@ -30,7 +30,7 @@ class Mage_Widget_Model_Widget_Config extends Varien_Object public function getPluginSettings($config) { return [ - 'widget_plugin_src' => Mage::getBaseUrl('js') . 'mage/adminhtml/wysiwyg/tinymce/plugins/openmagewidget/editor_plugin.js', + 'widget_plugin_src' => Mage::getBaseUrl('js') . 'mage/adminhtml/wysiwyg/tinymce/plugins/openmagewidget.js', 'widget_images_url' => $this->getPlaceholderImagesBaseUrl(), 'widget_placeholders' => $this->getAvailablePlaceholderFilenames(), 'widget_window_url' => $this->getWidgetWindowUrl($config) diff --git a/js/mage/adminhtml/wysiwyg/tinymce/plugins/openmagevariable/editor_plugin.js b/js/mage/adminhtml/wysiwyg/tinymce/plugins/openmagevariable.js similarity index 100% rename from js/mage/adminhtml/wysiwyg/tinymce/plugins/openmagevariable/editor_plugin.js rename to js/mage/adminhtml/wysiwyg/tinymce/plugins/openmagevariable.js diff --git a/js/mage/adminhtml/wysiwyg/tinymce/plugins/openmagewidget/editor_plugin.js b/js/mage/adminhtml/wysiwyg/tinymce/plugins/openmagewidget.js similarity index 76% rename from js/mage/adminhtml/wysiwyg/tinymce/plugins/openmagewidget/editor_plugin.js rename to js/mage/adminhtml/wysiwyg/tinymce/plugins/openmagewidget.js index 113f88a912e..8122317644b 100644 --- a/js/mage/adminhtml/wysiwyg/tinymce/plugins/openmagewidget/editor_plugin.js +++ b/js/mage/adminhtml/wysiwyg/tinymce/plugins/openmagewidget.js @@ -13,18 +13,18 @@ */ tinymce.PluginManager.add('openmagewidget', (ed, url) => { - ed.addCommand('mceMagentowidget', function() { - widgetTools.openDialog(ed.settings.magentowidget_url + 'widget_target_id/' + ed.getElement().id + '/'); - }); - // Register Widget plugin button - ed.addButton('magentowidget', { - title : 'magentowidget.insert_widget', - cmd : 'mceMagentowidget', - image : url + '/img/icon.gif' + //TODO: the button doesn't show on the toolbar + ed.ui.registry.addButton('magentowidget', { + text : 'Insert Widget', + onAction: () => { + //TODO: the code of this method needs to be converted to tinymce6 + widgetTools.openDialog(ed.settings.magentowidget_url + 'widget_target_id/' + ed.getElement().id + '/'); + } }); // Add a node change handler, selects the button in the UI when a image is selected + // TODO: is this needed? in case, needs to be converted ed.onNodeChange.add(function(ed, cm, n) { cm.setActive('magentowidget', false); if (n.id && n.nodeName == 'IMG') { @@ -36,6 +36,7 @@ tinymce.PluginManager.add('openmagewidget', (ed, url) => { }); // Add a widget placeholder image double click callback + // TODO: all this method needs to be converted ed.onDblClick.add(function(ed, e) { var n = e.target; if (n.id && n.nodeName == 'IMG') {