From bd6749e7504a196bc3df403f003cd8ba7749e037 Mon Sep 17 00:00:00 2001 From: Benjamin Vray Date: Tue, 27 Oct 2020 13:55:37 +0000 Subject: [PATCH] [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#61487 X-original-commit: 10ac750aaecf502500dc08966f4642a8604a685b Related: odoo/design-themes#423 Signed-off-by: Quentin Smetz (qsm) --- addons/web_editor/static/src/js/editor/snippets.options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 1540ad6b8bc..2ea2658e31a 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -4106,7 +4106,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.