From 7e03e8ea144b404beaf05d792cb2d386f05c5a84 Mon Sep 17 00:00:00 2001 From: David Monjoie Date: Thu, 22 Oct 2020 15:15:05 +0000 Subject: [PATCH] [IMP] web_editor: update Jabberwock library to commit a7ba7c34 Changelog: [FIX] Template: ensure an overflow on the template container [FIX] OdooWebsiteEditor: On mobile, shows the boudary box inside [FIX] Odoo: double clicking on a link allows you to edit it in full --- .../static/lib/jabberwock/jabberwock.css | 1 + .../static/lib/jabberwock/jabberwock.js | 34 ++++++++++++------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/addons/web_editor/static/lib/jabberwock/jabberwock.css b/addons/web_editor/static/lib/jabberwock/jabberwock.css index 5349495296e..f730077d4b0 100644 --- a/addons/web_editor/static/lib/jabberwock/jabberwock.css +++ b/addons/web_editor/static/lib/jabberwock/jabberwock.css @@ -160,6 +160,7 @@ jw-templates { background-color: #ffffff; padding: 3px; display: block; + overflow: auto; } jw-templates ~ * { display: none !important; diff --git a/addons/web_editor/static/lib/jabberwock/jabberwock.js b/addons/web_editor/static/lib/jabberwock/jabberwock.js index 0f0cdc85648..a0b43dd5b4d 100644 --- a/addons/web_editor/static/lib/jabberwock/jabberwock.js +++ b/addons/web_editor/static/lib/jabberwock/jabberwock.js @@ -21744,11 +21744,25 @@ odoo.define('web_editor.jabberwock', (function(require) { const domObjects = await super.render(format, contents); const link = domObjects[0]; if ('tag' in link) { - const dbclickCallback = () => { - this.engine.editor.execCommand('openLinkDialog'); - }; + let dbclickCallback; const savedAttach = link.attach; link.attach = (el) => { + dbclickCallback = async (ev) => { + ev.preventDefault(); + const layout = this.engine.editor.plugins.get(Layout); + const domEngine = layout.engines.dom; + const nodes = domEngine.getNodes(el); + await this.engine.editor.execCommand('setSelection', { + vSelection: { + anchorNode: nodes[0], + anchorPosition: RelativePosition.BEFORE, + focusNode: nodes[nodes.length - 1], + focusPosition: RelativePosition.AFTER, + direction: Direction.FORWARD, + }, + }); + this.engine.editor.execCommand('openLinkDialog'); + }; if (savedAttach) { savedAttach(el); } @@ -23637,8 +23651,10 @@ odoo.define('web_editor.jabberwock', (function(require) {
- - + + + +
@@ -23686,11 +23702,6 @@ odoo.define('web_editor.jabberwock', (function(require) { const zone = new ZoneNode({ managedZones: ['editable'] }); zone.editable = true; div.append(zone); - if (options.devicePreview) { - const theme = new ThemeNode(); - theme.append(div); - return [theme]; - } return [div]; }, }, @@ -23731,8 +23742,7 @@ odoo.define('web_editor.jabberwock', (function(require) { this.configure(DevicePreview, { getTheme(editor) { const layout = editor.plugins.get(Layout); - const domLayout = layout.engines.dom; - return domLayout.components.main[0]; + return layout.engines.dom.root.firstDescendant(ThemeNode); }, }); }