@wordpress/customize-widgets 4.33.0 → 4.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/header/index.js +2 -2
- package/build/components/header/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +0 -59
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/sidebar-block-editor/index.js +5 -1
- package/build/components/sidebar-block-editor/index.js.map +1 -1
- package/build-module/components/header/index.js +2 -2
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -60
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/sidebar-block-editor/index.js +5 -1
- package/build-module/components/sidebar-block-editor/index.js.map +1 -1
- package/package.json +23 -23
- package/src/components/header/index.js +2 -2
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -1
- package/src/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/src/components/keyboard-shortcuts/index.js +1 -72
- package/src/components/sidebar-block-editor/index.js +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
9
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
10
|
var _components = require("@wordpress/components");
|
|
11
11
|
var _blockEditor = require("@wordpress/block-editor");
|
|
12
12
|
var _element = require("@wordpress/element");
|
|
@@ -42,7 +42,7 @@ function Header({
|
|
|
42
42
|
});
|
|
43
43
|
}, [sidebar]);
|
|
44
44
|
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
|
|
45
|
-
className: (0,
|
|
45
|
+
className: (0, _clsx.default)('customize-widgets-header', {
|
|
46
46
|
'is-fixed-toolbar-active': isFixedToolbarActive
|
|
47
47
|
})
|
|
48
48
|
}, (0, _react.createElement)(_blockEditor.NavigableToolbar, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_blockEditor","_element","_keycodes","_i18n","_icons","_inserter","_moreMenu","Header","sidebar","inserter","isInserterOpened","setIsInserterOpened","isFixedToolbarActive","hasUndo","hasRedo","setUndoRedo","useState","shortcut","isAppleOS","displayShortcut","primaryShift","primary","useEffect","subscribeHistory","_react","createElement","Fragment","className","clsx","NavigableToolbar","__","ToolbarButton","icon","isRTL","undoIcon","redoIcon","label","onClick","undo","redo","isPressed","variant","plus","_x","isOpen","default","createPortal","setIsOpened","contentContainer","_default","exports"],"sources":["@wordpress/customize-widgets/src/components/header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { NavigableToolbar } from '@wordpress/block-editor';\nimport { createPortal, useEffect, useState } from '@wordpress/element';\nimport { displayShortcut, isAppleOS } from '@wordpress/keycodes';\nimport { __, _x, isRTL } from '@wordpress/i18n';\nimport { plus, undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport MoreMenu from '../more-menu';\n\nfunction Header( {\n\tsidebar,\n\tinserter,\n\tisInserterOpened,\n\tsetIsInserterOpened,\n\tisFixedToolbarActive,\n} ) {\n\tconst [ [ hasUndo, hasRedo ], setUndoRedo ] = useState( [\n\t\tsidebar.hasUndo(),\n\t\tsidebar.hasRedo(),\n\t] );\n\n\tconst shortcut = isAppleOS()\n\t\t? displayShortcut.primaryShift( 'z' )\n\t\t: displayShortcut.primary( 'y' );\n\n\tuseEffect( () => {\n\t\treturn sidebar.subscribeHistory( () => {\n\t\t\tsetUndoRedo( [ sidebar.hasUndo(), sidebar.hasRedo() ] );\n\t\t} );\n\t}, [ sidebar ] );\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName={ clsx( 'customize-widgets-header', {\n\t\t\t\t\t'is-fixed-toolbar-active': isFixedToolbarActive,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<NavigableToolbar\n\t\t\t\t\tclassName=\"customize-widgets-header-toolbar\"\n\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Undo' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\t\t\t\taria-disabled={ ! hasUndo }\n\t\t\t\t\t\tonClick={ sidebar.undo }\n\t\t\t\t\t\tclassName=\"customize-widgets-editor-history-button undo-button\"\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ ! isRTL() ? redoIcon : undoIcon }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Redo' ) }\n\t\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\t\t\t\taria-disabled={ ! hasRedo }\n\t\t\t\t\t\tonClick={ sidebar.redo }\n\t\t\t\t\t\tclassName=\"customize-widgets-editor-history-button redo-button\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tclassName=\"customize-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t'Add block',\n\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsInserterOpened( ( isOpen ) => ! isOpen );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</NavigableToolbar>\n\t\t\t</div>\n\n\t\t\t{ createPortal(\n\t\t\t\t<Inserter setIsOpened={ setIsInserterOpened } />,\n\t\t\t\tinserter.contentContainer[ 0 ]\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAKA,IAAAO,SAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,SAAA,GAAAT,sBAAA,CAAAC,OAAA;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAIA,SAASS,MAAMA,CAAE;EAChBC,OAAO;EACPC,QAA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
|
63
63
|
},
|
|
64
|
+
aliases: [{
|
|
65
|
+
modifier: 'access',
|
|
66
|
+
character: '7'
|
|
67
|
+
}],
|
|
64
68
|
description: (0, _i18n.__)('Convert the current heading to a paragraph.')
|
|
65
69
|
}, {
|
|
66
70
|
keyCombination: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","textFormattingShortcuts","exports","keyCombination","modifier","character","description","__"],"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/config.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const textFormattingShortcuts = [\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'b' },\n\t\tdescription: __( 'Make the selected text bold.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'i' },\n\t\tdescription: __( 'Make the selected text italic.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'k' },\n\t\tdescription: __( 'Convert the selected text into a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'k' },\n\t\tdescription: __( 'Remove a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { character: '[[' },\n\t\tdescription: __( 'Insert a link to a post or page.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'u' },\n\t\tdescription: __( 'Underline the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'd' },\n\t\tdescription: __( 'Strikethrough the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'x' },\n\t\tdescription: __( 'Make the selected text inline code.' ),\n\t},\n\t{\n\t\tkeyCombination: {
|
|
1
|
+
{"version":3,"names":["_i18n","require","textFormattingShortcuts","exports","keyCombination","modifier","character","description","__","aliases"],"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/config.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const textFormattingShortcuts = [\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'b' },\n\t\tdescription: __( 'Make the selected text bold.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'i' },\n\t\tdescription: __( 'Make the selected text italic.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'k' },\n\t\tdescription: __( 'Convert the selected text into a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'k' },\n\t\tdescription: __( 'Remove a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { character: '[[' },\n\t\tdescription: __( 'Insert a link to a post or page.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'u' },\n\t\tdescription: __( 'Underline the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'd' },\n\t\tdescription: __( 'Strikethrough the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'x' },\n\t\tdescription: __( 'Make the selected text inline code.' ),\n\t},\n\t{\n\t\tkeyCombination: {\n\t\t\tmodifier: 'access',\n\t\t\tcharacter: '0',\n\t\t},\n\t\taliases: [\n\t\t\t{\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: '7',\n\t\t\t},\n\t\t],\n\t\tdescription: __( 'Convert the current heading to a paragraph.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: '1-6' },\n\t\tdescription: __(\n\t\t\t'Convert the current paragraph or heading to a heading of level 1 to 6.'\n\t\t),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'SPACE' },\n\t\tdescription: __( 'Add non breaking space.' ),\n\t},\n];\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAMC,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,CACtC;EACCE,cAAc,EAAE;IAAEC,QAAQ,EAAE,SAAS;IAAEC,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,IAAAC,QAAE,EAAE,6CAA8C;AAChE,CAAC,EACD;EACCJ,cAAc,EAAE;IAAEC,QAAQ,EAAE,QAAQ;IAAEC,SAAS,EAAE;EAAM,CAAC;EACxDC,WAAW,EAAE,IAAAC,QAAE,EACd,wEACD;AACD,CAAC,EACD;EACCJ,cAAc,EAAE;IAAEC,QAAQ,EAAE,cAAc;IAAEC,SAAS,EAAE;EAAQ,CAAC;EAChEC,WAAW,EAAE,IAAAC,QAAE,EAAE,yBAA0B;AAC5C,CAAC,CACD","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = KeyboardShortcutHelpModal;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
9
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
10
|
var _components = require("@wordpress/components");
|
|
11
11
|
var _i18n = require("@wordpress/i18n");
|
|
12
12
|
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
@@ -51,7 +51,7 @@ const ShortcutSection = ({
|
|
|
51
51
|
shortcuts,
|
|
52
52
|
className
|
|
53
53
|
}) => (0, _react.createElement)("section", {
|
|
54
|
-
className: (0,
|
|
54
|
+
className: (0, _clsx.default)('customize-widgets-keyboard-shortcut-help-modal__section', className)
|
|
55
55
|
}, !!title && (0, _react.createElement)("h2", {
|
|
56
56
|
className: "customize-widgets-keyboard-shortcut-help-modal__section-title"
|
|
57
57
|
}, title), (0, _react.createElement)(ShortcutList, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_i18n","_keyboardShortcuts","_data","_config","_shortcut","_dynamicShortcut","ShortcutList","shortcuts","_react","createElement","className","role","map","shortcut","index","key","default","name","ShortcutSection","title","clsx","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","useSelect","select","keyboardShortcutsStore","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","registerShortcut","useDispatch","category","description","__","keyCombination","modifier","character","useShortcut","Modal","onRequestClose","ariaLabel","textFormattingShortcuts"],"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { textFormattingShortcuts } from './config';\nimport Shortcut from './shortcut';\nimport DynamicShortcut from './dynamic-shortcut';\n\nconst ShortcutList = ( { shortcuts } ) => (\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t<ul\n\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-list\"\n\t\trole=\"list\"\n\t>\n\t\t{ shortcuts.map( ( shortcut, index ) => (\n\t\t\t<li\n\t\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut\"\n\t\t\t\tkey={ index }\n\t\t\t>\n\t\t\t\t{ typeof shortcut === 'string' ? (\n\t\t\t\t\t<DynamicShortcut name={ shortcut } />\n\t\t\t\t) : (\n\t\t\t\t\t<Shortcut { ...shortcut } />\n\t\t\t\t) }\n\t\t\t</li>\n\t\t) ) }\n\t</ul>\n\t/* eslint-enable jsx-a11y/no-redundant-roles */\n);\n\nconst ShortcutSection = ( { title, shortcuts, className } ) => (\n\t<section\n\t\tclassName={ clsx(\n\t\t\t'customize-widgets-keyboard-shortcut-help-modal__section',\n\t\t\tclassName\n\t\t) }\n\t>\n\t\t{ !! title && (\n\t\t\t<h2 className=\"customize-widgets-keyboard-shortcut-help-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t) }\n\t\t<ShortcutList shortcuts={ shortcuts } />\n\t</section>\n);\n\nconst ShortcutCategorySection = ( {\n\ttitle,\n\tcategoryName,\n\tadditionalShortcuts = [],\n} ) => {\n\tconst categoryShortcuts = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( keyboardShortcutsStore ).getCategoryShortcuts(\n\t\t\t\tcategoryName\n\t\t\t);\n\t\t},\n\t\t[ categoryName ]\n\t);\n\n\treturn (\n\t\t<ShortcutSection\n\t\t\ttitle={ title }\n\t\t\tshortcuts={ categoryShortcuts.concat( additionalShortcuts ) }\n\t\t/>\n\t);\n};\n\nexport default function KeyboardShortcutHelpModal( {\n\tisModalActive,\n\ttoggleModal,\n} ) {\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tregisterShortcut( {\n\t\tname: 'core/customize-widgets/keyboard-shortcuts',\n\t\tcategory: 'main',\n\t\tdescription: __( 'Display these keyboard shortcuts.' ),\n\t\tkeyCombination: {\n\t\t\tmodifier: 'access',\n\t\t\tcharacter: 'h',\n\t\t},\n\t} );\n\n\tuseShortcut( 'core/customize-widgets/keyboard-shortcuts', toggleModal );\n\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal\"\n\t\t\ttitle={ __( 'Keyboard shortcuts' ) }\n\t\t\tonRequestClose={ toggleModal }\n\t\t>\n\t\t\t<ShortcutSection\n\t\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__main-shortcuts\"\n\t\t\t\tshortcuts={ [ 'core/customize-widgets/keyboard-shortcuts' ] }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Global shortcuts' ) }\n\t\t\t\tcategoryName=\"global\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Selection shortcuts' ) }\n\t\t\t\tcategoryName=\"selection\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Block shortcuts' ) }\n\t\t\t\tcategoryName=\"block\"\n\t\t\t\tadditionalShortcuts={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tkeyCombination: { character: '/' },\n\t\t\t\t\t\tdescription: __(\n\t\t\t\t\t\t\t'Change the block type after adding a new paragraph.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t/* translators: The forward-slash character. e.g. '/'. */\n\t\t\t\t\t\tariaLabel: __( 'Forward-slash' ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t<ShortcutSection\n\t\t\t\ttitle={ __( 'Text formatting' ) }\n\t\t\t\tshortcuts={ textFormattingShortcuts }\n\t\t\t/>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AAIA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,gBAAA,GAAAR,sBAAA,CAAAC,OAAA;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;;AAKA,MAAMQ,YAAY,GAAGA,CAAE;EAAEC;AAAU,CAAC;AACnC;AACD;AACA;AACA;AACC;AACA,IAAAC,MAAA,CAAAC,aAAA;EACCC,SAAS,EAAC,+DAA+D;EACzEC,IAAI,EAAC;AAAM,GAETJ,SAAS,CAACK,GAAG,CAAE,CAAEC,QAAQ,EAAEC,KAAK,KACjC,IAAAN,MAAA,CAAAC,aAAA;EACCC,SAAS,EAAC,0DAA0D;EACpEK,GAAG,EAAGD;AAAO,GAEX,OAAOD,QAAQ,KAAK,QAAQ,GAC7B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B,CAAG;IACjC9B,SAAS,EAAGsC;EAAyB,CACrC,CACK,CAAC;AAEV","ignoreList":[]}
|
|
@@ -9,8 +9,6 @@ var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
|
9
9
|
var _keycodes = require("@wordpress/keycodes");
|
|
10
10
|
var _data = require("@wordpress/data");
|
|
11
11
|
var _i18n = require("@wordpress/i18n");
|
|
12
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
13
|
-
var _blocks = require("@wordpress/blocks");
|
|
14
12
|
/**
|
|
15
13
|
* WordPress dependencies
|
|
16
14
|
*/
|
|
@@ -20,36 +18,6 @@ function KeyboardShortcuts({
|
|
|
20
18
|
redo,
|
|
21
19
|
save
|
|
22
20
|
}) {
|
|
23
|
-
const {
|
|
24
|
-
replaceBlocks
|
|
25
|
-
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
26
|
-
const {
|
|
27
|
-
getBlockName,
|
|
28
|
-
getSelectedBlockClientId,
|
|
29
|
-
getBlockAttributes
|
|
30
|
-
} = (0, _data.useSelect)(_blockEditor.store);
|
|
31
|
-
const handleTextLevelShortcut = (event, level) => {
|
|
32
|
-
event.preventDefault();
|
|
33
|
-
const destinationBlockName = level === 0 ? 'core/paragraph' : 'core/heading';
|
|
34
|
-
const currentClientId = getSelectedBlockClientId();
|
|
35
|
-
if (currentClientId === null) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const blockName = getBlockName(currentClientId);
|
|
39
|
-
if (blockName !== 'core/paragraph' && blockName !== 'core/heading') {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const attributes = getBlockAttributes(currentClientId);
|
|
43
|
-
const textAlign = blockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
44
|
-
const destinationTextAlign = destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
45
|
-
replaceBlocks(currentClientId, (0, _blocks.createBlock)(destinationBlockName, {
|
|
46
|
-
level,
|
|
47
|
-
content: attributes.content,
|
|
48
|
-
...{
|
|
49
|
-
[destinationTextAlign]: attributes[textAlign]
|
|
50
|
-
}
|
|
51
|
-
}));
|
|
52
|
-
};
|
|
53
21
|
(0, _keyboardShortcuts.useShortcut)('core/customize-widgets/undo', event => {
|
|
54
22
|
undo();
|
|
55
23
|
event.preventDefault();
|
|
@@ -62,13 +30,6 @@ function KeyboardShortcuts({
|
|
|
62
30
|
event.preventDefault();
|
|
63
31
|
save();
|
|
64
32
|
});
|
|
65
|
-
(0, _keyboardShortcuts.useShortcut)('core/customize-widgets/transform-heading-to-paragraph', event => handleTextLevelShortcut(event, 0));
|
|
66
|
-
[1, 2, 3, 4, 5, 6].forEach(level => {
|
|
67
|
-
//the loop is based off on a constant therefore
|
|
68
|
-
//the hook will execute the same way every time
|
|
69
|
-
//eslint-disable-next-line react-hooks/rules-of-hooks
|
|
70
|
-
(0, _keyboardShortcuts.useShortcut)(`core/customize-widgets/transform-paragraph-to-heading-${level}`, event => handleTextLevelShortcut(event, level));
|
|
71
|
-
});
|
|
72
33
|
return null;
|
|
73
34
|
}
|
|
74
35
|
function KeyboardShortcutsRegister() {
|
|
@@ -112,26 +73,6 @@ function KeyboardShortcutsRegister() {
|
|
|
112
73
|
character: 's'
|
|
113
74
|
}
|
|
114
75
|
});
|
|
115
|
-
registerShortcut({
|
|
116
|
-
name: 'core/customize-widgets/transform-heading-to-paragraph',
|
|
117
|
-
category: 'block-library',
|
|
118
|
-
description: (0, _i18n.__)('Transform heading to paragraph.'),
|
|
119
|
-
keyCombination: {
|
|
120
|
-
modifier: 'access',
|
|
121
|
-
character: `0`
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
[1, 2, 3, 4, 5, 6].forEach(level => {
|
|
125
|
-
registerShortcut({
|
|
126
|
-
name: `core/customize-widgets/transform-paragraph-to-heading-${level}`,
|
|
127
|
-
category: 'block-library',
|
|
128
|
-
description: (0, _i18n.__)('Transform paragraph to heading.'),
|
|
129
|
-
keyCombination: {
|
|
130
|
-
modifier: 'access',
|
|
131
|
-
character: `${level}`
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
76
|
return () => {
|
|
136
77
|
unregisterShortcut('core/customize-widgets/undo');
|
|
137
78
|
unregisterShortcut('core/customize-widgets/redo');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_keyboardShortcuts","_keycodes","_data","_i18n","
|
|
1
|
+
{"version":3,"names":["_element","require","_keyboardShortcuts","_keycodes","_data","_i18n","KeyboardShortcuts","undo","redo","save","useShortcut","event","preventDefault","KeyboardShortcutsRegister","registerShortcut","unregisterShortcut","useDispatch","keyboardShortcutsStore","useEffect","name","category","description","__","keyCombination","modifier","character","aliases","isAppleOS","Register","_default","exports","default"],"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcuts/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { isAppleOS } from '@wordpress/keycodes';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\nfunction KeyboardShortcuts( { undo, redo, save } ) {\n\tuseShortcut( 'core/customize-widgets/undo', ( event ) => {\n\t\tundo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/customize-widgets/redo', ( event ) => {\n\t\tredo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/customize-widgets/save', ( event ) => {\n\t\tevent.preventDefault();\n\t\tsave();\n\t} );\n\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\tconst { registerShortcut, unregisterShortcut } = useDispatch(\n\t\tkeyboardShortcutsStore\n\t);\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/undo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Undo your last changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/redo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Redo your last undo.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t\t// Disable on Apple OS because it conflicts with the browser's\n\t\t\t// history shortcut. It's a fine alias for both Windows and Linux.\n\t\t\t// Since there's no conflict for Ctrl+Shift+Z on both Windows and\n\t\t\t// Linux, we keep it as the default for consistency.\n\t\t\taliases: isAppleOS()\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmodifier: 'primary',\n\t\t\t\t\t\t\tcharacter: 'y',\n\t\t\t\t\t\t},\n\t\t\t\t ],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/save',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Save your changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 's',\n\t\t\t},\n\t\t} );\n\n\t\treturn () => {\n\t\t\tunregisterShortcut( 'core/customize-widgets/undo' );\n\t\t\tunregisterShortcut( 'core/customize-widgets/redo' );\n\t\t\tunregisterShortcut( 'core/customize-widgets/save' );\n\t\t};\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nKeyboardShortcuts.Register = KeyboardShortcutsRegister;\nexport default KeyboardShortcuts;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAIA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAVA;AACA;AACA;;AAUA,SAASK,iBAAiBA,CAAE;EAAEC,IAAI;EAAEC,IAAI;EAAEC;A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ACnCC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAE,IAAAC,QAAE,EAAE,oBAAqB,CAAC;MACvCC,cAAc,EAAE;QACfC,QAAQ,EAAE,SAAS;QACnBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;IAEH,OAAO,MAAM;MACZV,kBAAkB,CAAE,6BAA8B,CAAC;MACnDA,kBAAkB,CAAE,6BAA8B,CAAC;MACnDA,kBAAkB,CAAE,6BAA8B,CAAC;IACpD,CAAC;EACF,CAAC,EAAE,CAAED,gBAAgB,CAAG,CAAC;EAEzB,OAAO,IAAI;AACZ;AAEAR,iBAAiB,CAACsB,QAAQ,GAAGf,yBAAyB;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACxCzB,iBAAiB","ignoreList":[]}
|
|
@@ -13,6 +13,7 @@ var _element = require("@wordpress/element");
|
|
|
13
13
|
var _blockEditor = require("@wordpress/block-editor");
|
|
14
14
|
var _mediaUtils = require("@wordpress/media-utils");
|
|
15
15
|
var _preferences = require("@wordpress/preferences");
|
|
16
|
+
var _blockLibrary = require("@wordpress/block-library");
|
|
16
17
|
var _blockInspectorButton = _interopRequireDefault(require("../block-inspector-button"));
|
|
17
18
|
var _header = _interopRequireDefault(require("../header"));
|
|
18
19
|
var _useInserter = _interopRequireDefault(require("../inserter/use-inserter"));
|
|
@@ -32,6 +33,9 @@ var _lockUnlock = require("../../lock-unlock");
|
|
|
32
33
|
const {
|
|
33
34
|
ExperimentalBlockCanvas: BlockCanvas
|
|
34
35
|
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
36
|
+
const {
|
|
37
|
+
BlockKeyboardShortcuts
|
|
38
|
+
} = (0, _lockUnlock.unlock)(_blockLibrary.privateApis);
|
|
35
39
|
function SidebarBlockEditor({
|
|
36
40
|
blockEditorSettings,
|
|
37
41
|
sidebar,
|
|
@@ -87,7 +91,7 @@ function SidebarBlockEditor({
|
|
|
87
91
|
sidebar: sidebar
|
|
88
92
|
});
|
|
89
93
|
}
|
|
90
|
-
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_keyboardShortcuts.default.Register, null), (0, _react.createElement)(_sidebarEditorProvider.default, {
|
|
94
|
+
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_keyboardShortcuts.default.Register, null), (0, _react.createElement)(BlockKeyboardShortcuts, null), (0, _react.createElement)(_sidebarEditorProvider.default, {
|
|
91
95
|
sidebar: sidebar,
|
|
92
96
|
settings: settings
|
|
93
97
|
}, (0, _react.createElement)(_keyboardShortcuts.default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_coreData","_data","_element","_blockEditor","_mediaUtils","_preferences","_blockInspectorButton","_interopRequireDefault","_header","_useInserter","_sidebarEditorProvider","_welcomeGuide","_keyboardShortcuts","_blockAppender","_lockUnlock","ExperimentalBlockCanvas","BlockCanvas","unlock","blockEditorPrivateApis","SidebarBlockEditor","blockEditorSettings","sidebar","inserter","inspector","isInserterOpened","setIsInserterOpened","useInserter","isMediumViewport","useViewportMatch","hasUploadPermissions","isFixedToolbarActive","keepCaretInsideBlock","isWelcomeGuideActive","useSelect","select","_select$canUser","get","preferencesStore","coreStore","canUser","settings","useMemo","mediaUploadBlockEditor","onError","argumentsObject","uploadMedia","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalSetIsInserterOpened","mediaUpload","hasFixedToolbar","__unstableHasCustomAppender","_react","createElement","default","Fragment","Register","undo","redo","save","BlockToolbar","hideDragHandle","shouldIframe","styles","defaultEditorStyles","height","BlockList","renderAppender","BlockAppender","createPortal","onSubmit","event","preventDefault","BlockInspector","contentContainer","__unstableBlockSettingsMenuFirstItem","onClose","closeMenu"],"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, createPortal } from '@wordpress/element';\nimport {\n\tBlockList,\n\tBlockToolbar,\n\tBlockInspector,\n\tprivateApis as blockEditorPrivateApis,\n\t__unstableBlockSettingsMenuFirstItem,\n} from '@wordpress/block-editor';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from '../block-inspector-button';\nimport Header from '../header';\nimport useInserter from '../inserter/use-inserter';\nimport SidebarEditorProvider from './sidebar-editor-provider';\nimport WelcomeGuide from '../welcome-guide';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport BlockAppender from '../block-appender';\nimport { unlock } from '../../lock-unlock';\n\nconst { ExperimentalBlockCanvas: BlockCanvas } = unlock(\n\tblockEditorPrivateApis\n);\n\nexport default function SidebarBlockEditor( {\n\tblockEditorSettings,\n\tsidebar,\n\tinserter,\n\tinspector,\n} ) {\n\tconst [ isInserterOpened, setIsInserterOpened ] = useInserter( inserter );\n\tconst isMediumViewport = useViewportMatch( 'small' );\n\tconst {\n\t\thasUploadPermissions,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tisWelcomeGuideActive,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\thasUploadPermissions:\n\t\t\t\tselect( coreStore ).canUser( 'create', 'media' ) ?? true,\n\t\t\tisFixedToolbarActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tisWelcomeGuideActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'welcomeGuide'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( hasUploadPermissions ) {\n\t\t\tmediaUploadBlockEditor = ( { onError, ...argumentsObject } ) => {\n\t\t\t\tuploadMedia( {\n\t\t\t\t\twpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,\n\t\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t\t...argumentsObject,\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\t...blockEditorSettings,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\thasFixedToolbar: isFixedToolbarActive || ! isMediumViewport,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t__unstableHasCustomAppender: true,\n\t\t};\n\t}, [\n\t\thasUploadPermissions,\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tisMediumViewport,\n\t\tkeepCaretInsideBlock,\n\t\tsetIsInserterOpened,\n\t] );\n\n\tif ( isWelcomeGuideActive ) {\n\t\treturn <WelcomeGuide sidebar={ sidebar } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<KeyboardShortcuts.Register />\n\n\t\t\t<SidebarEditorProvider sidebar={ sidebar } settings={ settings }>\n\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\tundo={ sidebar.undo }\n\t\t\t\t\tredo={ sidebar.redo }\n\t\t\t\t\tsave={ sidebar.save }\n\t\t\t\t/>\n\n\t\t\t\t<Header\n\t\t\t\t\tsidebar={ sidebar }\n\t\t\t\t\tinserter={ inserter }\n\t\t\t\t\tisInserterOpened={ isInserterOpened }\n\t\t\t\t\tsetIsInserterOpened={ setIsInserterOpened }\n\t\t\t\t\tisFixedToolbarActive={\n\t\t\t\t\t\tisFixedToolbarActive || ! isMediumViewport\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ ( isFixedToolbarActive || ! isMediumViewport ) && (\n\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t) }\n\t\t\t\t<BlockCanvas\n\t\t\t\t\tshouldIframe={ false }\n\t\t\t\t\tstyles={ settings.defaultEditorStyles }\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t>\n\t\t\t\t\t<BlockList renderAppender={ BlockAppender } />\n\t\t\t\t</BlockCanvas>\n\n\t\t\t\t{ createPortal(\n\t\t\t\t\t// This is a temporary hack to prevent button component inside <BlockInspector>\n\t\t\t\t\t// from submitting form when type=\"button\" is not specified.\n\t\t\t\t\t<form onSubmit={ ( event ) => event.preventDefault() }>\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t</form>,\n\t\t\t\t\tinspector.contentContainer[ 0 ]\n\t\t\t\t) }\n\t\t\t</SidebarEditorProvider>\n\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton\n\t\t\t\t\t\tinspector={ inspector }\n\t\t\t\t\t\tcloseMenu={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAOA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;
|
|
1
|
+
{"version":3,"names":["_compose","require","_coreData","_data","_element","_blockEditor","_mediaUtils","_preferences","_blockLibrary","_blockInspectorButton","_interopRequireDefault","_header","_useInserter","_sidebarEditorProvider","_welcomeGuide","_keyboardShortcuts","_blockAppender","_lockUnlock","ExperimentalBlockCanvas","BlockCanvas","unlock","blockEditorPrivateApis","BlockKeyboardShortcuts","blockLibraryPrivateApis","SidebarBlockEditor","blockEditorSettings","sidebar","inserter","inspector","isInserterOpened","setIsInserterOpened","useInserter","isMediumViewport","useViewportMatch","hasUploadPermissions","isFixedToolbarActive","keepCaretInsideBlock","isWelcomeGuideActive","useSelect","select","_select$canUser","get","preferencesStore","coreStore","canUser","settings","useMemo","mediaUploadBlockEditor","onError","argumentsObject","uploadMedia","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalSetIsInserterOpened","mediaUpload","hasFixedToolbar","__unstableHasCustomAppender","_react","createElement","default","Fragment","Register","undo","redo","save","BlockToolbar","hideDragHandle","shouldIframe","styles","defaultEditorStyles","height","BlockList","renderAppender","BlockAppender","createPortal","onSubmit","event","preventDefault","BlockInspector","contentContainer","__unstableBlockSettingsMenuFirstItem","onClose","closeMenu"],"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, createPortal } from '@wordpress/element';\nimport {\n\tBlockList,\n\tBlockToolbar,\n\tBlockInspector,\n\tprivateApis as blockEditorPrivateApis,\n\t__unstableBlockSettingsMenuFirstItem,\n} from '@wordpress/block-editor';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from '../block-inspector-button';\nimport Header from '../header';\nimport useInserter from '../inserter/use-inserter';\nimport SidebarEditorProvider from './sidebar-editor-provider';\nimport WelcomeGuide from '../welcome-guide';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport BlockAppender from '../block-appender';\nimport { unlock } from '../../lock-unlock';\n\nconst { ExperimentalBlockCanvas: BlockCanvas } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nexport default function SidebarBlockEditor( {\n\tblockEditorSettings,\n\tsidebar,\n\tinserter,\n\tinspector,\n} ) {\n\tconst [ isInserterOpened, setIsInserterOpened ] = useInserter( inserter );\n\tconst isMediumViewport = useViewportMatch( 'small' );\n\tconst {\n\t\thasUploadPermissions,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tisWelcomeGuideActive,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\thasUploadPermissions:\n\t\t\t\tselect( coreStore ).canUser( 'create', 'media' ) ?? true,\n\t\t\tisFixedToolbarActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tisWelcomeGuideActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'welcomeGuide'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( hasUploadPermissions ) {\n\t\t\tmediaUploadBlockEditor = ( { onError, ...argumentsObject } ) => {\n\t\t\t\tuploadMedia( {\n\t\t\t\t\twpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,\n\t\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t\t...argumentsObject,\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\t...blockEditorSettings,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\thasFixedToolbar: isFixedToolbarActive || ! isMediumViewport,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t__unstableHasCustomAppender: true,\n\t\t};\n\t}, [\n\t\thasUploadPermissions,\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tisMediumViewport,\n\t\tkeepCaretInsideBlock,\n\t\tsetIsInserterOpened,\n\t] );\n\n\tif ( isWelcomeGuideActive ) {\n\t\treturn <WelcomeGuide sidebar={ sidebar } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<KeyboardShortcuts.Register />\n\t\t\t<BlockKeyboardShortcuts />\n\n\t\t\t<SidebarEditorProvider sidebar={ sidebar } settings={ settings }>\n\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\tundo={ sidebar.undo }\n\t\t\t\t\tredo={ sidebar.redo }\n\t\t\t\t\tsave={ sidebar.save }\n\t\t\t\t/>\n\n\t\t\t\t<Header\n\t\t\t\t\tsidebar={ sidebar }\n\t\t\t\t\tinserter={ inserter }\n\t\t\t\t\tisInserterOpened={ isInserterOpened }\n\t\t\t\t\tsetIsInserterOpened={ setIsInserterOpened }\n\t\t\t\t\tisFixedToolbarActive={\n\t\t\t\t\t\tisFixedToolbarActive || ! isMediumViewport\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ ( isFixedToolbarActive || ! isMediumViewport ) && (\n\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t) }\n\t\t\t\t<BlockCanvas\n\t\t\t\t\tshouldIframe={ false }\n\t\t\t\t\tstyles={ settings.defaultEditorStyles }\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t>\n\t\t\t\t\t<BlockList renderAppender={ BlockAppender } />\n\t\t\t\t</BlockCanvas>\n\n\t\t\t\t{ createPortal(\n\t\t\t\t\t// This is a temporary hack to prevent button component inside <BlockInspector>\n\t\t\t\t\t// from submitting form when type=\"button\" is not specified.\n\t\t\t\t\t<form onSubmit={ ( event ) => event.preventDefault() }>\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t</form>,\n\t\t\t\t\tinspector.contentContainer[ 0 ]\n\t\t\t\t) }\n\t\t\t</SidebarEditorProvider>\n\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton\n\t\t\t\t\t\tinspector={ inspector }\n\t\t\t\t\t\tcloseMenu={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t) }\n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mE,SAAS;IAACC,cAAc,EAAGC;EAAe,CAAE,CACjC,CAAC,EAEZ,IAAAC,qBAAY;EACb;EACA;EACA,IAAAjB,MAAA,CAAAC,aAAA;IAAMiB,QAAQ,EAAKC,KAAK,IAAMA,KAAK,CAACC,cAAc,CAAC;EAAG,GACrD,IAAApB,MAAA,CAAAC,aAAA,EAACtD,YAAA,CAAA0E,cAAc,MAAE,CACZ,CAAC,EACPnD,SAAS,CAACoD,gBAAgB,CAAE,CAAC,CAC9B,CACsB,CAAC,EAExB,IAAAtB,MAAA,CAAAC,aAAA,EAACtD,YAAA,CAAA4E,oCAAoC,QAClC,CAAE;IAAEC;EAAQ,CAAC,KACd,IAAAxB,MAAA,CAAAC,aAAA,EAAClD,qBAAA,CAAAmD,OAAoB;IACpBhC,SAAS,EAAGA,SAAW;IACvBuD,SAAS,EAAGD;EAAS,CACrB,CAEmC,CACrC,CAAC;AAEL","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import { createElement, Fragment } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* External dependencies
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import clsx from 'clsx';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
@@ -34,7 +34,7 @@ function Header({
|
|
|
34
34
|
});
|
|
35
35
|
}, [sidebar]);
|
|
36
36
|
return createElement(Fragment, null, createElement("div", {
|
|
37
|
-
className:
|
|
37
|
+
className: clsx('customize-widgets-header', {
|
|
38
38
|
'is-fixed-toolbar-active': isFixedToolbarActive
|
|
39
39
|
})
|
|
40
40
|
}, createElement(NavigableToolbar, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["clsx","ToolbarButton","NavigableToolbar","createPortal","useEffect","useState","displayShortcut","isAppleOS","__","_x","isRTL","plus","undo","undoIcon","redo","redoIcon","Inserter","MoreMenu","Header","sidebar","inserter","isInserterOpened","setIsInserterOpened","isFixedToolbarActive","hasUndo","hasRedo","setUndoRedo","shortcut","primaryShift","primary","subscribeHistory","createElement","Fragment","className","icon","label","onClick","isPressed","variant","isOpen","setIsOpened","contentContainer"],"sources":["@wordpress/customize-widgets/src/components/header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { NavigableToolbar } from '@wordpress/block-editor';\nimport { createPortal, useEffect, useState } from '@wordpress/element';\nimport { displayShortcut, isAppleOS } from '@wordpress/keycodes';\nimport { __, _x, isRTL } from '@wordpress/i18n';\nimport { plus, undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport MoreMenu from '../more-menu';\n\nfunction Header( {\n\tsidebar,\n\tinserter,\n\tisInserterOpened,\n\tsetIsInserterOpened,\n\tisFixedToolbarActive,\n} ) {\n\tconst [ [ hasUndo, hasRedo ], setUndoRedo ] = useState( [\n\t\tsidebar.hasUndo(),\n\t\tsidebar.hasRedo(),\n\t] );\n\n\tconst shortcut = isAppleOS()\n\t\t? displayShortcut.primaryShift( 'z' )\n\t\t: displayShortcut.primary( 'y' );\n\n\tuseEffect( () => {\n\t\treturn sidebar.subscribeHistory( () => {\n\t\t\tsetUndoRedo( [ sidebar.hasUndo(), sidebar.hasRedo() ] );\n\t\t} );\n\t}, [ sidebar ] );\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName={ clsx( 'customize-widgets-header', {\n\t\t\t\t\t'is-fixed-toolbar-active': isFixedToolbarActive,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<NavigableToolbar\n\t\t\t\t\tclassName=\"customize-widgets-header-toolbar\"\n\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Undo' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\t\t\t\taria-disabled={ ! hasUndo }\n\t\t\t\t\t\tonClick={ sidebar.undo }\n\t\t\t\t\t\tclassName=\"customize-widgets-editor-history-button undo-button\"\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ ! isRTL() ? redoIcon : undoIcon }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Redo' ) }\n\t\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\t\t\t\taria-disabled={ ! hasRedo }\n\t\t\t\t\t\tonClick={ sidebar.redo }\n\t\t\t\t\t\tclassName=\"customize-widgets-editor-history-button redo-button\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tclassName=\"customize-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t'Add block',\n\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsInserterOpened( ( isOpen ) => ! isOpen );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</NavigableToolbar>\n\t\t\t</div>\n\n\t\t\t{ createPortal(\n\t\t\t\t<Inserter setIsOpened={ setIsInserterOpened } />,\n\t\t\t\tinserter.contentContainer[ 0 ]\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Header;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,YAAY,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACtE,SAASC,eAAe,EAAEC,SAAS,QAAQ,qBAAqB;AAChE,SAASC,EAAE,EAAEC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC/C,SAASC,IAAI,EAAEC,IAAI,IAAIC,QAAQ,EAAEC,IAAI,IAAIC,QAAQ,QAAQ,kBAAkB;;AAE3E;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,aAAa;AAClC,OAAOC,QAAQ,MAAM,cAAc;AAEnC,SAASC,MAAMA,CAAE;EAChBC,OAAO;EACPC,QAAQ;EACRC,gBAAgB;EAChBC,mBAAmB;EACnBC;AACD,CAAC,EAAG;EACH,MAAM,CAAE,CAAEC,OAAO,EAAEC,OAAO,CAAE,EAAEC,WAAW,CAAE,GAAGrB,QAAQ,CAAE,CACvDc,OAAO,CAACK,OAAO,CAAC,CAAC,EACjBL,OAAO,CAACM,OAAO,CAAC,CAAC,CAChB,CAAC;EAEH,MAAME,QAAQ,GAAGpB,SAAS,CAAC,CAAC,GACzBD,eAAe,CAACsB,YAAY,CAAE,GAAI,CAAC,GACnCtB,eAAe,CAACuB,OAAO,CAAE,GAAI,CAAC;EAEjCzB,SAAS,CAAE,MAAM;IAChB,OAAOe,OAAO,CAACW,gBAAgB,CAAE,MAAM;MACtCJ,WAAW,CAAE,CAAEP,OAAO,CAACK,OAAO,CAAC,CAAC,EAAEL,OAAO,CAACM,OAAO,CAAC,CAAC,CAAG,CAA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CAAC,EACFR,aAAA,CAACd,QAAQ,MAAE,CACM,CACd,CAAC,EAEJd,YAAY,CACb4B,aAAA,CAACf,QAAQ;IAACwB,WAAW,EAAGlB;EAAqB,CAAE,CAAC,EAChDF,QAAQ,CAACqB,gBAAgB,CAAE,CAAC,CAC7B,CACC,CAAC;AAEL;AAEA,eAAevB,MAAM","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","textFormattingShortcuts","keyCombination","modifier","character","description"],"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/config.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const textFormattingShortcuts = [\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'b' },\n\t\tdescription: __( 'Make the selected text bold.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'i' },\n\t\tdescription: __( 'Make the selected text italic.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'k' },\n\t\tdescription: __( 'Convert the selected text into a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'k' },\n\t\tdescription: __( 'Remove a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { character: '[[' },\n\t\tdescription: __( 'Insert a link to a post or page.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'u' },\n\t\tdescription: __( 'Underline the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'd' },\n\t\tdescription: __( 'Strikethrough the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'x' },\n\t\tdescription: __( 'Make the selected text inline code.' ),\n\t},\n\t{\n\t\tkeyCombination: {
|
|
1
|
+
{"version":3,"names":["__","textFormattingShortcuts","keyCombination","modifier","character","description","aliases"],"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/config.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const textFormattingShortcuts = [\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'b' },\n\t\tdescription: __( 'Make the selected text bold.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'i' },\n\t\tdescription: __( 'Make the selected text italic.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'k' },\n\t\tdescription: __( 'Convert the selected text into a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'k' },\n\t\tdescription: __( 'Remove a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { character: '[[' },\n\t\tdescription: __( 'Insert a link to a post or page.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'u' },\n\t\tdescription: __( 'Underline the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'd' },\n\t\tdescription: __( 'Strikethrough the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'x' },\n\t\tdescription: __( 'Make the selected text inline code.' ),\n\t},\n\t{\n\t\tkeyCombination: {\n\t\t\tmodifier: 'access',\n\t\t\tcharacter: '0',\n\t\t},\n\t\taliases: [\n\t\t\t{\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: '7',\n\t\t\t},\n\t\t],\n\t\tdescription: __( 'Convert the current heading to a paragraph.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: '1-6' },\n\t\tdescription: __(\n\t\t\t'Convert the current paragraph or heading to a heading of level 1 to 6.'\n\t\t),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'SPACE' },\n\t\tdescription: __( 'Add non breaking space.' ),\n\t},\n];\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AAEpC,OAAO,MAAMC,uBAAuB,GAAG,CACtC;EACCC,cAAc,EAAE;IAAEC,QAAQ,EAAE,SAAS;IAAE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;IAAEC,QAAQ,EAAE,QAAQ;IAAEC,SAAS,EAAE;EAAM,CAAC;EACxDC,WAAW,EAAEL,EAAE,CACd,wEACD;AACD,CAAC,EACD;EACCE,cAAc,EAAE;IAAEC,QAAQ,EAAE,cAAc;IAAEC,SAAS,EAAE;EAAQ,CAAC;EAChEC,WAAW,EAAEL,EAAE,CAAE,yBAA0B;AAC5C,CAAC,CACD","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import { createElement } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* External dependencies
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import clsx from 'clsx';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
@@ -43,7 +43,7 @@ const ShortcutSection = ({
|
|
|
43
43
|
shortcuts,
|
|
44
44
|
className
|
|
45
45
|
}) => createElement("section", {
|
|
46
|
-
className:
|
|
46
|
+
className: clsx('customize-widgets-keyboard-shortcut-help-modal__section', className)
|
|
47
47
|
}, !!title && createElement("h2", {
|
|
48
48
|
className: "customize-widgets-keyboard-shortcut-help-modal__section-title"
|
|
49
49
|
}, title), createElement(ShortcutList, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["clsx","Modal","__","useShortcut","store","keyboardShortcutsStore","useDispatch","useSelect","textFormattingShortcuts","Shortcut","DynamicShortcut","ShortcutList","shortcuts","createElement","className","role","map","shortcut","index","key","name","ShortcutSection","title","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","registerShortcut","category","description","keyCombination","modifier","character","onRequestClose","ariaLabel"],"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { textFormattingShortcuts } from './config';\nimport Shortcut from './shortcut';\nimport DynamicShortcut from './dynamic-shortcut';\n\nconst ShortcutList = ( { shortcuts } ) => (\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t<ul\n\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-list\"\n\t\trole=\"list\"\n\t>\n\t\t{ shortcuts.map( ( shortcut, index ) => (\n\t\t\t<li\n\t\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut\"\n\t\t\t\tkey={ index }\n\t\t\t>\n\t\t\t\t{ typeof shortcut === 'string' ? (\n\t\t\t\t\t<DynamicShortcut name={ shortcut } />\n\t\t\t\t) : (\n\t\t\t\t\t<Shortcut { ...shortcut } />\n\t\t\t\t) }\n\t\t\t</li>\n\t\t) ) }\n\t</ul>\n\t/* eslint-enable jsx-a11y/no-redundant-roles */\n);\n\nconst ShortcutSection = ( { title, shortcuts, className } ) => (\n\t<section\n\t\tclassName={ clsx(\n\t\t\t'customize-widgets-keyboard-shortcut-help-modal__section',\n\t\t\tclassName\n\t\t) }\n\t>\n\t\t{ !! title && (\n\t\t\t<h2 className=\"customize-widgets-keyboard-shortcut-help-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t) }\n\t\t<ShortcutList shortcuts={ shortcuts } />\n\t</section>\n);\n\nconst ShortcutCategorySection = ( {\n\ttitle,\n\tcategoryName,\n\tadditionalShortcuts = [],\n} ) => {\n\tconst categoryShortcuts = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( keyboardShortcutsStore ).getCategoryShortcuts(\n\t\t\t\tcategoryName\n\t\t\t);\n\t\t},\n\t\t[ categoryName ]\n\t);\n\n\treturn (\n\t\t<ShortcutSection\n\t\t\ttitle={ title }\n\t\t\tshortcuts={ categoryShortcuts.concat( additionalShortcuts ) }\n\t\t/>\n\t);\n};\n\nexport default function KeyboardShortcutHelpModal( {\n\tisModalActive,\n\ttoggleModal,\n} ) {\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tregisterShortcut( {\n\t\tname: 'core/customize-widgets/keyboard-shortcuts',\n\t\tcategory: 'main',\n\t\tdescription: __( 'Display these keyboard shortcuts.' ),\n\t\tkeyCombination: {\n\t\t\tmodifier: 'access',\n\t\t\tcharacter: 'h',\n\t\t},\n\t} );\n\n\tuseShortcut( 'core/customize-widgets/keyboard-shortcuts', toggleModal );\n\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal\"\n\t\t\ttitle={ __( 'Keyboard shortcuts' ) }\n\t\t\tonRequestClose={ toggleModal }\n\t\t>\n\t\t\t<ShortcutSection\n\t\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__main-shortcuts\"\n\t\t\t\tshortcuts={ [ 'core/customize-widgets/keyboard-shortcuts' ] }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Global shortcuts' ) }\n\t\t\t\tcategoryName=\"global\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Selection shortcuts' ) }\n\t\t\t\tcategoryName=\"selection\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Block shortcuts' ) }\n\t\t\t\tcategoryName=\"block\"\n\t\t\t\tadditionalShortcuts={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tkeyCombination: { character: '/' },\n\t\t\t\t\t\tdescription: __(\n\t\t\t\t\t\t\t'Change the block type after adding a new paragraph.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t/* translators: The forward-slash character. e.g. '/'. */\n\t\t\t\t\t\tariaLabel: __( 'Forward-slash' ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t<ShortcutSection\n\t\t\t\ttitle={ __( 'Text formatting' ) }\n\t\t\t\tshortcuts={ textFormattingShortcuts }\n\t\t\t/>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,WAAW,EACXC,KAAK,IAAIC,sBAAsB,QACzB,+BAA+B;AACtC,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,SAASC,uBAAuB,QAAQ,UAAU;AAClD,OAAOC,QAAQ,MAAM,YAAY;AACjC,OAAOC,eAAe,MAAM,oBAAoB;AAEhD,MAAMC,YAAY,GAAGA,CAAE;EAAEC;AAAU,CAAC;AACnC;AACD;AACA;AACA;AACC;AACAC,aAAA;EACCC,SAAS,EAAC,+DAA+D;EACzEC,IAAI,EAAC;AAAM,GAETH,SAAS,CAACI,GAAG,CAAE,CAAEC,QAAQ,EAAEC,KAAK,KACjCL,aAAA;EACCC,SAAS,EAAC,0DAA0D;EACpEK,GAAG,EAAGD;AAAO,GAEX,OAAOD,QAAQ,KAAK,QAAQ,GAC7BJ,aAAA,CAACH,eAAe;EAACU,IAAI,EAAGH;AAAU,CAAE,CAAC,GAErCJ,aAAA,CAACJ,QAAQ;EAAA,GAAMQ;AAAQ,CAAI,CAEzB,CACH,CACC;AACJ,+CACA;AAED,MAAMI,eAAe,GAAGA,CAAE;EAAEC,KAAK;EAAEV,SAAS;EAAEE;AAAU,CAAC,KACxDD,aAAA;EACCC,SAAS,EAAGd,IAAI,CACf,yDAAyD,EACzDc,SACD;AAAG,GAED,CAAC,CAAEQ,KAAK,IACTT,aAAA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C,aAAA,CAACU,uBAAuB;IACvBD,KAAK,EAAGpB,EAAE,CAAE,kBAAmB,CAAG;IAClCsB,YAAY,EAAC;EAAQ,CACrB,CAAC,EAEFX,aAAA,CAACU,uBAAuB;IACvBD,KAAK,EAAGpB,EAAE,CAAE,qBAAsB,CAAG;IACrCsB,YAAY,EAAC;EAAW,CACxB,CAAC,EAEFX,aAAA,CAACU,uBAAuB;IACvBD,KAAK,EAAGpB,EAAE,CAAE,iBAAkB,CAAG;IACjCsB,YAAY,EAAC,OAAO;IACpBC,mBAAmB,EAAG,CACrB;MACCW,cAAc,EAAE;QAAEE,SAAS,EAAE;MAAI,CAAC;MAClCH,WAAW,EAAEjC,EAAE,CACd,qDACD,CAAC;MACD;MACAsC,SAAS,EAAEtC,EAAE,CAAE,eAAgB;IAChC,CAAC;EACC,CACH,CAAC,EACFW,aAAA,CAACQ,eAAe;IACfC,KAAK,EAAGpB,EAAE,CAAE,iBAAkB,CAAG;IACjCU,SAAS,EAAGJ;EAAyB,CACrC,CACK,CAAC;AAEV","ignoreList":[]}
|
|
@@ -4,45 +4,13 @@
|
|
|
4
4
|
import { useEffect } from '@wordpress/element';
|
|
5
5
|
import { useShortcut, store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
6
6
|
import { isAppleOS } from '@wordpress/keycodes';
|
|
7
|
-
import { useDispatch
|
|
7
|
+
import { useDispatch } from '@wordpress/data';
|
|
8
8
|
import { __ } from '@wordpress/i18n';
|
|
9
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
10
|
-
import { createBlock } from '@wordpress/blocks';
|
|
11
9
|
function KeyboardShortcuts({
|
|
12
10
|
undo,
|
|
13
11
|
redo,
|
|
14
12
|
save
|
|
15
13
|
}) {
|
|
16
|
-
const {
|
|
17
|
-
replaceBlocks
|
|
18
|
-
} = useDispatch(blockEditorStore);
|
|
19
|
-
const {
|
|
20
|
-
getBlockName,
|
|
21
|
-
getSelectedBlockClientId,
|
|
22
|
-
getBlockAttributes
|
|
23
|
-
} = useSelect(blockEditorStore);
|
|
24
|
-
const handleTextLevelShortcut = (event, level) => {
|
|
25
|
-
event.preventDefault();
|
|
26
|
-
const destinationBlockName = level === 0 ? 'core/paragraph' : 'core/heading';
|
|
27
|
-
const currentClientId = getSelectedBlockClientId();
|
|
28
|
-
if (currentClientId === null) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const blockName = getBlockName(currentClientId);
|
|
32
|
-
if (blockName !== 'core/paragraph' && blockName !== 'core/heading') {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const attributes = getBlockAttributes(currentClientId);
|
|
36
|
-
const textAlign = blockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
37
|
-
const destinationTextAlign = destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
38
|
-
replaceBlocks(currentClientId, createBlock(destinationBlockName, {
|
|
39
|
-
level,
|
|
40
|
-
content: attributes.content,
|
|
41
|
-
...{
|
|
42
|
-
[destinationTextAlign]: attributes[textAlign]
|
|
43
|
-
}
|
|
44
|
-
}));
|
|
45
|
-
};
|
|
46
14
|
useShortcut('core/customize-widgets/undo', event => {
|
|
47
15
|
undo();
|
|
48
16
|
event.preventDefault();
|
|
@@ -55,13 +23,6 @@ function KeyboardShortcuts({
|
|
|
55
23
|
event.preventDefault();
|
|
56
24
|
save();
|
|
57
25
|
});
|
|
58
|
-
useShortcut('core/customize-widgets/transform-heading-to-paragraph', event => handleTextLevelShortcut(event, 0));
|
|
59
|
-
[1, 2, 3, 4, 5, 6].forEach(level => {
|
|
60
|
-
//the loop is based off on a constant therefore
|
|
61
|
-
//the hook will execute the same way every time
|
|
62
|
-
//eslint-disable-next-line react-hooks/rules-of-hooks
|
|
63
|
-
useShortcut(`core/customize-widgets/transform-paragraph-to-heading-${level}`, event => handleTextLevelShortcut(event, level));
|
|
64
|
-
});
|
|
65
26
|
return null;
|
|
66
27
|
}
|
|
67
28
|
function KeyboardShortcutsRegister() {
|
|
@@ -105,26 +66,6 @@ function KeyboardShortcutsRegister() {
|
|
|
105
66
|
character: 's'
|
|
106
67
|
}
|
|
107
68
|
});
|
|
108
|
-
registerShortcut({
|
|
109
|
-
name: 'core/customize-widgets/transform-heading-to-paragraph',
|
|
110
|
-
category: 'block-library',
|
|
111
|
-
description: __('Transform heading to paragraph.'),
|
|
112
|
-
keyCombination: {
|
|
113
|
-
modifier: 'access',
|
|
114
|
-
character: `0`
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
[1, 2, 3, 4, 5, 6].forEach(level => {
|
|
118
|
-
registerShortcut({
|
|
119
|
-
name: `core/customize-widgets/transform-paragraph-to-heading-${level}`,
|
|
120
|
-
category: 'block-library',
|
|
121
|
-
description: __('Transform paragraph to heading.'),
|
|
122
|
-
keyCombination: {
|
|
123
|
-
modifier: 'access',
|
|
124
|
-
character: `${level}`
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
69
|
return () => {
|
|
129
70
|
unregisterShortcut('core/customize-widgets/undo');
|
|
130
71
|
unregisterShortcut('core/customize-widgets/redo');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useShortcut","store","keyboardShortcutsStore","isAppleOS","useDispatch","
|
|
1
|
+
{"version":3,"names":["useEffect","useShortcut","store","keyboardShortcutsStore","isAppleOS","useDispatch","__","KeyboardShortcuts","undo","redo","save","event","preventDefault","KeyboardShortcutsRegister","registerShortcut","unregisterShortcut","name","category","description","keyCombination","modifier","character","aliases","Register"],"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcuts/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { isAppleOS } from '@wordpress/keycodes';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\nfunction KeyboardShortcuts( { undo, redo, save } ) {\n\tuseShortcut( 'core/customize-widgets/undo', ( event ) => {\n\t\tundo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/customize-widgets/redo', ( event ) => {\n\t\tredo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/customize-widgets/save', ( event ) => {\n\t\tevent.preventDefault();\n\t\tsave();\n\t} );\n\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\tconst { registerShortcut, unregisterShortcut } = useDispatch(\n\t\tkeyboardShortcutsStore\n\t);\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/undo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Undo your last changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/redo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Redo your last undo.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t\t// Disable on Apple OS because it conflicts with the browser's\n\t\t\t// history shortcut. It's a fine alias for both Windows and Linux.\n\t\t\t// Since there's no conflict for Ctrl+Shift+Z on both Windows and\n\t\t\t// Linux, we keep it as the default for consistency.\n\t\t\taliases: isAppleOS()\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmodifier: 'primary',\n\t\t\t\t\t\t\tcharacter: 'y',\n\t\t\t\t\t\t},\n\t\t\t\t ],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/save',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Save your changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 's',\n\t\t\t},\n\t\t} );\n\n\t\treturn () => {\n\t\t\tunregisterShortcut( 'core/customize-widgets/undo' );\n\t\t\tunregisterShortcut( 'core/customize-widgets/redo' );\n\t\t\tunregisterShortcut( 'core/customize-widgets/save' );\n\t\t};\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nKeyboardShortcuts.Register = KeyboardShortcutsRegister;\nexport default KeyboardShortcuts;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SACCC,WAAW,EACXC,KAAK,IAAIC,sBAAsB,QACzB,+BAA+B;AACtC,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AAEpC,SAASC,iBAAiBA,CAAE;EAAEC,IAAI;EAAEC,IAAI;EAAEC;AAAK,CAAC,EAAG;EAClDT,WAAW,CAAE,6BAA6B,EAAIU,KAAK,IAAM;IACxDH,IAAI,CAAC,CAAC;IACNG,KAAK,CAACC,cAAc,CAAC,CAAC;EACvB,CAAE,CAAC;EAEHX,WAAW,CAAE,6BAA6B,EAAIU,KAAK,IAAM;IACxDF,IAAI,CAAC,CAAC;IACNE,KAAK,CAACC,cAAc,CAAC,CAAC;EACvB,CAAE,CAAC;EAEHX,WAAW,CAAE,6BAA6B,EAAIU,KAAK,IAAM;IACxDA,KAAK,CAACC,cAAc,CAAC,CAAC;IACtBF,IAAI,CAAC,CAAC;EACP,CAAE,CAAC;EAEH,OAAO,IAAI;AACZ;AAEA,SAASG,yBAAyBA,CAAA,EAAG;EACpC,MAAM;IAAEC,gBAAgB;IAAEC;EAAmB,CAAC,GAAGV,WAAW,CAC3DF,sBACD,CAAC;EAEDH,SAAS,CAAE,MAAM;IAChBc,gBAAgB,CAAE;MACjBE,IAAI,EAAE,6BAA6B;MACnCC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAEZ,EAAE,CAAE,yBAA0B,CAAC;MAC5Ca,cAAc,EAAE;QACfC,QAAQ,EAAE,SAAS;QACnBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;IAEHP,gBAAgB,CAAE;MACjBE,IAAI,EAAE,6BAA6B;MACnCC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAEZ,EAAE,CAAE,sBAAuB,CAAC;MACzCa,cAAc,EAAE;QACfC,QAAQ,EAAE,cAAc;QACxBC,SAAS,EAAE;MACZ,CAAC;MACD;MACA;MACA;MACA;MACAC,OAAO,EAAElB,SAAS,CAAC,CAAC,GACjB,EAAE,GACF,CACA;QACCgB,QAAQ,EAAE,SAAS;QACnBC,SAAS,EAAE;MACZ,CAAC;IAEL,CAAE,CAAC;IAEHP,gBAAgB,CAAE;MACjBE,IAAI,EAAE,6BAA6B;MACnCC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAEZ,EAAE,CAAE,oBAAqB,CAAC;MACvCa,cAAc,EAAE;QACfC,QAAQ,EAAE,SAAS;QACnBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;IAEH,OAAO,MAAM;MACZN,kBAAkB,CAAE,6BAA8B,CAAC;MACnDA,kBAAkB,CAAE,6BAA8B,CAAC;MACnDA,kBAAkB,CAAE,6BAA8B,CAAC;IACpD,CAAC;EACF,CAAC,EAAE,CAAED,gBAAgB,CAAG,CAAC;EAEzB,OAAO,IAAI;AACZ;AAEAP,iBAAiB,CAACgB,QAAQ,GAAGV,yBAAyB;AACtD,eAAeN,iBAAiB","ignoreList":[]}
|
|
@@ -9,6 +9,7 @@ import { useMemo, createPortal } from '@wordpress/element';
|
|
|
9
9
|
import { BlockList, BlockToolbar, BlockInspector, privateApis as blockEditorPrivateApis, __unstableBlockSettingsMenuFirstItem } from '@wordpress/block-editor';
|
|
10
10
|
import { uploadMedia } from '@wordpress/media-utils';
|
|
11
11
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
12
|
+
import { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
@@ -24,6 +25,9 @@ import { unlock } from '../../lock-unlock';
|
|
|
24
25
|
const {
|
|
25
26
|
ExperimentalBlockCanvas: BlockCanvas
|
|
26
27
|
} = unlock(blockEditorPrivateApis);
|
|
28
|
+
const {
|
|
29
|
+
BlockKeyboardShortcuts
|
|
30
|
+
} = unlock(blockLibraryPrivateApis);
|
|
27
31
|
export default function SidebarBlockEditor({
|
|
28
32
|
blockEditorSettings,
|
|
29
33
|
sidebar,
|
|
@@ -79,7 +83,7 @@ export default function SidebarBlockEditor({
|
|
|
79
83
|
sidebar: sidebar
|
|
80
84
|
});
|
|
81
85
|
}
|
|
82
|
-
return createElement(Fragment, null, createElement(KeyboardShortcuts.Register, null), createElement(SidebarEditorProvider, {
|
|
86
|
+
return createElement(Fragment, null, createElement(KeyboardShortcuts.Register, null), createElement(BlockKeyboardShortcuts, null), createElement(SidebarEditorProvider, {
|
|
83
87
|
sidebar: sidebar,
|
|
84
88
|
settings: settings
|
|
85
89
|
}, createElement(KeyboardShortcuts, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useViewportMatch","store","coreStore","useSelect","useMemo","createPortal","BlockList","BlockToolbar","BlockInspector","privateApis","blockEditorPrivateApis","__unstableBlockSettingsMenuFirstItem","uploadMedia","preferencesStore","BlockInspectorButton","Header","useInserter","SidebarEditorProvider","WelcomeGuide","KeyboardShortcuts","BlockAppender","unlock","ExperimentalBlockCanvas","BlockCanvas","SidebarBlockEditor","blockEditorSettings","sidebar","inserter","inspector","isInserterOpened","setIsInserterOpened","isMediumViewport","hasUploadPermissions","isFixedToolbarActive","keepCaretInsideBlock","isWelcomeGuideActive","select","_select$canUser","get","canUser","settings","mediaUploadBlockEditor","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalSetIsInserterOpened","mediaUpload","hasFixedToolbar","__unstableHasCustomAppender","createElement","Fragment","Register","undo","redo","save","hideDragHandle","shouldIframe","styles","defaultEditorStyles","height","renderAppender","onSubmit","event","preventDefault","contentContainer","onClose","closeMenu"],"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, createPortal } from '@wordpress/element';\nimport {\n\tBlockList,\n\tBlockToolbar,\n\tBlockInspector,\n\tprivateApis as blockEditorPrivateApis,\n\t__unstableBlockSettingsMenuFirstItem,\n} from '@wordpress/block-editor';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from '../block-inspector-button';\nimport Header from '../header';\nimport useInserter from '../inserter/use-inserter';\nimport SidebarEditorProvider from './sidebar-editor-provider';\nimport WelcomeGuide from '../welcome-guide';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport BlockAppender from '../block-appender';\nimport { unlock } from '../../lock-unlock';\n\nconst { ExperimentalBlockCanvas: BlockCanvas } = unlock(\n\tblockEditorPrivateApis\n);\n\nexport default function SidebarBlockEditor( {\n\tblockEditorSettings,\n\tsidebar,\n\tinserter,\n\tinspector,\n} ) {\n\tconst [ isInserterOpened, setIsInserterOpened ] = useInserter( inserter );\n\tconst isMediumViewport = useViewportMatch( 'small' );\n\tconst {\n\t\thasUploadPermissions,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tisWelcomeGuideActive,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\thasUploadPermissions:\n\t\t\t\tselect( coreStore ).canUser( 'create', 'media' ) ?? true,\n\t\t\tisFixedToolbarActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tisWelcomeGuideActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'welcomeGuide'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( hasUploadPermissions ) {\n\t\t\tmediaUploadBlockEditor = ( { onError, ...argumentsObject } ) => {\n\t\t\t\tuploadMedia( {\n\t\t\t\t\twpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,\n\t\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t\t...argumentsObject,\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\t...blockEditorSettings,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\thasFixedToolbar: isFixedToolbarActive || ! isMediumViewport,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t__unstableHasCustomAppender: true,\n\t\t};\n\t}, [\n\t\thasUploadPermissions,\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tisMediumViewport,\n\t\tkeepCaretInsideBlock,\n\t\tsetIsInserterOpened,\n\t] );\n\n\tif ( isWelcomeGuideActive ) {\n\t\treturn <WelcomeGuide sidebar={ sidebar } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<KeyboardShortcuts.Register />\n\n\t\t\t<SidebarEditorProvider sidebar={ sidebar } settings={ settings }>\n\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\tundo={ sidebar.undo }\n\t\t\t\t\tredo={ sidebar.redo }\n\t\t\t\t\tsave={ sidebar.save }\n\t\t\t\t/>\n\n\t\t\t\t<Header\n\t\t\t\t\tsidebar={ sidebar }\n\t\t\t\t\tinserter={ inserter }\n\t\t\t\t\tisInserterOpened={ isInserterOpened }\n\t\t\t\t\tsetIsInserterOpened={ setIsInserterOpened }\n\t\t\t\t\tisFixedToolbarActive={\n\t\t\t\t\t\tisFixedToolbarActive || ! isMediumViewport\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ ( isFixedToolbarActive || ! isMediumViewport ) && (\n\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t) }\n\t\t\t\t<BlockCanvas\n\t\t\t\t\tshouldIframe={ false }\n\t\t\t\t\tstyles={ settings.defaultEditorStyles }\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t>\n\t\t\t\t\t<BlockList renderAppender={ BlockAppender } />\n\t\t\t\t</BlockCanvas>\n\n\t\t\t\t{ createPortal(\n\t\t\t\t\t// This is a temporary hack to prevent button component inside <BlockInspector>\n\t\t\t\t\t// from submitting form when type=\"button\" is not specified.\n\t\t\t\t\t<form onSubmit={ ( event ) => event.preventDefault() }>\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t</form>,\n\t\t\t\t\tinspector.contentContainer[ 0 ]\n\t\t\t\t) }\n\t\t\t</SidebarEditorProvider>\n\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton\n\t\t\t\t\t\tinspector={ inspector }\n\t\t\t\t\t\tcloseMenu={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,EAAEC,YAAY,QAAQ,oBAAoB;AAC1D,SACCC,SAAS,EACTC,YAAY,EACZC,cAAc,EACdC,WAAW,IAAIC,sBAAsB,EACrCC,oCAAoC,QAC9B,yBAAyB;AAChC,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASX,KAAK,IAAIY,gBAAgB,QAAQ,wBAAwB;;
|
|
1
|
+
{"version":3,"names":["useViewportMatch","store","coreStore","useSelect","useMemo","createPortal","BlockList","BlockToolbar","BlockInspector","privateApis","blockEditorPrivateApis","__unstableBlockSettingsMenuFirstItem","uploadMedia","preferencesStore","blockLibraryPrivateApis","BlockInspectorButton","Header","useInserter","SidebarEditorProvider","WelcomeGuide","KeyboardShortcuts","BlockAppender","unlock","ExperimentalBlockCanvas","BlockCanvas","BlockKeyboardShortcuts","SidebarBlockEditor","blockEditorSettings","sidebar","inserter","inspector","isInserterOpened","setIsInserterOpened","isMediumViewport","hasUploadPermissions","isFixedToolbarActive","keepCaretInsideBlock","isWelcomeGuideActive","select","_select$canUser","get","canUser","settings","mediaUploadBlockEditor","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalSetIsInserterOpened","mediaUpload","hasFixedToolbar","__unstableHasCustomAppender","createElement","Fragment","Register","undo","redo","save","hideDragHandle","shouldIframe","styles","defaultEditorStyles","height","renderAppender","onSubmit","event","preventDefault","contentContainer","onClose","closeMenu"],"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, createPortal } from '@wordpress/element';\nimport {\n\tBlockList,\n\tBlockToolbar,\n\tBlockInspector,\n\tprivateApis as blockEditorPrivateApis,\n\t__unstableBlockSettingsMenuFirstItem,\n} from '@wordpress/block-editor';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from '../block-inspector-button';\nimport Header from '../header';\nimport useInserter from '../inserter/use-inserter';\nimport SidebarEditorProvider from './sidebar-editor-provider';\nimport WelcomeGuide from '../welcome-guide';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport BlockAppender from '../block-appender';\nimport { unlock } from '../../lock-unlock';\n\nconst { ExperimentalBlockCanvas: BlockCanvas } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nexport default function SidebarBlockEditor( {\n\tblockEditorSettings,\n\tsidebar,\n\tinserter,\n\tinspector,\n} ) {\n\tconst [ isInserterOpened, setIsInserterOpened ] = useInserter( inserter );\n\tconst isMediumViewport = useViewportMatch( 'small' );\n\tconst {\n\t\thasUploadPermissions,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tisWelcomeGuideActive,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\thasUploadPermissions:\n\t\t\t\tselect( coreStore ).canUser( 'create', 'media' ) ?? true,\n\t\t\tisFixedToolbarActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tisWelcomeGuideActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'welcomeGuide'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( hasUploadPermissions ) {\n\t\t\tmediaUploadBlockEditor = ( { onError, ...argumentsObject } ) => {\n\t\t\t\tuploadMedia( {\n\t\t\t\t\twpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,\n\t\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t\t...argumentsObject,\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\t...blockEditorSettings,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\thasFixedToolbar: isFixedToolbarActive || ! isMediumViewport,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t__unstableHasCustomAppender: true,\n\t\t};\n\t}, [\n\t\thasUploadPermissions,\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tisMediumViewport,\n\t\tkeepCaretInsideBlock,\n\t\tsetIsInserterOpened,\n\t] );\n\n\tif ( isWelcomeGuideActive ) {\n\t\treturn <WelcomeGuide sidebar={ sidebar } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<KeyboardShortcuts.Register />\n\t\t\t<BlockKeyboardShortcuts />\n\n\t\t\t<SidebarEditorProvider sidebar={ sidebar } settings={ settings }>\n\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\tundo={ sidebar.undo }\n\t\t\t\t\tredo={ sidebar.redo }\n\t\t\t\t\tsave={ sidebar.save }\n\t\t\t\t/>\n\n\t\t\t\t<Header\n\t\t\t\t\tsidebar={ sidebar }\n\t\t\t\t\tinserter={ inserter }\n\t\t\t\t\tisInserterOpened={ isInserterOpened }\n\t\t\t\t\tsetIsInserterOpened={ setIsInserterOpened }\n\t\t\t\t\tisFixedToolbarActive={\n\t\t\t\t\t\tisFixedToolbarActive || ! isMediumViewport\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ ( isFixedToolbarActive || ! isMediumViewport ) && (\n\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t) }\n\t\t\t\t<BlockCanvas\n\t\t\t\t\tshouldIframe={ false }\n\t\t\t\t\tstyles={ settings.defaultEditorStyles }\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t>\n\t\t\t\t\t<BlockList renderAppender={ BlockAppender } />\n\t\t\t\t</BlockCanvas>\n\n\t\t\t\t{ createPortal(\n\t\t\t\t\t// This is a temporary hack to prevent button component inside <BlockInspector>\n\t\t\t\t\t// from submitting form when type=\"button\" is not specified.\n\t\t\t\t\t<form onSubmit={ ( event ) => event.preventDefault() }>\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t</form>,\n\t\t\t\t\tinspector.contentContainer[ 0 ]\n\t\t\t\t) }\n\t\t\t</SidebarEditorProvider>\n\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton\n\t\t\t\t\t\tinspector={ inspector }\n\t\t\t\t\t\tcloseMenu={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,EAAEC,YAAY,QAAQ,oBAAoB;AAC1D,SACCC,SAAS,EACTC,YAAY,EACZC,cAAc,EACdC,WAAW,IAAIC,sBAAsB,EACrCC,oCAAoC,QAC9B,yBAAyB;AAChC,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASX,KAAK,IAAIY,gBAAgB,QAAQ,wBAAwB;AAClE,SAASJ,WAAW,IAAIK,uBAAuB,QAAQ,0BAA0B;;AAEjF;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,WAAW,MAAM,0BAA0B;AAClD,OAAOC,qBAAqB,MAAM,2BAA2B;AAC7D,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC,uBAAuB,EAAEC;AAAY,CAAC,GAAGF,MAAM,CACtDZ,sBACD,CAAC;AAED,MAAM;EAAEe;AAAuB,CAAC,GAAGH,MAAM,CAAER,uBAAwB,CAAC;AAEpE,eAAe,SAASY,kBAAkBA,CAAE;EAC3CC,mBA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D,cAAc,EAAG3C;EAAe,CAAE,CACjC,CAAC,EAEZhB,YAAY;EACb;EACA;EACAgD,aAAA;IAAMY,QAAQ,EAAKC,KAAK,IAAMA,KAAK,CAACC,cAAc,CAAC;EAAG,GACrDd,aAAA,CAAC7C,cAAc,MAAE,CACZ,CAAC,EACPsB,SAAS,CAACsC,gBAAgB,CAAE,CAAC,CAC9B,CACsB,CAAC,EAExBf,aAAA,CAAC1C,oCAAoC,QAClC,CAAE;IAAE0D;EAAQ,CAAC,KACdhB,aAAA,CAACtC,oBAAoB;IACpBe,SAAS,EAAGA,SAAW;IACvBwC,SAAS,EAAGD;EAAS,CACrB,CAEmC,CACrC,CAAC;AAEL","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/customize-widgets",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.35.0",
|
|
4
4
|
"description": "Widgets blocks in Customizer Module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -24,27 +24,27 @@
|
|
|
24
24
|
"react-native": "src/index",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.16.0",
|
|
27
|
-
"@wordpress/block-editor": "^12.
|
|
28
|
-
"@wordpress/block-library": "^8.
|
|
29
|
-
"@wordpress/blocks": "^12.
|
|
30
|
-
"@wordpress/components": "^27.
|
|
31
|
-
"@wordpress/compose": "^6.
|
|
32
|
-
"@wordpress/core-data": "^6.
|
|
33
|
-
"@wordpress/data": "^9.
|
|
34
|
-
"@wordpress/dom": "^3.
|
|
35
|
-
"@wordpress/element": "^5.
|
|
36
|
-
"@wordpress/hooks": "^3.
|
|
37
|
-
"@wordpress/i18n": "^4.
|
|
38
|
-
"@wordpress/icons": "^9.
|
|
39
|
-
"@wordpress/interface": "^5.
|
|
40
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
41
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
42
|
-
"@wordpress/keycodes": "^3.
|
|
43
|
-
"@wordpress/media-utils": "^4.
|
|
44
|
-
"@wordpress/preferences": "^3.
|
|
45
|
-
"@wordpress/private-apis": "^0.
|
|
46
|
-
"@wordpress/widgets": "^3.
|
|
47
|
-
"
|
|
27
|
+
"@wordpress/block-editor": "^12.26.0",
|
|
28
|
+
"@wordpress/block-library": "^8.35.0",
|
|
29
|
+
"@wordpress/blocks": "^12.35.0",
|
|
30
|
+
"@wordpress/components": "^27.6.0",
|
|
31
|
+
"@wordpress/compose": "^6.35.0",
|
|
32
|
+
"@wordpress/core-data": "^6.35.0",
|
|
33
|
+
"@wordpress/data": "^9.28.0",
|
|
34
|
+
"@wordpress/dom": "^3.58.0",
|
|
35
|
+
"@wordpress/element": "^5.35.0",
|
|
36
|
+
"@wordpress/hooks": "^3.58.0",
|
|
37
|
+
"@wordpress/i18n": "^4.58.0",
|
|
38
|
+
"@wordpress/icons": "^9.49.0",
|
|
39
|
+
"@wordpress/interface": "^5.35.0",
|
|
40
|
+
"@wordpress/is-shallow-equal": "^4.58.0",
|
|
41
|
+
"@wordpress/keyboard-shortcuts": "^4.35.0",
|
|
42
|
+
"@wordpress/keycodes": "^3.58.0",
|
|
43
|
+
"@wordpress/media-utils": "^4.49.0",
|
|
44
|
+
"@wordpress/preferences": "^3.35.0",
|
|
45
|
+
"@wordpress/private-apis": "^0.40.0",
|
|
46
|
+
"@wordpress/widgets": "^3.35.0",
|
|
47
|
+
"clsx": "^2.1.1",
|
|
48
48
|
"fast-deep-equal": "^3.1.3"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "42f38f287506a6b3ed8ccba839b18ad066821044"
|
|
58
58
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import clsx from 'clsx';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -44,7 +44,7 @@ function Header( {
|
|
|
44
44
|
return (
|
|
45
45
|
<>
|
|
46
46
|
<div
|
|
47
|
-
className={
|
|
47
|
+
className={ clsx( 'customize-widgets-header', {
|
|
48
48
|
'is-fixed-toolbar-active': isFixedToolbarActive,
|
|
49
49
|
} ) }
|
|
50
50
|
>
|
|
@@ -37,7 +37,16 @@ export const textFormattingShortcuts = [
|
|
|
37
37
|
description: __( 'Make the selected text inline code.' ),
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
|
-
keyCombination: {
|
|
40
|
+
keyCombination: {
|
|
41
|
+
modifier: 'access',
|
|
42
|
+
character: '0',
|
|
43
|
+
},
|
|
44
|
+
aliases: [
|
|
45
|
+
{
|
|
46
|
+
modifier: 'access',
|
|
47
|
+
character: '7',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
41
50
|
description: __( 'Convert the current heading to a paragraph.' ),
|
|
42
51
|
},
|
|
43
52
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import clsx from 'clsx';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -49,7 +49,7 @@ const ShortcutList = ( { shortcuts } ) => (
|
|
|
49
49
|
|
|
50
50
|
const ShortcutSection = ( { title, shortcuts, className } ) => (
|
|
51
51
|
<section
|
|
52
|
-
className={
|
|
52
|
+
className={ clsx(
|
|
53
53
|
'customize-widgets-keyboard-shortcut-help-modal__section',
|
|
54
54
|
className
|
|
55
55
|
) }
|
|
@@ -7,44 +7,10 @@ import {
|
|
|
7
7
|
store as keyboardShortcutsStore,
|
|
8
8
|
} from '@wordpress/keyboard-shortcuts';
|
|
9
9
|
import { isAppleOS } from '@wordpress/keycodes';
|
|
10
|
-
import { useDispatch
|
|
10
|
+
import { useDispatch } from '@wordpress/data';
|
|
11
11
|
import { __ } from '@wordpress/i18n';
|
|
12
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
13
|
-
import { createBlock } from '@wordpress/blocks';
|
|
14
12
|
|
|
15
13
|
function KeyboardShortcuts( { undo, redo, save } ) {
|
|
16
|
-
const { replaceBlocks } = useDispatch( blockEditorStore );
|
|
17
|
-
const { getBlockName, getSelectedBlockClientId, getBlockAttributes } =
|
|
18
|
-
useSelect( blockEditorStore );
|
|
19
|
-
|
|
20
|
-
const handleTextLevelShortcut = ( event, level ) => {
|
|
21
|
-
event.preventDefault();
|
|
22
|
-
const destinationBlockName =
|
|
23
|
-
level === 0 ? 'core/paragraph' : 'core/heading';
|
|
24
|
-
const currentClientId = getSelectedBlockClientId();
|
|
25
|
-
if ( currentClientId === null ) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const blockName = getBlockName( currentClientId );
|
|
29
|
-
if ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const attributes = getBlockAttributes( currentClientId );
|
|
33
|
-
const textAlign =
|
|
34
|
-
blockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
35
|
-
const destinationTextAlign =
|
|
36
|
-
destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
37
|
-
|
|
38
|
-
replaceBlocks(
|
|
39
|
-
currentClientId,
|
|
40
|
-
createBlock( destinationBlockName, {
|
|
41
|
-
level,
|
|
42
|
-
content: attributes.content,
|
|
43
|
-
...{ [ destinationTextAlign ]: attributes[ textAlign ] },
|
|
44
|
-
} )
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
14
|
useShortcut( 'core/customize-widgets/undo', ( event ) => {
|
|
49
15
|
undo();
|
|
50
16
|
event.preventDefault();
|
|
@@ -60,21 +26,6 @@ function KeyboardShortcuts( { undo, redo, save } ) {
|
|
|
60
26
|
save();
|
|
61
27
|
} );
|
|
62
28
|
|
|
63
|
-
useShortcut(
|
|
64
|
-
'core/customize-widgets/transform-heading-to-paragraph',
|
|
65
|
-
( event ) => handleTextLevelShortcut( event, 0 )
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
|
|
69
|
-
//the loop is based off on a constant therefore
|
|
70
|
-
//the hook will execute the same way every time
|
|
71
|
-
//eslint-disable-next-line react-hooks/rules-of-hooks
|
|
72
|
-
useShortcut(
|
|
73
|
-
`core/customize-widgets/transform-paragraph-to-heading-${ level }`,
|
|
74
|
-
( event ) => handleTextLevelShortcut( event, level )
|
|
75
|
-
);
|
|
76
|
-
} );
|
|
77
|
-
|
|
78
29
|
return null;
|
|
79
30
|
}
|
|
80
31
|
|
|
@@ -126,28 +77,6 @@ function KeyboardShortcutsRegister() {
|
|
|
126
77
|
},
|
|
127
78
|
} );
|
|
128
79
|
|
|
129
|
-
registerShortcut( {
|
|
130
|
-
name: 'core/customize-widgets/transform-heading-to-paragraph',
|
|
131
|
-
category: 'block-library',
|
|
132
|
-
description: __( 'Transform heading to paragraph.' ),
|
|
133
|
-
keyCombination: {
|
|
134
|
-
modifier: 'access',
|
|
135
|
-
character: `0`,
|
|
136
|
-
},
|
|
137
|
-
} );
|
|
138
|
-
|
|
139
|
-
[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
|
|
140
|
-
registerShortcut( {
|
|
141
|
-
name: `core/customize-widgets/transform-paragraph-to-heading-${ level }`,
|
|
142
|
-
category: 'block-library',
|
|
143
|
-
description: __( 'Transform paragraph to heading.' ),
|
|
144
|
-
keyCombination: {
|
|
145
|
-
modifier: 'access',
|
|
146
|
-
character: `${ level }`,
|
|
147
|
-
},
|
|
148
|
-
} );
|
|
149
|
-
} );
|
|
150
|
-
|
|
151
80
|
return () => {
|
|
152
81
|
unregisterShortcut( 'core/customize-widgets/undo' );
|
|
153
82
|
unregisterShortcut( 'core/customize-widgets/redo' );
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from '@wordpress/block-editor';
|
|
15
15
|
import { uploadMedia } from '@wordpress/media-utils';
|
|
16
16
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
17
|
+
import { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Internal dependencies
|
|
@@ -31,6 +32,8 @@ const { ExperimentalBlockCanvas: BlockCanvas } = unlock(
|
|
|
31
32
|
blockEditorPrivateApis
|
|
32
33
|
);
|
|
33
34
|
|
|
35
|
+
const { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );
|
|
36
|
+
|
|
34
37
|
export default function SidebarBlockEditor( {
|
|
35
38
|
blockEditorSettings,
|
|
36
39
|
sidebar,
|
|
@@ -99,6 +102,7 @@ export default function SidebarBlockEditor( {
|
|
|
99
102
|
return (
|
|
100
103
|
<>
|
|
101
104
|
<KeyboardShortcuts.Register />
|
|
105
|
+
<BlockKeyboardShortcuts />
|
|
102
106
|
|
|
103
107
|
<SidebarEditorProvider sidebar={ sidebar } settings={ settings }>
|
|
104
108
|
<KeyboardShortcuts
|