From 10ac750aaecf502500dc08966f4642a8604a685b Mon Sep 17 00:00:00 2001 From: Benjamin Vray Date: Tue, 27 Oct 2020 13:55:37 +0000 Subject: [FIX] web_editor: allow single quotes in getShapeData Before this commit, the value of data-oe-shape-data required double quotes to be properly parsed in JSON in the getShapeData method. After this commit, we also allow single quotes to prevent issue if someone doesn't use double quotes in the the value of data-oe-shape-data. Which was precisely the case in one of the themes and this is why this commit is a fix. task-2327741 closes odoo/odoo#60835 Related: odoo/design-themes#421 Signed-off-by: Quentin Smetz (qsm) --- addons/web_editor/static/src/js/editor/snippets.options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web_editor/static/src') diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index 552652f23b8..5050a622bd6 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -4023,7 +4023,7 @@ registry.BackgroundShape = SnippetOptionWidget.extend({ flip: [], }; const json = target.dataset.oeShapeData; - return json ? Object.assign(defaultData, JSON.parse(json)) : defaultData; + return json ? Object.assign(defaultData, JSON.parse(json.replace(/'/g, '"'))) : defaultData; }, /** * Returns the default colors for the currently selected shape. -- cgit v1.2.3