Skip to content

Adding support for newlines characters to the Wysiwyg widget plugin regex #185

@simonlandry0

Description

@simonlandry0

Pulling my old issue from magento/magento2#23571

Description (*)

The Magento Wysiwyg plugin for tinymce4 does not detect a widget when it has a new line in the data because of a regex. Changing this regex would add support for textarea inputs and other inputs which might have a newline in widgets.

https://github.com/magento/magento2/blob/2.3-develop/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js#L126

This regex should be changed:
(old)
return content.gsub(/\{\{widget(.*?)\}\}/i, function (match) {
(suggested)
return content.gsub(/\{\{widget([^}]*?)\}\}/i, function (match) {

Expected behavior (*)

Wysiwyg widgets should not break with newline characters in the text data.

Benefits

Would allow for widgets with data that have newlines inside them. Currently the base installation of Magento does not have any widget inputs that can have newlines in them, but would add room for developers to create their own textarea/wysiwyg inputs.

Additional information

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions