diff --git a/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js b/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js index 53c3deebeb00e575eb8f7902abd2ffeca8aaead1..4be02fafd83d445ceda041075066f6e08af5983a 100644 --- a/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js +++ b/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js @@ -1311,6 +1311,7 @@ export class OdooEditor extends EventTarget { this._stopContenteditable(); this._fixLinkMutatedElements = { + link, wasContenteditableTrue: [...editableChildren], wasContenteditableFalse: [], wasContenteditableNull: [], @@ -1623,7 +1624,19 @@ export class OdooEditor extends EventTarget { } } if (editorCommands[method]) { - return editorCommands[method](this, ...args); + // Make sure to restore the content editable before applying an + // editor command, as it might have been temporarily disabled for + // browser behaviors which should not concern editor commands. + const link = this._fixLinkMutatedElements && this._fixLinkMutatedElements.link; + if (this._fixLinkMutatedElements) { + this.resetContenteditableLink(); + this._activateContenteditable(); + } + const returnValue = editorCommands[method](this, ...args); + if (link) { + this.setContenteditableLink(link); + } + return returnValue; } if (method.startsWith('justify')) { const mode = method.split('justify').join('').toLocaleLowerCase();