From b0108e1876a27e83231e176cdca3e2d67d6a2a9c Mon Sep 17 00:00:00 2001 From: Younn Olivier Date: Wed, 27 Jul 2022 09:05:02 +0000 Subject: [PATCH] [FIX] website: fix editor keyboard shortcuts Before this commit, the editor shortcuts would not work. Example: "alt+1", or "alt+2" switch tab of the editor. This commit registers the editor as the active element, so that keyboard shortcuts registered on that element are given priority at the hotkey service level. The "escape" shortcut to go fullscreen is adapted with the global option to be independent from the active element. This commit also adds the "alt+p" keyboard shortcut on the publish systray item. Related to https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b task-2687506 Part-of: odoo/odoo#96401 --- addons/website/static/src/components/editor/editor.js | 3 +++ addons/website/static/src/components/editor/editor.xml | 4 +++- addons/website/static/src/services/website_service.js | 2 +- addons/website/static/src/systray_items/publish.js | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/addons/website/static/src/components/editor/editor.js b/addons/website/static/src/components/editor/editor.js index 641de495daa..d1f737f4bea 100644 --- a/addons/website/static/src/components/editor/editor.js +++ b/addons/website/static/src/components/editor/editor.js @@ -3,6 +3,7 @@ import legacyEnv from 'web.commonEnv'; import { useService } from '@web/core/utils/hooks'; import { WysiwygAdapterComponent } from '../wysiwyg_adapter/wysiwyg_adapter'; +import { useActiveElement } from '@web/core/ui/ui_service'; const { markup, Component, useState, useChildSubEnv, useEffect, onWillStart, onMounted } = owl; @@ -39,6 +40,8 @@ export class WebsiteEditorComponent extends Component { this.publicRootReady(); } }); + + useActiveElement('wysiwyg-adapter'); } /** * Starts the wysiwyg or disable edition if currently diff --git a/addons/website/static/src/components/editor/editor.xml b/addons/website/static/src/components/editor/editor.xml index e5fb7e43c2d..c5bc220baba 100644 --- a/addons/website/static/src/components/editor/editor.xml +++ b/addons/website/static/src/components/editor/editor.xml @@ -4,7 +4,9 @@
-
+
+