Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: gracefully handle invalid JSON in data-style attribute (#1393) #1394

Merged
merged 1 commit into from
May 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: gracefully handle invalid JSON in data-style attribute (#1393):
georgel-pop-lr committed May 18, 2020
commit 36611ab9ec38441a9a6c006e920bdc8c721bb2f6
10 changes: 9 additions & 1 deletion src/plugins/embedurl.js
Original file line number Diff line number Diff line change
@@ -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 (_error) {
styles = null;
}
}

if (!styles) {
const iframe = instance.wrapper.findOne('iframe');