Skip to content

Commit

Permalink
replace scripts (#218)
Browse files Browse the repository at this point in the history
Co-authored-by: AlexTzykin <[email protected]>
  • Loading branch information
basilkot and AlexTzykin committed Oct 23, 2023
1 parent af47ca8 commit 855de3f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ angular.module('virtoCommerce.coreModule.common').directive('vcUkHtmleditor', [f
var htmlEditor = UIkit.htmleditor(element, { mode: 'split', maxsplitsize: 1000, markdown: true, enablescripts: false, iframe: true });
var codeMirror = htmlEditor.editor;
//Besides inline scripts need to also eliminate inline event handlers on preview
htmlEditor.on('render', function () {
htmlEditor.on('render', function (event, uiEditor) {
uiEditor.currentvalue = uiEditor.currentvalue.replace(/<(script|style)\b[^<]*(?:(?!<\/(script|style))<[^<]*)*<\/(script|style)[>\s]/img, '');
htmlEditor.replaceInPreview(/(?:<[^>]+\s)((on\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?)/ig, eventReplacer);
});
htmlEditor.addButtons({
Expand Down

0 comments on commit 855de3f

Please sign in to comment.