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.
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.
Pulling my old issue from https://github.com/magento/magento2/issues/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