N°3524 Add keyboard shortcuts to global actions

This commit is contained in:
Stephen Abello
2021-03-17 10:56:18 +01:00
parent 8dd8f98b61
commit a8ede8b857
26 changed files with 345 additions and 33 deletions

View File

@@ -81,7 +81,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
$this->SetTopBarLayout(TopBarFactory::MakeStandard($this->GetBreadCrumbsNewEntry()));
utils::InitArchiveMode();
$this->m_aMessages = array();
$this->SetRootUrl(utils::GetAbsoluteUrlAppRoot());
$this->add_header("Content-type: text/html; charset=".self::PAGES_CHARSET);
@@ -134,6 +134,9 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery.magnific-popup.min.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/moment-with-locales.min.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/showdown.min.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/mousetrap/mousetrap.min.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/mousetrap/mousetrap-record.min.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/pages/backoffice/keyboard-shortcuts.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/pages/backoffice/toolbox.js');
}
@@ -176,6 +179,16 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
$this->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().'css/selectize.default.css');
}
/**
* @since 3.0.0
*/
protected function InitializeKeyboardShortcuts(): void
{
$aShortcuts = utils::GetKeyboardShortcutPref();
$sShortcuts = json_encode($aShortcuts);
$this->add_script("aKeyboardShortcuts = $sShortcuts;");
}
/**
*
*/
@@ -861,6 +874,8 @@ HTML;
// Components
// Note: For now all components are either included in the layouts above or put in page through the AddUiBlock() API, so there is no need to do anything more.
$this->InitializeKeyboardShortcuts();
// Variable content of the page
$aData['aPage'] = array_merge(
$aData['aPage'],