{"id":529,"date":"2019-07-30T08:30:40","date_gmt":"2019-07-30T08:30:40","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2019\/07\/30\/configure-tinymce4-toolbar-in-magento-2-3-x\/"},"modified":"2025-07-21T16:17:53","modified_gmt":"2025-07-21T10:47:53","slug":"configure-tinymce4-toolbar-in-magento-2-3-x","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/configure-tinymce4-toolbar-in-magento-2-3-x\/","title":{"rendered":"How to Configure TinyMCE4 Toolbar in Magento 2.3.x"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.tiny.cloud\/\" target=\"_blank\" rel=\"noreferrer noopener\">TinyMCE<\/a>&nbsp;is a rich-text WYSIWYG editor. It is one of the important elements that admin use frequently in Magento 2 stores.&nbsp;It facilitates the admin to convert HTML text area fields or other HTML elements to editor instances.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, with the recent Magento 2.3.x versions, the layout of TinyMCE4 toolbar has changed. The default TinyMCE4 toolbar in Magento 2.3.x versions do not include options like font color, background color, code, color picker, etc. These are the essential options that admin may require often.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The default editor that you get with the Magento 2.3.x versions looks something like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2019\/07\/Before-1024x544.png\" alt=\"Magento 2.3.x versions\" class=\"wp-image-6139\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Hence, I have come up with a programmatic solution to <em><strong>configure TinyMCE4 toolbar in Magento 2.3.x<\/strong><\/em> versions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This solution uses the method to <a href=\"https:\/\/meetanshi.com\/blog\/create-plugin-interceptor-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">create plugin in Magento 2<\/a> which I have already given earlier.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to Configure TinyMCE4 Toolbar in Magento 2.3.x:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1. Create <em><strong>registration.php<\/strong><\/em> file in <strong><strong>app\\code\\[Vendor]\\[Namespace]\\<\/strong><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n        \\Magento\\Framework\\Component\\ComponentRegistrar::register(\n            \\Magento\\Framework\\Component\\ComponentRegistrar::MODULE,\n            '[Vendor]_[Namespace]',\n            __DIR__\n        );<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. Create <em><strong>module.xml<\/strong><\/em> file in <strong><strong>app\\code\\[Vendor]\\[Namespace]\\etc<\/strong><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version=\"1.0\"?>\n    &lt;config xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:Module\/etc\/module.xsd\">\n        &lt;module name=\"[Vendor]_[Namespace]\" setup_version=\"1.0.0\"\/>\n    &lt;\/config><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3. Create&nbsp;<em><strong>di.xml<\/strong><\/em>&nbsp;file in&nbsp;<strong><strong>app\\code\\[Vendor]\\[Namespace]\\etc<\/strong><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version=\"1.0\"?>\n    &lt;config xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:ObjectManager\/etc\/config.xsd\">\n        &lt;type name=\"Magento\\Ui\\Component\\Wysiwyg\\ConfigInterface\">\n            &lt;plugin name=\"custom_name\"\n                    type=\"[Vendor]\\[Namespace]\\Plugin\\Config\"\n                    sortOrder=\"10\"\/>\n        &lt;\/type>\n    &lt;\/config><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">4. Create&nbsp;<em><strong>Config.php<\/strong><\/em>&nbsp;in&nbsp;<strong><strong>[Vendor]\\[Namespace]\\Plugin\\<\/strong><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\n    namespace [Vendor]\\[Namespace]\\Plugin;\n\n\n    class Config\n    {\n\n     protected $activeEditor;\n\n        public function __construct(\\Magento\\Ui\\Block\\Wysiwyg\\ActiveEditor $activeEditor)\n        {\n            $this->activeEditor = $activeEditor;\n        }\n\n        public function afterGetConfig(\n            \\Magento\\Ui\\Component\\Wysiwyg\\ConfigInterface $configInterface,\n            \\Magento\\Framework\\DataObject $result\n        ) {\n\n            $editor = $this->activeEditor->getWysiwygAdapterPath();\n\n            if(strpos($editor,'tinymce4Adapter')){\n\n            if (($result->getDataByPath('settings\/menubar')) || ($result->getDataByPath('settings\/toolbar')) || ($result->getDataByPath('settings\/plugins'))){\n                return $result;\n            }\n\n            $settings = $result->getData('settings');\n\n            if (!is_array($settings)) {\n                $settings = [];\n            }\n\n            $settings['menubar'] = true;\n            $settings['toolbar'] = 'undo redo | styleselect | fontsizeselect | forecolor backcolor | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table | image | code';\n            $settings['plugins'] = 'textcolor image code';\n\n            $result->setData('settings', $settings);\n                return $result;\n            }\n            else{\n                return $result;\n            }\n        }\n    }<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After implementing this method, you can use the editor as shown below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2019\/07\/After-1024x550.png\" alt=\"backend WYSIWYG editor\" class=\"wp-image-6140\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Quite helpful options will now be available in your backend WYSIWYG editor!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I\u2019d be very grateful if you helped share this helpful post on social media to fellow developers!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>TinyMCE&nbsp;is a rich-text WYSIWYG editor. It is one of the important elements that admin use frequently in Magento 2 stores.&nbsp;It facilitates the admin to convert&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-529","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/529","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=529"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/529\/revisions"}],"predecessor-version":[{"id":18791,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/529\/revisions\/18791"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=529"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=529"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=529"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}