PluginProbe
TablePress – Tables in WordPress made easy / 3.4
TablePress – Tables in WordPress made easy v3.4
3.4 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 All 45 releases
← All changes | admin/js/common/keyboard-shortcut.js +6 -7 2.3 → 3.4 View file →
@@ -9,9 +9,9 @@
9 9
10 10 /**
11 11 * WordPress dependencies.
12 12 */
13 -import { __, _x, sprintf } from '@wordpress/i18n';
13 +import { _x, sprintf } from '@wordpress/i18n';
14 14
15 15 /**
16 16 * Registers a "Save Changes" keyboard shortcut for a button.
17 17 *
@@ -18,15 +18,14 @@
18 18 * @since 2.2.0
19 19 *
20 20 * @param {HTMLElement} $button DOM element for the button.
21 21 */
22 -export const register_save_changes_keyboard_shortcut = ( $button ) => {
22 +export const registerSaveChangesKeyboardShortcut = ( $button ) => {
23 23 // Add keyboard shortcut as title attribute to the "Save Changes" button, with correct modifier key for Mac/non-Mac.
24 - const modifier_key = ( window?.navigator?.platform?.includes( 'Mac' ) ) ?
24 + const modifierKey = ( window?.navigator?.platform?.includes( 'Mac' ) ) ?
25 25 _x( '⌘', 'keyboard shortcut modifier key on a Mac keyboard', 'tablepress' ) :
26 26 _x( 'Ctrl+', 'keyboard shortcut modifier key on a non-Mac keyboard', 'tablepress' );
27 - const shortcut = sprintf( $button.dataset.shortcut, modifier_key ); // eslint-disable-line @wordpress/valid-sprintf
28 - $button.title = sprintf( __( 'Keyboard Shortcut: %s', 'tablepress' ), shortcut );
27 + $button.title = sprintf( $button.dataset.shortcut, modifierKey ); // eslint-disable-line @wordpress/valid-sprintf
29 28
30 29 /**
31 30 * Registers keyboard events and triggers corresponding actions by emulating button clicks.
32 31 *
@@ -33,9 +32,9 @@
33 32 * @since 2.2.0
34 33 *
35 34 * @param {Event} event Keyboard event.
36 35 */
37 - const keyboard_shortcuts = ( event ) => {
36 + const keyboardShortcuts = ( event ) => {
38 37 let action = '';
39 38
40 39 if ( event.ctrlKey || event.metaKey ) {
41 40 if ( 83 === event.keyCode ) {
@@ -55,6 +54,6 @@
55 54 event.preventDefault();
56 55 }
57 56 };
58 57 // Register keyboard shortcut handler.
59 - window.addEventListener( 'keydown', keyboard_shortcuts, true );
58 + window.addEventListener( 'keydown', keyboardShortcuts, true );
60 59 };