@wordpress/customize-widgets 4.32.0 → 4.34.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/block-appender/index.js.map +1 -1
- package/build/components/block-inspector-button/index.js.map +1 -1
- package/build/components/customize-widgets/index.js.map +1 -1
- package/build/components/customize-widgets/use-clear-selected-block.js.map +1 -1
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/focus-control/index.js.map +1 -1
- package/build/components/focus-control/use-blocks-focus-control.js.map +1 -1
- package/build/components/header/index.js.map +1 -1
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/use-inserter.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/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.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/more-menu/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/components/sidebar-block-editor/sidebar-adapter.js.map +1 -1
- package/build/components/sidebar-block-editor/sidebar-editor-provider.js.map +1 -1
- package/build/components/sidebar-block-editor/use-sidebar-block-editor.js.map +1 -1
- package/build/components/sidebar-controls/index.js.map +1 -1
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/controls/inserter-outer-section.js.map +1 -1
- package/build/controls/inspector-section.js.map +1 -1
- package/build/controls/sidebar-control.js.map +1 -1
- package/build/controls/sidebar-section.js.map +1 -1
- package/build/filters/index.js.map +1 -1
- package/build/filters/move-to-sidebar.js.map +1 -1
- package/build/filters/replace-media-upload.js.map +1 -1
- package/build/filters/wide-widget-display.js.map +1 -1
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/index.js +1 -1
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build/utils.js.map +1 -1
- package/build-module/components/block-appender/index.js.map +1 -1
- package/build-module/components/block-inspector-button/index.js.map +1 -1
- package/build-module/components/customize-widgets/index.js.map +1 -1
- package/build-module/components/customize-widgets/use-clear-selected-block.js.map +1 -1
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/focus-control/index.js.map +1 -1
- package/build-module/components/focus-control/use-blocks-focus-control.js.map +1 -1
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/use-inserter.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/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.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/more-menu/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/build-module/components/sidebar-block-editor/sidebar-adapter.js.map +1 -1
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js.map +1 -1
- package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.js.map +1 -1
- package/build-module/components/sidebar-controls/index.js.map +1 -1
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/controls/inserter-outer-section.js.map +1 -1
- package/build-module/controls/inspector-section.js.map +1 -1
- package/build-module/controls/sidebar-control.js.map +1 -1
- package/build-module/controls/sidebar-section.js.map +1 -1
- package/build-module/filters/index.js.map +1 -1
- package/build-module/filters/move-to-sidebar.js.map +1 -1
- package/build-module/filters/replace-media-upload.js.map +1 -1
- package/build-module/filters/wide-widget-display.js.map +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils.js.map +1 -1
- package/build-style/style-rtl.css +1 -1
- package/build-style/style.css +1 -1
- package/package.json +22 -22
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -1
- package/src/components/keyboard-shortcuts/index.js +1 -72
- package/src/components/sidebar-block-editor/index.js +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["serialize","parse","createBlock","addWidgetIdToBlock","settingIdToWidgetId","settingId","matches","match","idBase","number","parseInt","blockToWidget","block","existingWidget","widget","isValidLegacyWidgetBlock","name","attributes","id","instance","encoded","hash","raw","rest","is_widget_customizer_js_value","encoded_serialized_instance","instance_hash_key","raw_instance","content","widgetClass","form","rendered","restExistingWidget","widgetToBlock","_raw$content","parsedBlocks","__unstableSkipAutop","length"],"sources":["@wordpress/customize-widgets/src/utils.js"],"sourcesContent":["// @ts-check\n/**\n * WordPress dependencies\n */\nimport { serialize, parse, createBlock } from '@wordpress/blocks';\nimport { addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Convert settingId to widgetId.\n *\n * @param {string} settingId The setting id.\n * @return {string} The widget id.\n */\nexport function settingIdToWidgetId( settingId ) {\n\tconst matches = settingId.match( /^widget_(.+)(?:\\[(\\d+)\\])$/ );\n\n\tif ( matches ) {\n\t\tconst idBase = matches[ 1 ];\n\t\tconst number = parseInt( matches[ 2 ], 10 );\n\n\t\treturn `${ idBase }-${ number }`;\n\t}\n\n\treturn settingId;\n}\n\n/**\n * Transform a block to a customizable widget.\n *\n * @param {WPBlock} block The block to be transformed from.\n * @param {Object} existingWidget The widget to be extended from.\n * @return {Object} The transformed widget.\n */\nexport function blockToWidget( block, existingWidget = null ) {\n\tlet widget;\n\n\tconst isValidLegacyWidgetBlock =\n\t\tblock.name === 'core/legacy-widget' &&\n\t\t( block.attributes.id || block.attributes.instance );\n\n\tif ( isValidLegacyWidgetBlock ) {\n\t\tif ( block.attributes.id ) {\n\t\t\t// Widget that does not extend WP_Widget.\n\t\t\twidget = {\n\t\t\t\tid: block.attributes.id,\n\t\t\t};\n\t\t} else {\n\t\t\tconst { encoded, hash, raw, ...rest } = block.attributes.instance;\n\n\t\t\t// Widget that extends WP_Widget.\n\t\t\twidget = {\n\t\t\t\tidBase: block.attributes.idBase,\n\t\t\t\tinstance: {\n\t\t\t\t\t...existingWidget?.instance,\n\t\t\t\t\t// Required only for the customizer.\n\t\t\t\t\tis_widget_customizer_js_value: true,\n\t\t\t\t\tencoded_serialized_instance: encoded,\n\t\t\t\t\tinstance_hash_key: hash,\n\t\t\t\t\traw_instance: raw,\n\t\t\t\t\t...rest,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t} else {\n\t\tconst instance = {\n\t\t\tcontent: serialize( block ),\n\t\t};\n\t\twidget = {\n\t\t\tidBase: 'block',\n\t\t\twidgetClass: 'WP_Widget_Block',\n\t\t\tinstance: {\n\t\t\t\traw_instance: instance,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst { form, rendered, ...restExistingWidget } = existingWidget || {};\n\n\treturn {\n\t\t...restExistingWidget,\n\t\t...widget,\n\t};\n}\n\n/**\n * Transform a widget to a block.\n *\n * @param {Object} widget The widget to be transformed from.\n * @param {string} widget.id The widget id.\n * @param {string} widget.idBase The id base of the widget.\n * @param {number} widget.number The number/index of the widget.\n * @param {Object} widget.instance The instance of the widget.\n * @return {WPBlock} The transformed block.\n */\nexport function widgetToBlock( { id, idBase, number, instance } ) {\n\tlet block;\n\n\tconst {\n\t\tencoded_serialized_instance: encoded,\n\t\tinstance_hash_key: hash,\n\t\traw_instance: raw,\n\t\t...rest\n\t} = instance;\n\n\tif ( idBase === 'block' ) {\n\t\tconst parsedBlocks = parse( raw.content ?? '', {\n\t\t\t__unstableSkipAutop: true,\n\t\t} );\n\t\tblock = parsedBlocks.length\n\t\t\t? parsedBlocks[ 0 ]\n\t\t\t: createBlock( 'core/paragraph', {} );\n\t} else if ( number ) {\n\t\t// Widget that extends WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tidBase,\n\t\t\tinstance: {\n\t\t\t\tencoded,\n\t\t\t\thash,\n\t\t\t\traw,\n\t\t\t\t...rest,\n\t\t\t},\n\t\t} );\n\t} else {\n\t\t// Widget that does not extend WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tid,\n\t\t} );\n\t}\n\n\treturn addWidgetIdToBlock( block, id );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,KAAK,EAAEC,WAAW,QAAQ,mBAAmB;AACjE,SAASC,kBAAkB,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAEC,SAAS,EAAG;EAChD,MAAMC,OAAO,GAAGD,SAAS,CAACE,KAAK,CAAE,4BAA6B,CAAC;EAE/D,IAAKD,OAAO,EAAG;IACd,MAAME,MAAM,GAAGF,OAAO,CAAE,CAAC,CAAE;IAC3B,MAAMG,MAAM,GAAGC,QAAQ,CAAEJ,OAAO,CAAE,CAAC,CAAE,EAAE,EAAG,CAAC;IAE3C,OAAQ,GAAGE,MAAQ,IAAIC,MAAQ,EAAC;EACjC;EAEA,OAAOJ,SAAS;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,aAAaA,CAAEC,KAAK,EAAEC,cAAc,GAAG,IAAI,EAAG;EAC7D,IAAIC,MAAM;EAEV,MAAMC,wBAAwB,GAC7BH,KAAK,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AAIP,KAAK;EAET,MAAM;IACLa,2BAA2B,EAAEL,OAAO;IACpCM,iBAAiB,EAAEL,IAAI;IACvBM,YAAY,EAAEL,GAAG;IACjB,GAAGC;EACJ,CAAC,GAAGJ,QAAQ;EAEZ,IAAKX,MAAM,KAAK,OAAO,EAAG;IAAA,IAAA0B,YAAA;IACzB,MAAMC,YAAY,GAAGlC,KAAK,EAAAiC,YAAA,GAAEZ,GAAG,CAACM,OAAO,cAAAM,YAAA,cAAAA,YAAA,GAAI,EAAE,EAAE;MAC9CE,mBAAmB,EAAE;IACtB,CAAE,CAAC;IACHxB,KAAK,GAAGuB,YAAY,CAACE,MAAM,GACxBF,YAAY,CAAE,CAAC,CAAE,GACjBjC,WAAW,CAAE,gBAAgB,EAAE,CAAC,CAAE,CAAC;EACvC,CAAC,MAAM,IAAKO,MAAM,EAAG;IACpB;IACAG,KAAK,GAAGV,WAAW,CAAE,oBAAoB,EAAE;MAC1CM,MAAM;MACNW,QAAQ,EAAE;QACTC,OAAO;QACPC,IAAI;QACJC,GAAG;QACH,GAAGC;MACJ;IACD,CAAE,CAAC;EACJ,CAAC,MAAM;IACN;IACAX,KAAK,GAAGV,WAAW,CAAE,oBAAoB,EAAE;MAC1CgB;IACD,CAAE,CAAC;EACJ;EAEA,OAAOf,kBAAkB,CAAES,KAAK,EAAEM,EAAG,CAAC;AACvC"}
|
|
1
|
+
{"version":3,"names":["serialize","parse","createBlock","addWidgetIdToBlock","settingIdToWidgetId","settingId","matches","match","idBase","number","parseInt","blockToWidget","block","existingWidget","widget","isValidLegacyWidgetBlock","name","attributes","id","instance","encoded","hash","raw","rest","is_widget_customizer_js_value","encoded_serialized_instance","instance_hash_key","raw_instance","content","widgetClass","form","rendered","restExistingWidget","widgetToBlock","_raw$content","parsedBlocks","__unstableSkipAutop","length"],"sources":["@wordpress/customize-widgets/src/utils.js"],"sourcesContent":["// @ts-check\n/**\n * WordPress dependencies\n */\nimport { serialize, parse, createBlock } from '@wordpress/blocks';\nimport { addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Convert settingId to widgetId.\n *\n * @param {string} settingId The setting id.\n * @return {string} The widget id.\n */\nexport function settingIdToWidgetId( settingId ) {\n\tconst matches = settingId.match( /^widget_(.+)(?:\\[(\\d+)\\])$/ );\n\n\tif ( matches ) {\n\t\tconst idBase = matches[ 1 ];\n\t\tconst number = parseInt( matches[ 2 ], 10 );\n\n\t\treturn `${ idBase }-${ number }`;\n\t}\n\n\treturn settingId;\n}\n\n/**\n * Transform a block to a customizable widget.\n *\n * @param {WPBlock} block The block to be transformed from.\n * @param {Object} existingWidget The widget to be extended from.\n * @return {Object} The transformed widget.\n */\nexport function blockToWidget( block, existingWidget = null ) {\n\tlet widget;\n\n\tconst isValidLegacyWidgetBlock =\n\t\tblock.name === 'core/legacy-widget' &&\n\t\t( block.attributes.id || block.attributes.instance );\n\n\tif ( isValidLegacyWidgetBlock ) {\n\t\tif ( block.attributes.id ) {\n\t\t\t// Widget that does not extend WP_Widget.\n\t\t\twidget = {\n\t\t\t\tid: block.attributes.id,\n\t\t\t};\n\t\t} else {\n\t\t\tconst { encoded, hash, raw, ...rest } = block.attributes.instance;\n\n\t\t\t// Widget that extends WP_Widget.\n\t\t\twidget = {\n\t\t\t\tidBase: block.attributes.idBase,\n\t\t\t\tinstance: {\n\t\t\t\t\t...existingWidget?.instance,\n\t\t\t\t\t// Required only for the customizer.\n\t\t\t\t\tis_widget_customizer_js_value: true,\n\t\t\t\t\tencoded_serialized_instance: encoded,\n\t\t\t\t\tinstance_hash_key: hash,\n\t\t\t\t\traw_instance: raw,\n\t\t\t\t\t...rest,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t} else {\n\t\tconst instance = {\n\t\t\tcontent: serialize( block ),\n\t\t};\n\t\twidget = {\n\t\t\tidBase: 'block',\n\t\t\twidgetClass: 'WP_Widget_Block',\n\t\t\tinstance: {\n\t\t\t\traw_instance: instance,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst { form, rendered, ...restExistingWidget } = existingWidget || {};\n\n\treturn {\n\t\t...restExistingWidget,\n\t\t...widget,\n\t};\n}\n\n/**\n * Transform a widget to a block.\n *\n * @param {Object} widget The widget to be transformed from.\n * @param {string} widget.id The widget id.\n * @param {string} widget.idBase The id base of the widget.\n * @param {number} widget.number The number/index of the widget.\n * @param {Object} widget.instance The instance of the widget.\n * @return {WPBlock} The transformed block.\n */\nexport function widgetToBlock( { id, idBase, number, instance } ) {\n\tlet block;\n\n\tconst {\n\t\tencoded_serialized_instance: encoded,\n\t\tinstance_hash_key: hash,\n\t\traw_instance: raw,\n\t\t...rest\n\t} = instance;\n\n\tif ( idBase === 'block' ) {\n\t\tconst parsedBlocks = parse( raw.content ?? '', {\n\t\t\t__unstableSkipAutop: true,\n\t\t} );\n\t\tblock = parsedBlocks.length\n\t\t\t? parsedBlocks[ 0 ]\n\t\t\t: createBlock( 'core/paragraph', {} );\n\t} else if ( number ) {\n\t\t// Widget that extends WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tidBase,\n\t\t\tinstance: {\n\t\t\t\tencoded,\n\t\t\t\thash,\n\t\t\t\traw,\n\t\t\t\t...rest,\n\t\t\t},\n\t\t} );\n\t} else {\n\t\t// Widget that does not extend WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tid,\n\t\t} );\n\t}\n\n\treturn addWidgetIdToBlock( block, id );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,KAAK,EAAEC,WAAW,QAAQ,mBAAmB;AACjE,SAASC,kBAAkB,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAEC,SAAS,EAAG;EAChD,MAAMC,OAAO,GAAGD,SAAS,CAACE,KAAK,CAAE,4BAA6B,CAAC;EAE/D,IAAKD,OAAO,EAAG;IACd,MAAME,MAAM,GAAGF,OAAO,CAAE,CAAC,CAAE;IAC3B,MAAM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
|
|
97
97
|
--wp-block-synced-color: #7a00df;
|
|
98
98
|
--wp-block-synced-color--rgb: 122, 0, 223;
|
|
99
|
-
--wp-bound-block-color:
|
|
99
|
+
--wp-bound-block-color: var(--wp-block-synced-color);
|
|
100
100
|
}
|
|
101
101
|
@media (min-resolution: 192dpi) {
|
|
102
102
|
:root {
|
package/build-style/style.css
CHANGED
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
--wp-admin-border-width-focus: 2px;
|
|
97
97
|
--wp-block-synced-color: #7a00df;
|
|
98
98
|
--wp-block-synced-color--rgb: 122, 0, 223;
|
|
99
|
-
--wp-bound-block-color:
|
|
99
|
+
--wp-bound-block-color: var(--wp-block-synced-color);
|
|
100
100
|
}
|
|
101
101
|
@media (min-resolution: 192dpi) {
|
|
102
102
|
:root {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/customize-widgets",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.34.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,26 +24,26 @@
|
|
|
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.
|
|
27
|
+
"@wordpress/block-editor": "^12.25.0",
|
|
28
|
+
"@wordpress/block-library": "^8.34.0",
|
|
29
|
+
"@wordpress/blocks": "^12.34.0",
|
|
30
|
+
"@wordpress/components": "^27.5.0",
|
|
31
|
+
"@wordpress/compose": "^6.34.0",
|
|
32
|
+
"@wordpress/core-data": "^6.34.0",
|
|
33
|
+
"@wordpress/data": "^9.27.0",
|
|
34
|
+
"@wordpress/dom": "^3.57.0",
|
|
35
|
+
"@wordpress/element": "^5.34.0",
|
|
36
|
+
"@wordpress/hooks": "^3.57.0",
|
|
37
|
+
"@wordpress/i18n": "^4.57.0",
|
|
38
|
+
"@wordpress/icons": "^9.48.0",
|
|
39
|
+
"@wordpress/interface": "^5.34.0",
|
|
40
|
+
"@wordpress/is-shallow-equal": "^4.57.0",
|
|
41
|
+
"@wordpress/keyboard-shortcuts": "^4.34.0",
|
|
42
|
+
"@wordpress/keycodes": "^3.57.0",
|
|
43
|
+
"@wordpress/media-utils": "^4.48.0",
|
|
44
|
+
"@wordpress/preferences": "^3.34.0",
|
|
45
|
+
"@wordpress/private-apis": "^0.39.0",
|
|
46
|
+
"@wordpress/widgets": "^3.34.0",
|
|
47
47
|
"classnames": "^2.3.1",
|
|
48
48
|
"fast-deep-equal": "^3.1.3"
|
|
49
49
|
},
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "581d8a5580dba8f600b7268d51eb554771ae482c"
|
|
58
58
|
}
|
|
@@ -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
|
{
|
|
@@ -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
|