Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.2] [GSoC 21] Keyboard-Shortcut Plugin #38092

Merged
merged 208 commits into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from 202 commits
Commits
Show all changes
208 commits
Select commit Hold shift + click to select a range
b44ece4
Fix form label relation removed title from non active elements
Krshivam25 Jun 8, 2021
8d82ea4
Keboard Shortcuts Plugin Setup
Krshivam25 Jun 14, 2021
1bb1802
Language description
Krshivam25 Jun 15, 2021
d98a6e6
Added Shortcut keys for buttons
Krshivam25 Jun 15, 2021
ecf9491
Added more Keyboard shortcuts
Krshivam25 Jun 16, 2021
a77362b
Optimized code with function
Krshivam25 Jun 17, 2021
c0db25f
Removed Options Shortcuts and Improved Comment
Krshivam25 Jun 17, 2021
847a265
Improved code by adding Joomla.shortcut
Krshivam25 Jun 19, 2021
cd2953e
Updated actionbutton.split
Krshivam25 Jun 19, 2021
0ce4961
Update plugins/system/shortcut/shortcut.php
Krshivam25 Jun 19, 2021
a293b3e
Deleted Index.html
Krshivam25 Jun 20, 2021
1bd0433
Update Shortcut.js
Krshivam25 Jun 20, 2021
fb6c0d9
Delete index.html
Krshivam25 Jun 20, 2021
88d6fd4
Updated file name
Krshivam25 Jun 20, 2021
f072443
Rename shortcut.js to shortcut.es6.js
Krshivam25 Jun 20, 2021
000ee23
Update en-GB.plg_system_shortcut.ini
Krshivam25 Jun 20, 2021
03797b0
Update en-GB.plg_system_shortcut.ini
Krshivam25 Jun 20, 2021
3c51c9d
Update Copyright
HLeithner Jun 20, 2021
30071b0
Update en-GB.plg_system_shortcut.ini
Krshivam25 Jun 20, 2021
95c7fc4
Drone
HLeithner Jun 20, 2021
9b8981f
Update drone key for gsoc21_accessibility
HLeithner Jun 20, 2021
2965133
Update shortcut.es6.js
Krshivam25 Jun 20, 2021
f96bc36
Update Shortcut.php
Krshivam25 Jun 20, 2021
edf6b11
Update shortcut.xml
Krshivam25 Jun 20, 2021
5210736
Update shortcut.php
Krshivam25 Jun 20, 2021
65f0fe7
Added type module
Krshivam25 Jun 21, 2021
386af1c
Fix conflict
Krshivam25 Jun 21, 2021
f0d7e1c
Merge branch '4.1-dev' of https://github.com/joomla-projects/gsoc21_a…
Krshivam25 Jun 21, 2021
f24b581
Fix phpcs error in shortcut.php file
Krshivam25 Jun 22, 2021
b223844
Updated phpcs fixes in shortcut.php
Krshivam25 Jun 22, 2021
96b47e0
updated comments and added @var in shortcut.php
Krshivam25 Jun 22, 2021
8348889
Updated Javascript-cs Fixes in shortcut.es6.js file
Krshivam25 Jun 22, 2021
b699d04
Revert changes in package-lock.json and package.json
Krshivam25 Jun 22, 2021
2c986c0
Merge branch '4.1-dev' of github.com:joomla/joomla-cms into 4.1-dev-a…
bembelimen Jun 22, 2021
692b302
Added $document->addScriptOptions()
Krshivam25 Jun 24, 2021
4b1987c
Fix extra space in shortcut.php
Krshivam25 Jun 24, 2021
e34f5b8
Updated Shortcut.es6.js
Krshivam25 Jun 25, 2021
d764d68
Updated shortcut.php
Krshivam25 Jun 25, 2021
bfe158d
Updated keyboard shortcuts plugin
Krshivam25 Jun 25, 2021
6cb6ef1
Removed Extra Space
Krshivam25 Jun 27, 2021
b98e002
Updated shortcut Functionality with radio buttons
Krshivam25 Jun 28, 2021
e7a5d8a
Merge pull request #9 from joomla-projects/4.1-dev
bembelimen Jul 1, 2021
470dfeb
Merge pull request #10 from joomla-projects/dev
bembelimen Jul 1, 2021
b990af8
Updated Keyboard Shortcuts with keyselect field
Krshivam25 Jul 3, 2021
1417be4
Added: Key combination features in modal
Krshivam25 Jul 4, 2021
9ac232d
Added: Restore Default and Updated Modal Pop-up
Krshivam25 Jul 5, 2021
5f2b7e3
Updated: shortcut.xml according coding standard.
Krshivam25 Jul 6, 2021
0f97b78
Removed: Jimport
Krshivam25 Jul 6, 2021
d3acba5
Removed: Jimport
Krshivam25 Jul 6, 2021
b1b7c82
Removed: Jimport
Krshivam25 Jul 7, 2021
1bbca23
Removed: Input Field and MySql Updated
Krshivam25 Jul 7, 2021
309c093
Fix: Undefined method and Updated: base.sql files
Krshivam25 Jul 9, 2021
aa7948d
Update: Fix codestyle in PHP and drone error fix
Krshivam25 Jul 9, 2021
3271ea9
Removed: Extra Column in Base.sql
Krshivam25 Jul 10, 2021
5d6e72d
Removed: Extra Column in Postgresql
Krshivam25 Jul 10, 2021
2e60e4f
Updated: keyselect.es6.js with array []
Krshivam25 Jul 10, 2021
7d3c64f
Updated: Fix Code Style in shortcut.xml
Krshivam25 Jul 10, 2021
b91e29f
Updated: Keyselect.php
Krshivam25 Jul 10, 2021
dd3aa28
Update: Restore Defaults button removed namespace
Krshivam25 Jul 10, 2021
04b38ef
Update shortcut.php
Krshivam25 Jul 10, 2021
52fa2f7
Updated: keyselect.es6.js modal is vertically centered
Krshivam25 Jul 19, 2021
e064b3b
Merge branch '4.1-dev' of github.com:joomla/joomla-cms into 4.1-dev
bembelimen Jul 19, 2021
474905f
Merge branch 'dev' into gsoc
Krshivam25 Jul 20, 2021
fca4f51
Merge branch '4.1-dev' of github.com:joomla/joomla-cms into 4.1-dev
bembelimen Jul 22, 2021
b622a9d
Fixes: Keyselect and Restoredefault
Krshivam25 Jul 23, 2021
8e1ee53
Added Object.entries in Restoredefaults.js
Krshivam25 Jul 25, 2021
fda263b
Button colour is changed for Restore
Krshivam25 Jul 25, 2021
3299ebb
Updated: restoredefault.js
Krshivam25 Jul 25, 2021
f8c426a
Fix: Keyselect for meta keys
Krshivam25 Jul 25, 2021
6c46439
Update: Cancel Button text color changed
Krshivam25 Jul 29, 2021
472199b
Removed prevent default from modal
Krshivam25 Aug 2, 2021
acf57e5
Removed Empty _DESC
Krshivam25 Aug 2, 2021
d070170
Updated: Restore default added querySelector
Krshivam25 Aug 3, 2021
5a237ea
Removed Label in text string
Krshivam25 Aug 4, 2021
d657db8
Updated: XML version DEPLOY_VERSION
Krshivam25 Aug 4, 2021
6530c88
Updated: MAC Options in restoredefaults
Krshivam25 Aug 5, 2021
5b37825
Merge pull request #14 from joomla-projects/4.1-dev
bembelimen Aug 10, 2021
f13592e
Merge branch '4.1-dev' into gsoc
Krshivam25 Aug 11, 2021
132bc9d
Removed: Whitespace in keyselect
Krshivam25 Aug 11, 2021
a9fa0d8
Removed: PhpCS in restoredefault
Krshivam25 Aug 11, 2021
ec5e675
PHPCS fix in shortcut
Krshivam25 Aug 11, 2021
9e7679c
PHPCS code fix
Krshivam25 Aug 12, 2021
e6c21d5
phpcs fix
Krshivam25 Aug 12, 2021
e5773d4
PHPCS fix
Krshivam25 Aug 12, 2021
63fa7f9
PHPCS fix
Krshivam25 Aug 12, 2021
35e5df7
PHPCS fix
Krshivam25 Aug 12, 2021
20c4609
phpcs fix
Krshivam25 Aug 12, 2021
04f1fb8
PHPCS fix
Krshivam25 Aug 12, 2021
4fec5e1
PHPCS shortcut
Krshivam25 Aug 13, 2021
9f4618b
Merge branch 'gsoc' of https://github.com/Krshivam25/gsoc21_accessibi…
Krshivam25 Aug 13, 2021
52f8b40
ESlint fix in JS file
Krshivam25 Aug 15, 2021
34d0cf2
Removed for of loops in keyselect
Krshivam25 Aug 16, 2021
8b51d96
eslint keyselect
Krshivam25 Aug 16, 2021
1c78a6c
Eslint fix issues in Shortcut.js
Krshivam25 Aug 18, 2021
b87c5c0
Merge if statement in shortcut.js
Krshivam25 Aug 18, 2021
19b521a
Component Shortcuts
Krshivam25 Sep 1, 2021
52cf4b0
Component shortcut
Krshivam25 Sep 1, 2021
1060ee2
Component Shortcut
Krshivam25 Sep 2, 2021
cbb976e
Updated: XML for components
Krshivam25 Sep 5, 2021
78e527b
Updated: shortcut php
Krshivam25 Sep 5, 2021
b6697a2
Updated: keyselect.php & restoredefaults.php
Krshivam25 Sep 5, 2021
19c21fc
Updated: javascript files for restore default
Krshivam25 Sep 5, 2021
da5dccb
Removed extra space
Krshivam25 Sep 22, 2021
9409a82
Removed Login file
Krshivam25 Sep 22, 2021
a884350
Removed login file
Krshivam25 Sep 22, 2021
9b549a1
Revert login tmpl
bembelimen Sep 22, 2021
f26cbd6
Removed the Component Shortcuts and Reset is Fix
Krshivam25 Nov 12, 2021
4324f87
Added package Mousetrap
Krshivam25 Nov 14, 2021
acffa6d
changes revert
Krshivam25 Nov 14, 2021
88fdbb3
Revert changes
Krshivam25 Nov 14, 2021
5670196
Added packages in settings.json
Krshivam25 Nov 15, 2021
0ec44db
Added mousetrap in settings.json
Krshivam25 Nov 16, 2021
2bdaab6
importing mousetrap library
Krshivam25 Nov 19, 2021
ed7f431
Mousetrap library added
Krshivam25 Dec 4, 2021
a1e1e16
Updated PHP files for shortcut
Krshivam25 Dec 4, 2021
dbc106c
Shortcut list appears in alert
Krshivam25 Dec 4, 2021
3d8b905
Updated shortcut in Modal Window with esc key
Krshivam25 Dec 11, 2021
9011e23
Merge pull request #7 from Krshivam25/keyboard-shortcut
bembelimen May 8, 2022
594d288
Merge pull request #8 from Krshivam25/gsoc
bembelimen May 8, 2022
18abf8a
Merge branch 'gsoc' into keyboard-shortcut
bembelimen May 8, 2022
f6e2ca0
Merge pull request #17 from joomla-projects/keyboard-shortcut
bembelimen May 8, 2022
a8977e5
Merge branch '4.2-dev' of github.com:joomla/joomla-cms into gsoc
bembelimen May 8, 2022
395b15e
Merge branch 'gsoc' of github.com:joomla-projects/gsoc21_accessibilit…
bembelimen May 8, 2022
81870e9
First step of moving to hotkeys
bembelimen May 9, 2022
c479805
Merge branch '4.2-dev' of github.com:joomla/joomla-cms into shortcut
bembelimen May 17, 2022
6f957e2
Rename language files
bembelimen May 18, 2022
9ddb327
Merge remote-tracking branch 'Joomla/4.2-dev' into gsoc
bembelimen May 21, 2022
74cf78d
Merge branch '4.2-dev' of github.com:joomla/joomla-cms into shortcut
bembelimen May 25, 2022
3909e21
Merge branch 'gsoc' of github.com:joomla-projects/gsoc21_accessibilit…
bembelimen May 25, 2022
7afd288
Fix keyselect field
bembelimen May 25, 2022
6674e07
Add shortcut function
bembelimen May 26, 2022
f9bf842
Remove eval and add key selector only
bembelimen May 26, 2022
3f530d8
Fix PR comments
fancyFranci Jun 4, 2022
d174a11
Remove unnecessary classes
fancyFranci Jun 4, 2022
9b6e728
Fix text files
fancyFranci Jun 4, 2022
089301c
Set h3 instead of h5 in modal
fancyFranci Jun 4, 2022
4b8be66
Remove readonly attribute from new-key-input
fancyFranci Jun 4, 2022
cc9ca65
Remove readonly and change current-key to text
fancyFranci Jun 4, 2022
1d88bb4
Remove unused stuff
fancyFranci Jun 4, 2022
388d974
Add search
fancyFranci Jun 4, 2022
59a8fa7
Move search button
bembelimen Jun 4, 2022
9180e66
Fix styleguide
bembelimen Jun 4, 2022
d026f0c
Format doc and remove double class
fancyFranci Jun 5, 2022
3ba8c1c
Add info text to key select modal
bembelimen Jun 5, 2022
c67a992
Add default options to shortcut keys
bembelimen Jun 5, 2022
e32e449
Refactor keyselect js and include mac
fancyFranci Jun 6, 2022
0768e59
Merge branch 'gsoc' of github.com:joomla-projects/gsoc21_accessibilit…
fancyFranci Jun 6, 2022
798bd8e
Use "confirm" instead of "save"
fancyFranci Jun 6, 2022
2f63245
Set modifier "j"
fancyFranci Jun 11, 2022
e2193d3
Remove shortcut editing
fancyFranci Jun 11, 2022
466c17c
Mark global hotkeys
fancyFranci Jun 11, 2022
8b2629d
Add overview modal
fancyFranci Jun 12, 2022
72ab7ea
Remove not working editor actions
fancyFranci Jun 12, 2022
f7fbdc8
Set keyboard icon and dl instead of ul
fancyFranci Jun 16, 2022
7a51413
Set correct version
fancyFranci Jun 18, 2022
d518e90
Remove not working editor shortcuts
fancyFranci Jun 18, 2022
d1658eb
Improve overview list
fancyFranci Jun 18, 2022
ac07f6d
Generate overview with options
fancyFranci Jun 18, 2022
dedbdb6
Set plugin description in sys.ini too
fancyFranci Jun 18, 2022
b0d6420
Fix shortcut filter by allowing checkboxes
fancyFranci Jun 18, 2022
b42a191
Add update sql files
fancyFranci Jun 19, 2022
a7df0c0
Remove obsolete script texts
fancyFranci Jun 19, 2022
7e9afec
Use Y-m-d format for creation date
fancyFranci Jun 19, 2022
31f6270
Format event params
fancyFranci Jun 19, 2022
8b7e617
Remove 'see LICENSE.php'
fancyFranci Jun 19, 2022
ebee01a
Fix xml spacing
fancyFranci Jun 19, 2022
da3f9c4
Close p-tag in description
fancyFranci Jun 19, 2022
acb0a0a
Close p-tag in description nr 2
fancyFranci Jun 19, 2022
b9f66c7
Remove 'see LICENSE.php'
fancyFranci Jun 19, 2022
f0bd452
Check option values in js
fancyFranci Jun 19, 2022
0942d58
Update update.sql
fancyFranci Jun 19, 2022
94f437a
Merge branch 'gsoc' of github.com:fancyFranci/joomla-cms into gsoc
fancyFranci Jun 19, 2022
0d5d13e
Merge branch '4.2-dev' into gsoc
fancyFranci Jun 19, 2022
a1f99d9
Update update.sql but better
fancyFranci Jun 19, 2022
36393c9
Add plugin to ExtensionHelpers coreExtensions
fancyFranci Jun 20, 2022
afd5f68
Merge branch '4.2-dev' of https://github.com/joomla/joomla-cms into gsoc
fancyFranci Jun 20, 2022
447d52f
change plugin to service provider (#5)
heelc29 Jun 20, 2022
bcd90dd
Set J+F for search and add menu-collapse
fancyFranci Jun 20, 2022
ea594ee
Fix order in base.sql and set locked = 1
fancyFranci Jun 20, 2022
e955bfd
Remove importPlugin
fancyFranci Jun 20, 2022
7e0e0e3
Remove Save&New shortcut
fancyFranci Jun 20, 2022
ea4ee0a
Merge branch '4.2-dev' into gsoc
fancyFranci Jun 20, 2022
8c0c5cd
Fix base.sql for postgresql
fancyFranci Jun 20, 2022
2d427d1
Merge branch 'gsoc' of github.com:fancyFranci/joomla-cms into gsoc
fancyFranci Jun 20, 2022
37f63c6
Add the "J" modifier (#6)
bembelimen Jun 20, 2022
7a10b79
Set default timeout to 2 seconds
fancyFranci Jun 20, 2022
eb7163a
Fix shortcuts
fancyFranci Jun 20, 2022
d369911
Change texts
fancyFranci Jun 20, 2022
50945b3
Merge branch '4.2-dev' into gsoc
fancyFranci Jun 20, 2022
c4d7605
Update administrator/language/en-GB/plg_system_shortcut.ini
fancyFranci Jun 21, 2022
fd3fea2
Update administrator/language/en-GB/plg_system_shortcut.ini
fancyFranci Jun 21, 2022
9d1ba03
Update administrator/language/en-GB/plg_system_shortcut.ini
fancyFranci Jun 21, 2022
ec13ea2
Update administrator/language/en-GB/plg_system_shortcut.sys.ini
fancyFranci Jun 21, 2022
b980c61
Update plugins/system/shortcut/src/Extension/Shortcut.php
fancyFranci Jun 21, 2022
ffc7946
Add link to dashboard
fancyFranci Jun 21, 2022
e8aa67b
Switch dt and dd
fancyFranci Jun 21, 2022
ab018aa
Set language string for "Close"
fancyFranci Jun 21, 2022
2ecb161
Update plugins/system/shortcut/src/Extension/Shortcut.php
fancyFranci Jun 21, 2022
71dd311
Align order of shortkeys and set <kbd>
fancyFranci Jun 21, 2022
a161754
Merge branch 'gsoc' of github.com:fancyFranci/joomla-cms into gsoc
fancyFranci Jun 21, 2022
fc0559c
Remove dots from description list
fancyFranci Jun 21, 2022
b886e42
Less prominent shortcut overview hint
fancyFranci Jun 21, 2022
acb2d83
Update administrator/language/en-GB/plg_system_shortcut.ini
fancyFranci Jun 21, 2022
d13e866
fix description
fancyFranci Jun 21, 2022
3d520f9
Update administrator/language/en-GB/plg_system_shortcut.ini
fancyFranci Jun 21, 2022
07adf8d
Update administrator/language/en-GB/plg_system_shortcut.ini
fancyFranci Jun 21, 2022
ba38767
Show hint only below cpanels
fancyFranci Jun 21, 2022
2d6063c
Remove not needed pluginHelper
fancyFranci Jun 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- See https://github.com/joomla/joomla-cms/pull/38092
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`) VALUES
(0, 'plg_system_shortcut', 'plugin', 'shortcut', 'system', 0, 1, 1, 0, 1, '', '', '', 0, 0);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- See https://github.com/joomla/joomla-cms/pull/38092
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state") VALUES
(0, 'plg_system_shortcut', 'plugin', 'shortcut', 'system', 0, 1, 1, 0, 1, '', '', '', 0, 0);
12 changes: 12 additions & 0 deletions administrator/language/en-GB/plg_system_shortcut.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
; Joomla! Project
; (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8

PLG_SYSTEM_SHORTCUT="System - Keyboard Shortcuts"
PLG_SYSTEM_SHORTCUT_OVERVIEW_DESC="Press <kbd>J</kbd> to access the shortkey mode followed by the shortkey."
fancyFranci marked this conversation as resolved.
Show resolved Hide resolved
PLG_SYSTEM_SHORTCUT_OVERVIEW_HINT="<span class='icon-keyboard fa-keyboard me-2' aria-hidden='true'></span> <kbd>J</kbd> + <kbd>X</kbd> <small>Keyboard Shortcuts</small>"
fancyFranci marked this conversation as resolved.
Show resolved Hide resolved
PLG_SYSTEM_SHORTCUT_OVERVIEW_TITLE="Joomla Keyboard Shortcuts"
PLG_SYSTEM_SHORTCUT_TIMEOUT_DESC="The time in milliseconds how long a shortcut can be pressed after \"J\" has been pressed."
PLG_SYSTEM_SHORTCUT_TIMEOUT_LABEL="Timeout"
fancyFranci marked this conversation as resolved.
Show resolved Hide resolved
PLG_SYSTEM_SHORTCUT_XML_DESCRIPTION="<p>Enables keyboard shortcuts on the administrator site, which can be provided by other plugins and includes directly the following list of shortcuts:</p><ul class='list-unstyled'><li><kbd>J</kbd> <kbd>A</kbd> Save</li><li><kbd>J</kbd> <kbd>S</kbd> Save & Close</li><li><kbd>J</kbd> <kbd>Q</kbd> Cancel</li><li><kbd>J</kbd> <kbd>N</kbd> New</li><li><kbd>J</kbd> <kbd>F</kbd> Search</li><li><kbd>J</kbd> <kbd>O</kbd> Options</li><li><kbd>J</kbd> <kbd>H</kbd> Help</li><li><kbd>J</kbd> <kbd>X</kbd> Overview</li><li><kbd>J</kbd> <kbd>D</kbd> Home Dashboard</li></ul>"
7 changes: 7 additions & 0 deletions administrator/language/en-GB/plg_system_shortcut.sys.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
; Joomla! Project
; (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8

PLG_SYSTEM_SHORTCUT="System - Keyboard Shortcuts"
PLG_SYSTEM_SHORTCUT_XML_DESCRIPTION="<p>Enables keyboard shortcuts on the administrator site, which can be provided by other plugins and includes directly the following list of shortcuts:</p><ul class='list-unstyled'><li><kbd>J</kbd> <kbd>A</kbd> Save</li><li><kbd>J</kbd> <kbd>S</kbd> Save & Close</li><li><kbd>J</kbd> <kbd>Q</kbd> Cancel</li><li><kbd>J</kbd> <kbd>N</kbd> New</li><li><kbd>J</kbd> <kbd>F</kbd> Search</li><li><kbd>J</kbd> <kbd>O</kbd> Options</li><li><kbd>J</kbd> <kbd>H</kbd> Help</li><li><kbd>J</kbd> <kbd>X</kbd> Overview</li><li><kbd>J</kbd> <kbd>D</kbd> Home Dashboard</li></ul>"
18 changes: 18 additions & 0 deletions build/build-modules-js/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,24 @@
"dependencies": [],
"licenseFilename": "LICENSE.txt"
},
"hotkeys-js": {
"name": "hotkeys.js",
"licenseFilename": "LICENSE",
"js" : {
"dist/hotkeys.js": "js/hotkeys.js",
"dist/hotkeys.min.js": "js/hotkeys.min.js"
},
"provideAssets": [
{
"name": "hotkeys.js",
"type": "script",
"uri": "hotkeys.min.js",
"attributes": {
"defer": true
}
}
]
},
"jquery": {
"name": "jquery",
"js": {
Expand Down
165 changes: 165 additions & 0 deletions build/media_source/plg_system_shortcut/js/shortcut.es6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
((document, Joomla) => {
'use strict';

if (!Joomla) {
throw new Error('Joomla API is not properly initialised');
}

/* global hotkeys */
Joomla.addShortcut = (hotkey, callback) => {
hotkeys(hotkey, 'joomla', (event) => {
event.preventDefault();
event.stopPropagation();
event.stopImmediatePropagation();

callback.call();
});
};

Joomla.addClickShortcut = (hotkey, selector) => {
Joomla.addShortcut(hotkey, () => {
const element = document.querySelector(selector);
if (element) {
element.click();
}
});
};

Joomla.addFocusShortcut = (hotkey, selector) => {
Joomla.addShortcut(hotkey, () => {
const element = document.querySelector(selector);
if (element) {
element.focus();
}
});
};

Joomla.addLinkShortcut = (hotkey, selector) => {
Joomla.addShortcut(hotkey, () => {
window.location.href = selector;
});
};

const setShortcutFilter = () => {
hotkeys.filter = (event) => {
const target = event.target || event.srcElement;
const { tagName } = target;

// Checkboxes should not block a shortcut event
if (target.type === 'checkbox') {
return true;
}
// Default hotkeys filter behavior
return !(target.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA');
};
};

const startupShortcuts = () => {
hotkeys('J', (event) => {
// If we're already in the scope, it's a normal shortkey
if (hotkeys.getScope() === 'joomla') {
return;
}

event.preventDefault();
event.stopPropagation();
event.stopImmediatePropagation();

hotkeys.setScope('joomla');

// Leave the scope after x milliseconds
setTimeout(() => {
hotkeys.setScope(false);
}, Joomla.getOptions('plg_system_shortcut.timeout', 2000));
});
};

const addOverviewHint = () => {
const containerElement = document.createElement('section');
containerElement.className = 'content pt-4';
containerElement.insertAdjacentHTML('beforeend', Joomla.Text._('PLG_SYSTEM_SHORTCUT_OVERVIEW_HINT'));
document.querySelector('.container-main').appendChild(containerElement);
};

const initOverviewModal = (options) => {
const dlItems = new Map();
Object.values(options).forEach((value) => {
if (!value.shortcut || !value.title) {
return;
}
let titles = [];
if (dlItems.has(value.shortcut)) {
titles = dlItems.get(value.shortcut);
titles.push(value.title);
} else {
titles = [value.title];
}
dlItems.set(value.shortcut, titles);
});

let dl = '<dl>';
dlItems.forEach((titles, shortcut) => {
dl += '<dt><kbd>J</kbd>';
shortcut.split('+').forEach((key) => {
dl += ` <kbd>${key.trim()}</kbd>`;
});
dl += '</dt>';
titles.forEach((title) => {
dl += `<dd>${title}</dd>`;
});
});
dl += '</dl>';

const modal = `
<div class="modal fade" id="shortcutOverviewModal" tabindex="-1" role="dialog" data-bs-backdrop="static" aria-labelledby="shortcutOverviewModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 id="shortcutOverviewModalLabel" class="modal-title">
${Joomla.Text._('PLG_SYSTEM_SHORTCUT_OVERVIEW_TITLE')}
</h3>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="${Joomla.Text._('JCLOSE')}"></button>
</div>
<div class="modal-body p-3">
<p>${Joomla.Text._('PLG_SYSTEM_SHORTCUT_OVERVIEW_DESC')}</p>
<div class="mb-3">
${dl}
</div>
</div>
</div>
</div>
</div>
`;

document.body.insertAdjacentHTML('beforeend', modal);

const bootstrapModal = new bootstrap.Modal(document.getElementById('shortcutOverviewModal'), {
keyboard: true,
backdrop: true,
});
hotkeys('X', 'joomla', () => bootstrapModal.show());
};

document.addEventListener('DOMContentLoaded', () => {
const options = Joomla.getOptions('plg_system_shortcut.shortcuts');
Object.values(options).forEach((value) => {
if (!value.shortcut || !value.selector) {
return;
}
if (value.selector.startsWith('/') || value.selector.startsWith('http://') || value.selector.startsWith('www.')) {
Joomla.addLinkShortcut(value.shortcut, value.selector);
} else if (value.selector.includes('input')) {
Joomla.addFocusShortcut(value.shortcut, value.selector);
} else {
Joomla.addClickShortcut(value.shortcut, value.selector);
}
});
// Show hint and overview on logged in backend only (not login page)
if (document.querySelector('nav')) {
initOverviewModal(options);
addOverviewHint();
}
setShortcutFilter();
startupShortcuts();
});
})(document, Joomla);
1 change: 1 addition & 0 deletions installation/sql/mysql/base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`,
(0, 'plg_system_schedulerunner', 'plugin', 'schedulerunner', 'system', 0, 1, 1, 0, 0, '', '{}', '', 17, 0),
(0, 'plg_system_sef', 'plugin', 'sef', 'system', 0, 1, 1, 0, 1, '', '', '', 18, 0),
(0, 'plg_system_sessiongc', 'plugin', 'sessiongc', 'system', 0, 1, 1, 0, 1, '', '', '', 19, 0),
(0, 'plg_system_shortcut', 'plugin', 'shortcut', 'system', 0, 1, 1, 0, 1, '', '{}', '', 0, 0),
(0, 'plg_system_skipto', 'plugin', 'skipto', 'system', 0, 1, 1, 0, 1, '', '{}', '', 20, 0),
(0, 'plg_system_stats', 'plugin', 'stats', 'system', 0, 1, 1, 0, 1, '', '', '', 21, 0),
(0, 'plg_system_tasknotification', 'plugin', 'tasknotification', 'system', 0, 1, 1, 0, 1, '', '', '', 22, 0),
Expand Down
1 change: 1 addition & 0 deletions installation/sql/postgresql/base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder",
(0, 'plg_system_schedulerunner', 'plugin', 'schedulerunner', 'system', 0, 1, 1, 0, 0, '', '{}', '', 17, 0),
(0, 'plg_system_sef', 'plugin', 'sef', 'system', 0, 1, 1, 0, 1, '', '', '', 18, 0),
(0, 'plg_system_sessiongc', 'plugin', 'sessiongc', 'system', 0, 1, 1, 0, 1, '', '', '', 19, 0),
(0, 'plg_system_shortcut', 'plugin', 'shortcut', 'system', 0, 1, 1, 0, 1, '', '{}', '', 0, 0),
(0, 'plg_system_skipto', 'plugin', 'skipto', 'system', 0, 1, 1, 0, 1, '', '{}', '', 20, 0),
(0, 'plg_system_stats', 'plugin', 'stats', 'system', 0, 1, 1, 0, 1, '', '', '', 21, 0),
(0, 'plg_system_tasknotification', 'plugin', 'tasknotification', 'system', 0, 1, 1, 0, 1, '', '', '', 22, 0),
Expand Down
1 change: 1 addition & 0 deletions libraries/src/Extension/ExtensionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ class ExtensionHelper
array('plugin', 'schedulerunner', 'system', 0),
array('plugin', 'sef', 'system', 0),
array('plugin', 'sessiongc', 'system', 0),
array('plugin', 'shortcut', 'system', 0),
array('plugin', 'skipto', 'system', 0),
array('plugin', 'stats', 'system', 0),
array('plugin', 'tasknotification', 'system', 0),
Expand Down
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"diff": "^5.0.0",
"dragula": "^3.7.3",
"focus-visible": "^5.2.0",
"hotkeys-js": "^3.9.3",
"joomla-ui-custom-elements": "^0.2.0",
"jquery": "^3.6.0",
"jquery-migrate": "^3.3.2",
Expand Down
48 changes: 48 additions & 0 deletions plugins/system/shortcut/services/provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage System.shortcut
*
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

use Joomla\CMS\Extension\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\System\Shortcut\Extension\Shortcut;

return new class implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function register(Container $container)
{
$container->set(
PluginInterface::class,
function (Container $container)
{
$dispatcher = $container->get(DispatcherInterface::class);
$plugin = new Shortcut(
$dispatcher,
(array) PluginHelper::getPlugin('system', 'shortcut')
);
$plugin->setApplication(Factory::getApplication());

return $plugin;
}
);
}
};
40 changes: 40 additions & 0 deletions plugins/system/shortcut/shortcut.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" group="system" method="upgrade">
<name>plg_system_shortcut</name>
<author>Joomla! Project</author>
<creationDate>2022-06</creationDate>
<copyright>(C) 2022 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>__DEPLOY_VERSION__</version>
<description>PLG_SYSTEM_SHORTCUT_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\System\Shortcut</namespace>
<media destination="plg_system_shortcut" folder="media">
<folder>js</folder>
</media>
<files>
<folder plugin="shortcut">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_system_shortcut.ini</language>
<language tag="en-GB">language/en-GB/plg_system_shortcut.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="timeout"
type="number"
label="PLG_SYSTEM_SHORTCUT_TIMEOUT_LABEL"
description="PLG_SYSTEM_SHORTCUT_TIMEOUT_DESC"
required="true"
start="1"
step="1"
default="2000"
/>
</fieldset>
</fields>
</config>
</extension>
Loading