Skip to content

Commit

Permalink
Merge pull request #32 from ivanhrytsaim/12062-TinyMCE-support-upgrade
Browse files Browse the repository at this point in the history
12062-TinyMCE-support-upgrade
  • Loading branch information
magefan authored Oct 25, 2024
2 parents 1cd88c6 + 8661436 commit 478dfba
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Plugin/Magento/Ui/Component/Wysiwyg/ConfigPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ public function afterGetConfig(
// Get current wysiwyg adapter's path
$editor = $this->activeEditor->getWysiwygAdapterPath();

// Is the current wysiwyg tinymce v4 or v5?
if (strpos($editor, 'tinymce4Adapter') || strpos($editor, 'tinymce5Adapter')) {
// Is the current wysiwyg tinymce v4 or v5 or v7?
if (strpos($editor, 'tinymce4Adapter') || strpos($editor, 'tinymce5Adapter') || strpos($editor, 'tinymceAdapter')) {

if (($result->getDataByPath('settings/menubar')) || ($result->getDataByPath('settings/toolbar')) || ($result->getDataByPath('settings/plugins'))) {
// do not override ui_element config (unsure if this is needed)
Expand All @@ -112,11 +112,16 @@ public function afterGetConfig(
$settings['menubar'] = true;
$settings['image_advtab'] = true;

$settings['plugins'] = 'advlist autolink code colorpicker directionality hr imagetools link media noneditable paste print table textcolor toc visualchars anchor charmap codesample contextmenu help image insertdatetime lists nonbreaking pagebreak preview searchreplace template textpattern visualblocks wordcount magentovariable magentowidget emoticons';
if (strpos($editor, 'tinymceAdapter')) {
$settings['plugins'] = 'advlist autolink code colorpicker directionality hr imagetools link media noneditable paste print table toc visualchars anchor charmap codesample contextmenu help image insertdatetime lists nonbreaking pagebreak preview searchreplace template textpattern visualblocks wordcount magentovariable magentowidget emoticons';
$settings['toolbar1'] = 'magentovariable magentowidget | blocks | styles | fontfamily | fontsize | lineheight | forecolor backcolor | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent';
} else {
$settings['plugins'] = 'advlist autolink code colorpicker directionality hr imagetools link media noneditable paste print table textcolor toc visualchars anchor charmap codesample contextmenu help image insertdatetime lists nonbreaking pagebreak preview searchreplace template textpattern visualblocks wordcount magentovariable magentowidget emoticons';
$settings['toolbar1'] = 'magentovariable magentowidget | formatselect | styleselect | fontselect | fontsizeselect | lineheight | forecolor backcolor | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent';
$settings['force_p_newlines'] = false;
}

$settings['toolbar1'] = 'magentovariable magentowidget | formatselect | styleselect | fontselect | fontsizeselect | lineheight | forecolor backcolor | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent';
$settings['toolbar2'] = ' undo redo | link anchor table charmap | image media insertdatetime | widget | searchreplace visualblocks help | hr pagebreak | emoticons';
$settings['force_p_newlines'] = false;

$settings['valid_children'] = '+body[style]';

Expand Down

0 comments on commit 478dfba

Please sign in to comment.