Skip to content

Commit 5276ecb

Browse files
author
Roman Lytvynenko
committed
MC-30636: TinyMCE4: some HTML code breaks the editor
1 parent 847f941 commit 5276ecb

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,17 +168,22 @@ define([
168168
/(<span class="[^"]*magento-widget[^"]*"[^>]*>)?<img([^>]+id="[^>]+)>(([^>]*)<\/span>)?/i,
169169
function (match) {
170170
var attributes = wysiwyg.parseAttributesString(match[2]),
171-
widgetCode;
171+
widgetCode,
172+
result = match[0];
172173

173174
if (attributes.id) {
174-
widgetCode = Base64.idDecode(attributes.id);
175+
try {
176+
widgetCode = Base64.idDecode(attributes.id);
177+
} catch (e) {
178+
// Ignore and continue.
179+
}
175180

176-
if (widgetCode.indexOf('{{widget') !== -1) {
177-
return widgetCode;
181+
if (widgetCode && widgetCode.indexOf('{{widget') !== -1) {
182+
result = widgetCode;
178183
}
179184
}
180185

181-
return match[0];
186+
return result;
182187
}
183188
);
184189
},

0 commit comments

Comments
 (0)