Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded TinyMCE to 6.7.0 #3220

Merged
merged 57 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
3683b2d
First commit
fballiano Apr 25, 2023
c8fe0b5
First test converting the plugins
fballiano Apr 25, 2023
c87b2cd
Coverted part of the "variable" plugin
fballiano Apr 25, 2023
138fda1
typo
fballiano Apr 25, 2023
a6ccefd
typo
fballiano Apr 25, 2023
38e3527
renames plugin javascript files
fballiano Apr 25, 2023
51f3fd9
something starts to work
fballiano Apr 26, 2023
15c441e
Merge branch 'next' into tinymce6
fballiano May 9, 2023
938aff0
upgraded to 6.4.2
fballiano May 9, 2023
56908d5
Merge branch 'tinymce6' of github.com:fballiano/openmage into tinymce6
fballiano May 9, 2023
828ef09
Fixed showing of plugin buttons
fballiano May 9, 2023
d43ca5c
removed tinyMceEditors hash from prototypejs
fballiano May 9, 2023
318ff9f
close window image was ugly
fballiano May 9, 2023
437b4da
file selector starts to work
fballiano May 9, 2023
1a3aefb
Merge branch 'next' into tinymce6
fballiano May 9, 2023
4dc6a93
fix for image upload when tinymce is not enabled
fballiano May 9, 2023
f584bfe
Merge branch 'tinymce6' of github.com:fballiano/openmage into tinymce6
fballiano May 9, 2023
c32e341
Merge branch 'next' into tinymce6
fballiano May 15, 2023
bdcf3ff
merged branch next
fballiano Jul 15, 2023
1408f42
updated to 6.6.0
fballiano Jul 15, 2023
1f98220
Merge branch 'next' into tinymce6
fballiano Jul 21, 2023
1069158
encode/decode images directives
empiricompany Jul 21, 2023
4cbdd82
updated to 6.6.1
fballiano Aug 2, 2023
885a440
fix tinymce openmage variable and widget plugins and toolbar buttuns …
empiricompany Aug 6, 2023
fb7d6cb
Merge branch next
fballiano Aug 6, 2023
a7f3026
small cleanup
fballiano Aug 6, 2023
218a0f1
small cleanup
fballiano Aug 6, 2023
11d3133
removed custom css
fballiano Aug 6, 2023
9b80c42
languages
fballiano Aug 6, 2023
3d36452
languages
fballiano Aug 6, 2023
750a10c
Tinymce skin config (#13)
empiricompany Aug 7, 2023
18f4196
Fix prototype errors in chrome
empiricompany Aug 7, 2023
d2cdcca
set min-height (#15)
empiricompany Aug 8, 2023
d739ce3
fix tab changed on first load (#16)
empiricompany Aug 8, 2023
a5941cd
restore sysconfig original behavior (#17)
empiricompany Aug 8, 2023
9b48a81
Fixed php82 bug
fballiano Aug 15, 2023
1eb6a06
Merge branch 'next' into tinymce6
fballiano Aug 15, 2023
b4e4840
tinymce 6.6.2
fballiano Aug 15, 2023
9247d52
add searchandreplace, embedded media, fontfamily (#18)
empiricompany Aug 20, 2023
7737fec
removed openmage colors from variables/widgets icons
fballiano Aug 20, 2023
2d1c88e
more similar formatting between these two files
fballiano Aug 20, 2023
fd09b2f
removed emoticons plugin, it is useless since our DB is not utf8mb4
fballiano Aug 20, 2023
51f9491
Merge branch 'next' into tinymce6
fballiano Aug 21, 2023
1658ac3
Merge branch 'next' into tinymce6
fballiano Aug 21, 2023
5dd9689
Toolbar mode scrolling
fballiano Aug 21, 2023
0bc43f4
New layout for menus and menubars
fballiano Aug 22, 2023
37f44a2
Fixed widget label
fballiano Aug 23, 2023
3a2ff97
Fixed "api.setActive is not a funcion"
fballiano Aug 23, 2023
2cd4e0a
fix icon openmagevariable (#19)
empiricompany Aug 23, 2023
b832fc5
fix openmage plugins breaks help (#20)
empiricompany Aug 25, 2023
b8b39a3
Merge branch 'next' into tinymce6
fballiano Aug 29, 2023
f2b033a
TinyMCE 6.7.0
fballiano Aug 30, 2023
4879f22
Merge branch 'next' into tinymce6
fballiano Sep 6, 2023
58d063b
Merge branch 'next' into tinymce6
fballiano Sep 10, 2023
d3554e3
Merge branch 'next' into tinymce6
fballiano Sep 17, 2023
1f2efb0
Merge branch 'next' into tinymce6
fballiano Sep 24, 2023
288bd56
Merge branch 'next' into tinymce6
fballiano Oct 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected function _prepareForm()

$form->addField($this->getData('editor_element_id'), 'editor', [
'name' => 'content',
'style' => 'width:725px;height:460px',
'style' => 'height:460px',
'required' => true,
'force_load' => true,
'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig($config)
Expand Down
6 changes: 1 addition & 5 deletions app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ public function __construct()

$this->_formScripts[] = "
function toggleEditor() {
if (tinyMCE.getInstanceById('block_content') == null) {
tinyMCE.execCommand('mceAddControl', false, 'block_content');
} else {
tinyMCE.execCommand('mceRemoveControl', false, 'block_content');
}
tinymce.execCommand('mceToggleEditor', false, wysiwygblock_content);
}

function saveAndContinueEdit(){
Expand Down
6 changes: 1 addition & 5 deletions app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,7 @@ protected function _prepareLayout()

$this->_formScripts[] = "
function toggleEditor() {
if (tinyMCE.getInstanceById('page_content') == null) {
tinyMCE.execCommand('mceAddControl', false, 'page_content');
} else {
tinyMCE.execCommand('mceRemoveControl', false, 'page_content');
}
tinymce.execCommand('mceToggleEditor', false, wysiwygpage_content);
}

function saveAndContinueEdit(urlTemplate) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* OpenMage
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available at https://opensource.org/license/osl-3-0-php
*
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2023 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

/**
* Configuration source model for Wysiwyg skin
*
* @category Mage
* @package Mage_Adminhtml
*/
class Mage_Adminhtml_Model_System_Config_Source_Cms_Wysiwyg_Skin
{
public function toOptionArray()
{
return [
[
'value' => 'oxide',
'label' => 'Oxide'
],
[
'value' => 'oxide-dark',
'label' => 'Oxide Dark'
],
[
'value' => 'tinymce-5',
'label' => 'Tinymce 5'
],
[
'value' => 'tinymce-5-dark',
'label' => 'Tinymce 5 Dark'
]
];
}
}
12 changes: 6 additions & 6 deletions app/code/core/Mage/Cms/Model/Wysiwyg/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class Mage_Cms_Model_Wysiwyg_Config extends Varien_Object
*/
public const WYSIWYG_SKIN_IMAGE_PLACEHOLDER_FILE = 'images/wysiwyg/skin_image.png';

public const WYSIWYG_LOCALES = ['ar','az','be','bg_BG','bn_BD','ca','cs','cy','da','de','dv','el','eo','es','es_MX','et','eu','fa','fi','fr_FR','ga','gl','he_IL','hi','hr','hu_HU','hy','id','is_IS','it','ja','ka_GE','kab','kk','ko_KR','ku','lt','lv','nb_NO','ne','nl','nl_BE','oc','pl','pt_BR','ro','ru','sk','sl_SI','sq','sr','sv_SE','ta','tg','th_TH','tr','ug','uk','uz','vi','zh-Hans','zh-Hant','zh_HK','zh_MO','zh_SG'];

/**
* Return Wysiwyg config as Varien_Object
*
Expand All @@ -69,25 +71,23 @@ public function getConfig($data = [])
{
$config = new Varien_Object();

$locale = Mage::app()->getLocale()->getLocaleCode();
$lang = in_array($locale, self::WYSIWYG_LOCALES) ? $locale : substr($locale, 0, 2);
$config->setData([
'enabled' => $this->isEnabled(),
'hidden' => $this->isHidden(),
'skin' => Mage::getStoreConfig('cms/wysiwyg/skin'),
'use_container' => false,
'add_variables' => Mage::getSingleton('admin/session')->isAllowed('system/variable'),
'add_widgets' => Mage::getSingleton('admin/session')->isAllowed('cms/widget_instance'),
'no_display' => false,
'translator' => Mage::helper('cms'),
'encode_directives' => true,
'directives_url' => Mage::getSingleton('adminhtml/url')->getUrl('*/cms_wysiwyg/directive'),
'popup_css' =>
Mage::getBaseUrl('js') . 'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css',
'content_css' =>
Mage::getBaseUrl('js') . 'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css',
'width' => '100%',
'plugins' => [],
'media_disable_flash' => true
'lang' => $lang
]);

$config->setData('directives_url_quoted', preg_quote($config->getData('directives_url')));

if (Mage::getSingleton('admin/session')->isAllowed('cms/media_gallery')) {
Expand Down
1 change: 1 addition & 0 deletions app/code/core/Mage/Cms/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
<cms>
<wysiwyg>
<enabled>enabled</enabled>
<skin>oxide</skin>
</wysiwyg>
</cms>
<system>
Expand Down
14 changes: 14 additions & 0 deletions app/code/core/Mage/Cms/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,20 @@
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</enabled>
<skin translate="label">
<label>Skin WYSIWYG Editor</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_cms_wysiwyg_skin</source_model>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<depends>
<enabled separator="|">
<value>enabled|hidden</value>
</enabled>
</depends>
</skin>
</fields>
</wysiwyg>
</groups>
Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Core/Model/Variable/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public function getWysiwygPluginSettings($config)
$variableConfig = [];
$onclickParts = [
'search' => ['html_id'],
'subject' => 'MagentovariablePlugin.loadChooser(\'' . $this->getVariablesWysiwygActionUrl() . '\', \'{{html_id}}\');'
'subject' => 'OpenmagevariablePlugin.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/tinymce/plugins/openmagevariable.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/tinymce/plugins/openmagewidget.js',
'widget_images_url' => $this->getPlaceholderImagesBaseUrl(),
'widget_placeholders' => $this->getAvailablePlaceholderFilenames(),
'widget_window_url' => $this->getWidgetWindowUrl($config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ public function indexAction()
{
// save extra params for widgets insertion form
$skipped = $this->getRequest()->getParam('skip_widgets');
$skipped = Mage::getSingleton('widget/widget_config')->decodeWidgetsFromQuery($skipped);
if (is_string($skipped)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for type safety you should put $skipped as an empty array for the else case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in order not to drag this PR any longer I'd address it in a separate PR ASAP :-)

$skipped = Mage::getSingleton('widget/widget_config')->decodeWidgetsFromQuery($skipped);
}

Mage::register('skip_widgets', $skipped);

$this->loadLayout('empty')->renderLayout();
}

Expand Down
2 changes: 1 addition & 1 deletion app/design/adminhtml/default/default/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Default layout, loads most of the pages

<action method="addItem"><type>js</type><name>mage/adminhtml/rules.js</name><params/><if/><condition>can_load_rules_js</condition></action>

<action method="addItem"><type>js</type><name>mage/adminhtml/wysiwyg/tiny_mce/setup.js</name><params/><if/><condition>can_load_tiny_mce</condition></action>
<action method="addItem"><type>js</type><name>mage/adminhtml/wysiwyg/tinymce/setup.js</name><params/><if/><condition>can_load_tiny_mce</condition></action>

<block type="core/html_calendar" name="head.calendar" as="calendar" template="page/js/calendar.phtml"/>
</block>
Expand Down
2 changes: 1 addition & 1 deletion app/design/adminhtml/default/default/layout/oauth.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<action method="removeItem"><type>js</type><name>mage/adminhtml/uploader.js</name></action>
<action method="removeItem"><type>js</type><name>mage/adminhtml/product.js</name></action>
<action method="removeItem"><type>js</type><name>mage/adminhtml/rules.js</name></action>
<action method="removeItem"><type>js</type><name>mage/adminhtml/wysiwyg/tiny_mce/setup.js</name></action>
<action method="removeItem"><type>js</type><name>mage/adminhtml/wysiwyg/tinymce/setup.js</name></action>

<action method="removeItem"><type>css</type><name>print.css</name></action>
<action method="removeItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name></action>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ var catalogWysiwygEditor = {
if (dialogWindow.options.firedElementId) {
wysiwygObj = eval('wysiwyg'+dialogWindow.options.firedElementId+'_editor');
wysiwygObj.turnOff();
if (tinyMCE.get(wysiwygObj.id)) {
$(dialogWindow.options.firedElementId).value = tinyMCE.get(wysiwygObj.id).getContent();
if (tinymce.get(wysiwygObj.id)) {
$(dialogWindow.options.firedElementId).value = tinymce.get(wysiwygObj.id).getContent();
} else {
if ($(dialogWindow.options.firedElementId+'_editor')) {
$(dialogWindow.options.firedElementId).value = $(dialogWindow.options.firedElementId+'_editor').value;
Expand All @@ -94,8 +94,8 @@ var catalogWysiwygEditor = {

//destroy the instance of editor
wysiwygObj = eval('wysiwyg'+dialogWindow.options.firedElementId+'_editor');
if (tinyMCE.get(wysiwygObj.id)) {
tinyMCE.execCommand('mceRemoveControl', true, wysiwygObj.id);
if (tinymce.get(wysiwygObj.id)) {
tinymce.get(wysiwygObj.id).remove();
}

dialogWindow.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ var queueControl = {
queueForm.submit();
},
preview: function() {
if (this.isEditor() && tinyMCE.get(this.id)) {
tinyMCE.triggerSave();
if (this.isEditor() && tinymce.get(this.id)) {
tinymce.triggerSave();
$('preview_text').value = $(this.id).value;
tinyMCE.triggerSave();
tinymce.triggerSave();
} else {
$('preview_text').value = $(this.id).value;
}
Expand All @@ -77,7 +77,7 @@ var queueControl = {
return false;
},
isEditor: function() {
return (typeof tinyMceEditors != 'undefined' && tinyMceEditors.get(this.id) != undefined)
return (typeof tinyMceEditors != 'undefined' && tinyMceEditors[this.id] != undefined)
},
resume: function() {
$('_resume_flag').value = '1';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
$('change_flag_element').value = '1';
}
if(this.isEditor()) {
tinyMCE.triggerSave();
tinymce.triggerSave();
}
templateForm.submit();
return false;
Expand All @@ -129,7 +129,7 @@
$('save_as_flag').value = '1';

if(this.isEditor()) {
tinyMCE.triggerSave();
tinymce.triggerSave();
}
templateForm.submit();
return false;
Expand All @@ -141,10 +141,10 @@
} else {
$('preview_type').value = 2;
}
if (this.isEditor() && tinyMCE.get(this.id)) {
tinyMCE.triggerSave();
if (this.isEditor() && tinymce.get(this.id)) {
tinymce.triggerSave();
$('preview_text').value = $(this.id).value;
tinyMCE.triggerSave();
tinymce.triggerSave();
} else {
$('preview_text').value = $(this.id).value;
}
Expand All @@ -165,11 +165,11 @@
},

isEditor: function() {
return (typeof tinyMceEditors != 'undefined' && tinyMceEditors.get(this.id) != undefined)
return (typeof tinyMceEditors != 'undefined' && tinyMceEditors[this.id] != undefined)
},

getEditor: function() {
return tinyMceEditors.get(this.id);
return tinyMceEditors[this.id];
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<?php endif ?>

<?php if ($this->getCanLoadTinyMce()): // TinyMCE is broken when loaded through index.php?>
<script type="text/javascript" src="<?php echo $this->getJsUrl() ?>tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="<?php echo $this->getJsUrl() ?>tinymce/tinymce.min.js"></script>
<?php endif ?>

<script type="text/javascript">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@
} else {
$('preview_type').value = 2;
}
if (typeof tinyMCE == 'undefined' || !tinyMCE.getInstanceById('template_text')) {
if (typeof tinymce == 'undefined' || !tinymce.get('template_text')) {
$('preview_text').value = $('template_text').value;
} else {
$('preview_text').value = tinyMCE.getInstanceById('template_text').getHTML();
$('preview_text').value = tinymce.get('template_text').getContent();
}

if ($('template_styles') != undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
case 'wysiwyg': ?>
<span class="form_row">
<label for="<?php echo $element->getHtmlId() ?>"><?php echo $element->getLabel() ?>:</label>
<script type="text/javascript" src="<?php echo Mage::getBaseUrl('js') ?>tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="<?php echo Mage::getBaseUrl('js') ?>tinymce/tinymce.min.js"></script>
<script type="text/javascript">
//<![CDATA[
tinyMCE.init({
Expand Down
Loading