Skip to content

Commit

Permalink
Coverted part of the "variable" plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
fballiano committed Apr 25, 2023
1 parent c8fe0b5 commit c87b2cd
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'});
tinymce.init({selector: 'textarea#block_content', branding: false, promotion: false, plugins: 'lists advlist directionality image link media nonbreaking preview quickbars openmagevariable'});
} else {
tinymce.get('block_content').remove();
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'});
tinymce.init({selector: 'textarea#page_content', branding: false, promotion: false, plugins: 'lists advlist directionality image link media nonbreaking preview quickbars openmagevariable'});
} else {
tinymce.get('page_content').remove();
}
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Core/Model/Variable/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function getWysiwygPluginSettings($config)
'search' => ['html_id'],
'subject' => 'MagentovariablePlugin.loadChooser(\'' . $this->getVariablesWysiwygActionUrl() . '\', \'{{html_id}}\');'
];
$variableWysiwygPlugin = [['name' => 'magentovariable',
$variableWysiwygPlugin = [['name' => 'openmagevariable',
'src' => $this->getWysiwygJsPluginSrc(),
'options' => [
'title' => Mage::helper('adminhtml')->__('Insert Variable...'),
Expand All @@ -54,7 +54,7 @@ public function getWysiwygPluginSettings($config)
*/
public function getWysiwygJsPluginSrc()
{
return Mage::getBaseUrl('js') . 'mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js';
return Mage::getBaseUrl('js') . 'mage/adminhtml/wysiwyg/tiny_mce/plugins/openmagevariable/editor_plugin.js';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Widget/Model/Widget/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/tiny_mce/plugins/magentowidget/editor_plugin.js',
'widget_plugin_src' => Mage::getBaseUrl('js') . 'mage/adminhtml/wysiwyg/tiny_mce/plugins/openmagewidget/editor_plugin.js',
'widget_images_url' => $this->getPlaceholderImagesBaseUrl(),
'widget_placeholders' => $this->getAvailablePlaceholderFilenames(),
'widget_window_url' => $this->getWidgetWindowUrl($config)
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,16 @@
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

tinymce.PluginManager.add('OpenMageVariablePlugin', (ed, url) => {
ed.addCommand('mceMagentovariable', function() {
var pluginSettings = ed.settings.magentoPluginsOptions.get('magentovariable');
MagentovariablePlugin.setEditor(ed);
MagentovariablePlugin.loadChooser(pluginSettings.url, null);
});

// Register Widget plugin button
ed.addButton('magentovariable', {
title : 'magentovariable.insert_variable',
cmd : 'mceMagentovariable',
image : url + '/img/icon.gif'
tinymce.PluginManager.add('openmagevariable', (ed, url) => {
//TODO: the button doesn't show on the toolbar
ed.ui.registry.addButton('openmagevariable', {
text: 'Insert Variable',
onAction: () => {
//TODO: the code of this method needs to be converted to tinymce6
var pluginSettings = ed.settings.magentoPluginsOptions.get('openmagevariable');
openmagevariable.setEditor(ed);
openmagevariable.loadChooser(pluginSettings.url, null);
}
});

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

tinymce.PluginManager.add('OpenMageWidgetPlugin', (ed, url) => {
tinymce.PluginManager.add('openmagewidget', (ed, url) => {
ed.addCommand('mceMagentowidget', function() {
widgetTools.openDialog(ed.settings.magentowidget_url + 'widget_target_id/' + ed.getElement().id + '/');
});
Expand Down
File renamed without changes.

0 comments on commit c87b2cd

Please sign in to comment.