diff --git a/src/plugins/embedurl.js b/src/plugins/embedurl.js index ee68d5a7a2..ef44f82ce2 100644 --- a/src/plugins/embedurl.js +++ b/src/plugins/embedurl.js @@ -406,11 +406,19 @@ if (!CKEDITOR.plugins.get('embedurl')) { // Sync dimensions and alignment with editor wrapper + let styles = null; + const stylesJSON = instance.element.getAttribute( 'data-styles' ); - let styles = stylesJSON ? JSON.parse(stylesJSON) : null; + if (stylesJSON) { + try { + styles = JSON.parse(stylesJSON); + } catch (e) { + console.warn('Unable to parse data-styles attribute!'); + } + } if (!styles) { const iframe = instance.wrapper.findOne('iframe');