Closed alextaranishyn closed 2 years ago
grapesjs-component-code-editor/index.js updateHtml method uses invalid regex symbols for Safari browser
e?.preventDefault(); const { editor, component } = this; let htmlCode = this.htmlCodeEditor.getContent().trim(); if (!htmlCode || htmlCode === this.previousHtmlCode) return; this.previousHtmlCode = htmlCode; let idStyles = ''; this.cssCodeEditor .getContent() .split(/(?<=}\n)/g) .forEach(rule => { if (/^#/.test(rule)) idStyles += rule; }); htmlCode += `<style>${idStyles}</style>`; if (component.attributes.type === 'wrapper') { editor.setComponents(htmlCode); } else { editor.select(component.replaceWith(htmlCode)); } }``` .split(/(?<=}\n)/g) use lookbehind symbol
Haven't had the chance to test on safari, is there an alternative that would work for safari and other browsers? Would be open to merging the PR
grapesjs-component-code-editor/index.js updateHtml method uses invalid regex symbols for Safari browser