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) {