[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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
<div t-if="state.reloading" class="o_loading_dummy">
|
||||
<t t-out="this.loadingDummy"/>
|
||||
</div>
|
||||
<div t-if="state.showWysiwyg" t-att-class="{ o_w_wysiwyg_transition: !this.state.reloading, o_w_wysiwyg: this.websiteContext.snippetsLoaded }">
|
||||
<div t-if="state.showWysiwyg"
|
||||
t-ref="wysiwyg-adapter"
|
||||
t-att-class="{ o_w_wysiwyg_transition: !this.state.reloading, o_w_wysiwyg: this.websiteContext.snippetsLoaded }">
|
||||
<WysiwygAdapterComponent Component="this.Wysiwyg"
|
||||
snippetSelector="this.reloadSelector"
|
||||
willReload.bind="this.willReload"
|
||||
|
||||
@@ -61,7 +61,7 @@ export const websiteService = {
|
||||
document.body.classList.toggle('o_website_fullscreen', fullscreen);
|
||||
bus.trigger((fullscreen ? 'FULLSCREEN-INDICATION-SHOW' : 'FULLSCREEN-INDICATION-HIDE'));
|
||||
}
|
||||
});
|
||||
}, { global: true });
|
||||
registry.category('main_components').add('FullscreenIndication', {
|
||||
Component: FullscreenIndication,
|
||||
props: { bus },
|
||||
|
||||
@@ -34,7 +34,7 @@ class PublishSystray extends Component {
|
||||
}
|
||||
}
|
||||
PublishSystray.template = xml`
|
||||
<div t-on-click="publishContent" class="o_menu_systray_item d-md-flex ms-auto">
|
||||
<div t-on-click="publishContent" class="o_menu_systray_item d-md-flex ms-auto" data-hotkey="p">
|
||||
<a href="#">
|
||||
<Switch value="state.published" extraClasses="'mb-0 o_switch_danger_success'"/>
|
||||
<t t-esc="this.label"/>
|
||||
|
||||
Reference in New Issue
Block a user