Skip to content

Display Wysiwyg Editor button for 'HTML Code' PageBuilder element in Adobe Commerce (Magento 2)

License

Notifications You must be signed in to change notification settings

acid-unit/module-wysiwyg-editor

Repository files navigation

About

Get back [Show / Hide Editor] button for HTML Code PageBuilder element which triggers TinyMCE WYSIWYG Editor.

Pagebuilder Editor Demo

Editor for admin panel text fields

Additionally, this module provides the ability to toggle WYSIWYG editor for admin panel text fields.
Toggle button should be defined as a new <field> element with the following inner structure:

  • <attribute type="target_field">{section_id}_{group_id}_{field_id}</attribute>
  • <frontend_model>AcidUnit\WysiwygEditor\Block\Adminhtml\System\Config\Form\Field\ToggleEditorButton</frontend_model>

Use the code below as an example.

<section id="page">
    ...
    <group id="form">
        ...
        <field id="editable_field" type="textarea" sortOrder="10">
            ...
        </field>
        
        <field id="editable_field_toggle_editor" sortOrder="15">
            <attribute type="target_field">page_form_editable_field</attribute>
            <frontend_model>AcidUnit\WysiwygEditor\Block\Adminhtml\System\Config\Form\Field\ToggleEditorButton</frontend_model>
        </field>
    </group>
</section>

Admin Field Editor Demo

Installation

composer require acid-unit/module-wysiwyg-editor

Post-installation

No additional actions required. After installation, [Show / Hide Editor] button will appear for all HTML Code PageBuilder elements. Still, the button can be hidden without removing the module by toggling off the following field under Stores > Settings > Configuration > General > Content Management > WYSIWYG Options admin section:

Toggle Pagebuilder Editor

Requirements

  • Adobe Commerce 2.4.4 or newer
  • PHP 8.1 or newer