@wordpress/customize-widgets 3.17.0 → 3.18.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 +2 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -7
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/filters/move-to-sidebar.js +1 -7
- package/build/filters/move-to-sidebar.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -6
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/filters/move-to-sidebar.js +1 -6
- package/build-module/filters/move-to-sidebar.js.map +1 -1
- package/package.json +21 -21
- package/src/components/keyboard-shortcut-help-modal/shortcut.js +15 -18
- package/src/filters/move-to-sidebar.js +1 -6
package/CHANGELOG.md
CHANGED
|
@@ -7,14 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _element = require("@wordpress/element");
|
|
9
9
|
|
|
10
|
-
var _lodash = require("lodash");
|
|
11
|
-
|
|
12
10
|
var _keycodes = require("@wordpress/keycodes");
|
|
13
11
|
|
|
14
|
-
/**
|
|
15
|
-
* External dependencies
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
12
|
/**
|
|
19
13
|
* WordPress dependencies
|
|
20
14
|
*/
|
|
@@ -28,7 +22,7 @@ function KeyCombination(_ref) {
|
|
|
28
22
|
return (0, _element.createElement)("kbd", {
|
|
29
23
|
className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination",
|
|
30
24
|
"aria-label": forceAriaLabel || ariaLabel
|
|
31
|
-
}, (
|
|
25
|
+
}, (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => {
|
|
32
26
|
if (character === '+') {
|
|
33
27
|
return (0, _element.createElement)(_element.Fragment, {
|
|
34
28
|
key: index
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/shortcut.js"],"names":["KeyCombination","keyCombination","forceAriaLabel","shortcut","modifier","displayShortcutList","character","ariaLabel","shortcutAriaLabel","map","index","Shortcut","description","aliases","alias"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/shortcut.js"],"names":["KeyCombination","keyCombination","forceAriaLabel","shortcut","modifier","displayShortcutList","character","ariaLabel","shortcutAriaLabel","Array","isArray","map","index","Shortcut","description","aliases","alias"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,SAASA,cAAT,OAA8D;AAAA,MAArC;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,GAAqC;AAC7D,QAAMC,QAAQ,GAAGF,cAAc,CAACG,QAAf,GACdC,8BAAqBJ,cAAc,CAACG,QAApC,EACAH,cAAc,CAACK,SADf,CADc,GAIdL,cAAc,CAACK,SAJlB;AAKA,QAAMC,SAAS,GAAGN,cAAc,CAACG,QAAf,GACfI,4BAAmBP,cAAc,CAACG,QAAlC,EACAH,cAAc,CAACK,SADf,CADe,GAIfL,cAAc,CAACK,SAJlB;AAMA,SACC;AACC,IAAA,SAAS,EAAC,0EADX;AAEC,kBAAaJ,cAAc,IAAIK;AAFhC,KAIG,CAAEE,KAAK,CAACC,OAAN,CAAeP,QAAf,IAA4BA,QAA5B,GAAuC,CAAEA,QAAF,CAAzC,EAAwDQ,GAAxD,CACD,CAAEL,SAAF,EAAaM,KAAb,KAAwB;AACvB,QAAKN,SAAS,KAAK,GAAnB,EAAyB;AACxB,aAAO,4BAAC,iBAAD;AAAU,QAAA,GAAG,EAAGM;AAAhB,SAA0BN,SAA1B,CAAP;AACA;;AAED,WACC;AACC,MAAA,GAAG,EAAGM,KADP;AAEC,MAAA,SAAS,EAAC;AAFX,OAIGN,SAJH,CADD;AAQA,GAdA,CAJH,CADD;AAuBA;;AAED,SAASO,QAAT,QAA8E;AAAA,MAA3D;AAAEC,IAAAA,WAAF;AAAeb,IAAAA,cAAf;AAA+Bc,IAAAA,OAAO,GAAG,EAAzC;AAA6CR,IAAAA;AAA7C,GAA2D;AAC7E,SACC,qDACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGO,WADH,CADD,EAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,cAAD;AACC,IAAA,cAAc,EAAGb,cADlB;AAEC,IAAA,cAAc,EAAGM;AAFlB,IADD,EAKGQ,OAAO,CAACJ,GAAR,CAAa,CAAEK,KAAF,EAASJ,KAAT,KACd,4BAAC,cAAD;AACC,IAAA,cAAc,EAAGI,KADlB;AAEC,IAAA,cAAc,EAAGT,SAFlB;AAGC,IAAA,GAAG,EAAGK;AAHP,IADC,CALH,CAJD,CADD;AAoBA;;eAEcC,Q","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';\n\nfunction KeyCombination( { keyCombination, forceAriaLabel } ) {\n\tconst shortcut = keyCombination.modifier\n\t\t? displayShortcutList[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t )\n\t\t: keyCombination.character;\n\tconst ariaLabel = keyCombination.modifier\n\t\t? shortcutAriaLabel[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t )\n\t\t: keyCombination.character;\n\n\treturn (\n\t\t<kbd\n\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination\"\n\t\t\taria-label={ forceAriaLabel || ariaLabel }\n\t\t>\n\t\t\t{ ( Array.isArray( shortcut ) ? shortcut : [ shortcut ] ).map(\n\t\t\t\t( character, index ) => {\n\t\t\t\t\tif ( character === '+' ) {\n\t\t\t\t\t\treturn <Fragment key={ index }>{ character }</Fragment>;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<kbd\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-key\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ character }\n\t\t\t\t\t\t</kbd>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t) }\n\t\t</kbd>\n\t);\n}\n\nfunction Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-description\">\n\t\t\t\t{ description }\n\t\t\t</div>\n\t\t\t<div className=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-term\">\n\t\t\t\t<KeyCombination\n\t\t\t\t\tkeyCombination={ keyCombination }\n\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t/>\n\t\t\t\t{ aliases.map( ( alias, index ) => (\n\t\t\t\t\t<KeyCombination\n\t\t\t\t\t\tkeyCombination={ alias }\n\t\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Shortcut;\n"]}
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _element = require("@wordpress/element");
|
|
4
4
|
|
|
5
|
-
var _lodash = require("lodash");
|
|
6
|
-
|
|
7
5
|
var _blockEditor = require("@wordpress/block-editor");
|
|
8
6
|
|
|
9
7
|
var _compose = require("@wordpress/compose");
|
|
@@ -20,10 +18,6 @@ var _focusControl = require("../components/focus-control");
|
|
|
20
18
|
|
|
21
19
|
var _utils = require("../utils");
|
|
22
20
|
|
|
23
|
-
/**
|
|
24
|
-
* External dependencies
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
21
|
/**
|
|
28
22
|
* WordPress dependencies
|
|
29
23
|
*/
|
|
@@ -58,7 +52,7 @@ const withMoveToSidebarToolbarItem = (0, _compose.createHigherOrderComponent)(Bl
|
|
|
58
52
|
*/
|
|
59
53
|
const oldSetting = activeSidebarControl.setting;
|
|
60
54
|
const newSetting = newSidebarControl.setting;
|
|
61
|
-
oldSetting((
|
|
55
|
+
oldSetting(oldSetting().filter(id => id !== widgetId));
|
|
62
56
|
newSetting([...newSetting(), widgetId]);
|
|
63
57
|
} else {
|
|
64
58
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/filters/move-to-sidebar.js"],"names":["withMoveToSidebarToolbarItem","BlockEdit","props","widgetId","sidebarControls","activeSidebarControl","hasMultipleSidebars","length","blockName","name","clientId","canInsertBlockInSidebar","select","blockEditorStore","canInsertBlockType","block","getBlock","removeBlock","focusWidget","moveToSidebar","sidebarControlId","newSidebarControl","find","sidebarControl","id","oldSetting","setting","newSetting","sidebarAdapter","addedWidgetIds","setWidgets","getWidgets","reverse","map","params","label","description"],"mappings":";;;;AAGA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/filters/move-to-sidebar.js"],"names":["withMoveToSidebarToolbarItem","BlockEdit","props","widgetId","sidebarControls","activeSidebarControl","hasMultipleSidebars","length","blockName","name","clientId","canInsertBlockInSidebar","select","blockEditorStore","canInsertBlockType","block","getBlock","removeBlock","focusWidget","moveToSidebar","sidebarControlId","newSidebarControl","find","sidebarControl","id","oldSetting","setting","newSetting","filter","sidebarAdapter","addedWidgetIds","setWidgets","getWidgets","reverse","map","params","label","description"],"mappings":";;;;AAGA;;AAIA;;AACA;;AACA;;AACA;;AAKA;;AAIA;;AACA;;AApBA;AACA;AACA;;AAUA;AACA;AACA;AAQA,MAAMA,4BAA4B,GAAG,yCAClCC,SAAF,IAAmBC,KAAF,IAAa;AAC7B,MAAIC,QAAQ,GAAG,mCAAsBD,KAAtB,CAAf;AACA,QAAME,eAAe,GAAG,0CAAxB;AACA,QAAMC,oBAAoB,GAAG,+CAA7B;AACA,QAAMC,mBAAmB,GAAG,CAAAF,eAAe,SAAf,IAAAA,eAAe,WAAf,YAAAA,eAAe,CAAEG,MA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G,UAAf,EAD8C,EAEjD,0BAAejB,KAAf,CAFiD,CAA3B,CAAvB,CATM,CAaN;;AACAZ,MAAAA,QAAQ,GAAG2B,cAAc,CAACG,OAAf,GAAyBX,IAAzB,CAAiCE,EAAF,IAAU,CAAC,CAAEA,EAA5C,CAAX;AACA,KA7ByC,CA+B1C;;;AACAN,IAAAA,WAAW,CAAEf,QAAF,CAAX;AACA;;AAED,SACC,qDACC,4BAAC,SAAD,EAAgBD,KAAhB,CADD,EAEGI,mBAAmB,IAAIK,uBAAvB,IACD,4BAAC,0BAAD,QACC,4BAAC,yBAAD;AACC,IAAA,WAAW,EAAGP,eAAe,CAAC8B,GAAhB,CACXX,cAAF,KAAwB;AACvBC,MAAAA,EAAE,EAAED,cAAc,CAACC,EADI;AAEvBf,MAAAA,IAAI,EAAEc,cAAc,CAACY,MAAf,CAAsBC,KAFL;AAGvBC,MAAAA,WAAW,EACVd,cAAc,CAACY,MAAf,CAAsBE;AAJA,KAAxB,CADa,CADf;AASC,IAAA,mBAAmB,EAAGhC,oBAAH,aAAGA,oBAAH,uBAAGA,oBAAoB,CAAEmB,EAT7C;AAUC,IAAA,QAAQ,EAAGL;AAVZ,IADD,CAHF,CADD;AAqBA,CAlFmC,EAmFpC,8BAnFoC,CAArC;AAsFA,sBACC,kBADD,EAEC,mCAFD,EAGCnB,4BAHD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { MoveToWidgetArea, getWidgetIdFromBlock } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseSidebarControls,\n\tuseActiveSidebarControl,\n} from '../components/sidebar-controls';\nimport { useFocusControl } from '../components/focus-control';\nimport { blockToWidget } from '../utils';\n\nconst withMoveToSidebarToolbarItem = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tlet widgetId = getWidgetIdFromBlock( props );\n\t\tconst sidebarControls = useSidebarControls();\n\t\tconst activeSidebarControl = useActiveSidebarControl();\n\t\tconst hasMultipleSidebars = sidebarControls?.length > 1;\n\t\tconst blockName = props.name;\n\t\tconst clientId = props.clientId;\n\t\tconst canInsertBlockInSidebar = useSelect(\n\t\t\t( select ) => {\n\t\t\t\t// Use an empty string to represent the root block list, which\n\t\t\t\t// in the customizer editor represents a sidebar/widget area.\n\t\t\t\treturn select( blockEditorStore ).canInsertBlockType(\n\t\t\t\t\tblockName,\n\t\t\t\t\t''\n\t\t\t\t);\n\t\t\t},\n\t\t\t[ blockName ]\n\t\t);\n\t\tconst block = useSelect(\n\t\t\t( select ) => select( blockEditorStore ).getBlock( clientId ),\n\t\t\t[ clientId ]\n\t\t);\n\t\tconst { removeBlock } = useDispatch( blockEditorStore );\n\t\tconst [ , focusWidget ] = useFocusControl();\n\n\t\tfunction moveToSidebar( sidebarControlId ) {\n\t\t\tconst newSidebarControl = sidebarControls.find(\n\t\t\t\t( sidebarControl ) => sidebarControl.id === sidebarControlId\n\t\t\t);\n\n\t\t\tif ( widgetId ) {\n\t\t\t\t/**\n\t\t\t\t * If there's a widgetId, move it to the other sidebar.\n\t\t\t\t */\n\t\t\t\tconst oldSetting = activeSidebarControl.setting;\n\t\t\t\tconst newSetting = newSidebarControl.setting;\n\n\t\t\t\toldSetting( oldSetting().filter( ( id ) => id !== widgetId ) );\n\t\t\t\tnewSetting( [ ...newSetting(), widgetId ] );\n\t\t\t} else {\n\t\t\t\t/**\n\t\t\t\t * If there isn't a widgetId, it's most likely a inner block.\n\t\t\t\t * First, remove the block in the original sidebar,\n\t\t\t\t * then, create a new widget in the new sidebar and get back its widgetId.\n\t\t\t\t */\n\t\t\t\tconst sidebarAdapter = newSidebarControl.sidebarAdapter;\n\n\t\t\t\tremoveBlock( clientId );\n\t\t\t\tconst addedWidgetIds = sidebarAdapter.setWidgets( [\n\t\t\t\t\t...sidebarAdapter.getWidgets(),\n\t\t\t\t\tblockToWidget( block ),\n\t\t\t\t] );\n\t\t\t\t// The last non-null id is the added widget's id.\n\t\t\t\twidgetId = addedWidgetIds.reverse().find( ( id ) => !! id );\n\t\t\t}\n\n\t\t\t// Move focus to the moved widget and expand the sidebar.\n\t\t\tfocusWidget( widgetId );\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ hasMultipleSidebars && canInsertBlockInSidebar && (\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<MoveToWidgetArea\n\t\t\t\t\t\t\twidgetAreas={ sidebarControls.map(\n\t\t\t\t\t\t\t\t( sidebarControl ) => ( {\n\t\t\t\t\t\t\t\t\tid: sidebarControl.id,\n\t\t\t\t\t\t\t\t\tname: sidebarControl.params.label,\n\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\tsidebarControl.params.description,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tcurrentWidgetAreaId={ activeSidebarControl?.id }\n\t\t\t\t\t\t\tonSelect={ moveToSidebar }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withMoveToSidebarToolbarItem'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/customize-widgets/block-edit',\n\twithMoveToSidebarToolbarItem\n);\n"]}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { castArray } from 'lodash';
|
|
7
3
|
/**
|
|
8
4
|
* WordPress dependencies
|
|
9
5
|
*/
|
|
10
|
-
|
|
11
6
|
import { Fragment } from '@wordpress/element';
|
|
12
7
|
import { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';
|
|
13
8
|
|
|
@@ -21,7 +16,7 @@ function KeyCombination(_ref) {
|
|
|
21
16
|
return createElement("kbd", {
|
|
22
17
|
className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination",
|
|
23
18
|
"aria-label": forceAriaLabel || ariaLabel
|
|
24
|
-
},
|
|
19
|
+
}, (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => {
|
|
25
20
|
if (character === '+') {
|
|
26
21
|
return createElement(Fragment, {
|
|
27
22
|
key: index
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/shortcut.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/shortcut.js"],"names":["Fragment","displayShortcutList","shortcutAriaLabel","KeyCombination","keyCombination","forceAriaLabel","shortcut","modifier","character","ariaLabel","Array","isArray","map","index","Shortcut","description","aliases","alias"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;AACA,SAASC,mBAAT,EAA8BC,iBAA9B,QAAuD,qBAAvD;;AAEA,SAASC,cAAT,OAA8D;AAAA,MAArC;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,GAAqC;AAC7D,QAAMC,QAAQ,GAAGF,cAAc,CAACG,QAAf,GACdN,mBAAmB,CAAEG,cAAc,CAACG,QAAjB,CAAnB,CACAH,cAAc,CAACI,SADf,CADc,GAIdJ,cAAc,CAACI,SAJlB;AAKA,QAAMC,SAAS,GAAGL,cAAc,CAACG,QAAf,GACfL,iBAAiB,CAAEE,cAAc,CAACG,QAAjB,CAAjB,CACAH,cAAc,CAACI,SADf,CADe,GAIfJ,cAAc,CAACI,SAJlB;AAMA,SACC;AACC,IAAA,SAAS,EAAC,0EADX;AAEC,kBAAaH,cAAc,IAAII;AAFhC,KAIG,CAAEC,KAAK,CAACC,OAAN,CAAeL,QAAf,IAA4BA,QAA5B,GAAuC,CAAEA,QAAF,CAAzC,EAAwDM,GAAxD,CACD,CAAEJ,SAAF,EAAaK,KAAb,KAAwB;AACvB,QAAKL,SAAS,KAAK,GAAnB,EAAyB;AACxB,aAAO,cAAC,QAAD;AAAU,QAAA,GAAG,EAAGK;AAAhB,SAA0BL,SAA1B,CAAP;AACA;;AAED,WACC;AACC,MAAA,GAAG,EAAGK,KADP;AAEC,MAAA,SAAS,EAAC;AAFX,OAIGL,SAJH,CADD;AAQA,GAdA,CAJH,CADD;AAuBA;;AAED,SAASM,QAAT,QAA8E;AAAA,MAA3D;AAAEC,IAAAA,WAAF;AAAeX,IAAAA,cAAf;AAA+BY,IAAAA,OAAO,GAAG,EAAzC;AAA6CP,IAAAA;AAA7C,GAA2D;AAC7E,SACC,8BACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGM,WADH,CADD,EAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,cAAD;AACC,IAAA,cAAc,EAAGX,cADlB;AAEC,IAAA,cAAc,EAAGK;AAFlB,IADD,EAKGO,OAAO,CAACJ,GAAR,CAAa,CAAEK,KAAF,EAASJ,KAAT,KACd,cAAC,cAAD;AACC,IAAA,cAAc,EAAGI,KADlB;AAEC,IAAA,cAAc,EAAGR,SAFlB;AAGC,IAAA,GAAG,EAAGI;AAHP,IADC,CALH,CAJD,CADD;AAoBA;;AAED,eAAeC,QAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';\n\nfunction KeyCombination( { keyCombination, forceAriaLabel } ) {\n\tconst shortcut = keyCombination.modifier\n\t\t? displayShortcutList[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t )\n\t\t: keyCombination.character;\n\tconst ariaLabel = keyCombination.modifier\n\t\t? shortcutAriaLabel[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t )\n\t\t: keyCombination.character;\n\n\treturn (\n\t\t<kbd\n\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination\"\n\t\t\taria-label={ forceAriaLabel || ariaLabel }\n\t\t>\n\t\t\t{ ( Array.isArray( shortcut ) ? shortcut : [ shortcut ] ).map(\n\t\t\t\t( character, index ) => {\n\t\t\t\t\tif ( character === '+' ) {\n\t\t\t\t\t\treturn <Fragment key={ index }>{ character }</Fragment>;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<kbd\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-key\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ character }\n\t\t\t\t\t\t</kbd>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t) }\n\t\t</kbd>\n\t);\n}\n\nfunction Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-description\">\n\t\t\t\t{ description }\n\t\t\t</div>\n\t\t\t<div className=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-term\">\n\t\t\t\t<KeyCombination\n\t\t\t\t\tkeyCombination={ keyCombination }\n\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t/>\n\t\t\t\t{ aliases.map( ( alias, index ) => (\n\t\t\t\t\t<KeyCombination\n\t\t\t\t\t\tkeyCombination={ alias }\n\t\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Shortcut;\n"]}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { without } from 'lodash';
|
|
7
3
|
/**
|
|
8
4
|
* WordPress dependencies
|
|
9
5
|
*/
|
|
10
|
-
|
|
11
6
|
import { BlockControls, store as blockEditorStore } from '@wordpress/block-editor';
|
|
12
7
|
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
13
8
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
@@ -47,7 +42,7 @@ const withMoveToSidebarToolbarItem = createHigherOrderComponent(BlockEdit => pro
|
|
|
47
42
|
*/
|
|
48
43
|
const oldSetting = activeSidebarControl.setting;
|
|
49
44
|
const newSetting = newSidebarControl.setting;
|
|
50
|
-
oldSetting(
|
|
45
|
+
oldSetting(oldSetting().filter(id => id !== widgetId));
|
|
51
46
|
newSetting([...newSetting(), widgetId]);
|
|
52
47
|
} else {
|
|
53
48
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/filters/move-to-sidebar.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/filters/move-to-sidebar.js"],"names":["BlockControls","store","blockEditorStore","createHigherOrderComponent","useSelect","useDispatch","addFilter","MoveToWidgetArea","getWidgetIdFromBlock","useSidebarControls","useActiveSidebarControl","useFocusControl","blockToWidget","withMoveToSidebarToolbarItem","BlockEdit","props","widgetId","sidebarControls","activeSidebarControl","hasMultipleSidebars","length","blockName","name","clientId","canInsertBlockInSidebar","select","canInsertBlockType","block","getBlock","removeBlock","focusWidget","moveToSidebar","sidebarControlId","newSidebarControl","find","sidebarControl","id","oldSetting","setting","newSetting","filter","sidebarAdapter","addedWidgetIds","setWidgets","getWidgets","reverse","map","params","label","description"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,aADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,gBAAT,EAA2B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,CADD;AAqBA,CAlF6D,EAmF9D,8BAnF8D,CAA/D;AAsFAzB,SAAS,CACR,kBADQ,EAER,mCAFQ,EAGRO,4BAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { MoveToWidgetArea, getWidgetIdFromBlock } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseSidebarControls,\n\tuseActiveSidebarControl,\n} from '../components/sidebar-controls';\nimport { useFocusControl } from '../components/focus-control';\nimport { blockToWidget } from '../utils';\n\nconst withMoveToSidebarToolbarItem = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tlet widgetId = getWidgetIdFromBlock( props );\n\t\tconst sidebarControls = useSidebarControls();\n\t\tconst activeSidebarControl = useActiveSidebarControl();\n\t\tconst hasMultipleSidebars = sidebarControls?.length > 1;\n\t\tconst blockName = props.name;\n\t\tconst clientId = props.clientId;\n\t\tconst canInsertBlockInSidebar = useSelect(\n\t\t\t( select ) => {\n\t\t\t\t// Use an empty string to represent the root block list, which\n\t\t\t\t// in the customizer editor represents a sidebar/widget area.\n\t\t\t\treturn select( blockEditorStore ).canInsertBlockType(\n\t\t\t\t\tblockName,\n\t\t\t\t\t''\n\t\t\t\t);\n\t\t\t},\n\t\t\t[ blockName ]\n\t\t);\n\t\tconst block = useSelect(\n\t\t\t( select ) => select( blockEditorStore ).getBlock( clientId ),\n\t\t\t[ clientId ]\n\t\t);\n\t\tconst { removeBlock } = useDispatch( blockEditorStore );\n\t\tconst [ , focusWidget ] = useFocusControl();\n\n\t\tfunction moveToSidebar( sidebarControlId ) {\n\t\t\tconst newSidebarControl = sidebarControls.find(\n\t\t\t\t( sidebarControl ) => sidebarControl.id === sidebarControlId\n\t\t\t);\n\n\t\t\tif ( widgetId ) {\n\t\t\t\t/**\n\t\t\t\t * If there's a widgetId, move it to the other sidebar.\n\t\t\t\t */\n\t\t\t\tconst oldSetting = activeSidebarControl.setting;\n\t\t\t\tconst newSetting = newSidebarControl.setting;\n\n\t\t\t\toldSetting( oldSetting().filter( ( id ) => id !== widgetId ) );\n\t\t\t\tnewSetting( [ ...newSetting(), widgetId ] );\n\t\t\t} else {\n\t\t\t\t/**\n\t\t\t\t * If there isn't a widgetId, it's most likely a inner block.\n\t\t\t\t * First, remove the block in the original sidebar,\n\t\t\t\t * then, create a new widget in the new sidebar and get back its widgetId.\n\t\t\t\t */\n\t\t\t\tconst sidebarAdapter = newSidebarControl.sidebarAdapter;\n\n\t\t\t\tremoveBlock( clientId );\n\t\t\t\tconst addedWidgetIds = sidebarAdapter.setWidgets( [\n\t\t\t\t\t...sidebarAdapter.getWidgets(),\n\t\t\t\t\tblockToWidget( block ),\n\t\t\t\t] );\n\t\t\t\t// The last non-null id is the added widget's id.\n\t\t\t\twidgetId = addedWidgetIds.reverse().find( ( id ) => !! id );\n\t\t\t}\n\n\t\t\t// Move focus to the moved widget and expand the sidebar.\n\t\t\tfocusWidget( widgetId );\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ hasMultipleSidebars && canInsertBlockInSidebar && (\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<MoveToWidgetArea\n\t\t\t\t\t\t\twidgetAreas={ sidebarControls.map(\n\t\t\t\t\t\t\t\t( sidebarControl ) => ( {\n\t\t\t\t\t\t\t\t\tid: sidebarControl.id,\n\t\t\t\t\t\t\t\t\tname: sidebarControl.params.label,\n\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\tsidebarControl.params.description,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tcurrentWidgetAreaId={ activeSidebarControl?.id }\n\t\t\t\t\t\t\tonSelect={ moveToSidebar }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withMoveToSidebarToolbarItem'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/customize-widgets/block-edit',\n\twithMoveToSidebarToolbarItem\n);\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/customize-widgets",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.18.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,25 +24,25 @@
|
|
|
24
24
|
"react-native": "src/index",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.16.0",
|
|
27
|
-
"@wordpress/block-editor": "^10.
|
|
28
|
-
"@wordpress/block-library": "^7.
|
|
29
|
-
"@wordpress/blocks": "^11.
|
|
30
|
-
"@wordpress/components": "^
|
|
31
|
-
"@wordpress/compose": "^5.
|
|
32
|
-
"@wordpress/core-data": "^5.
|
|
33
|
-
"@wordpress/data": "^7.
|
|
34
|
-
"@wordpress/dom": "^3.
|
|
35
|
-
"@wordpress/element": "^4.
|
|
36
|
-
"@wordpress/hooks": "^3.
|
|
37
|
-
"@wordpress/i18n": "^4.
|
|
38
|
-
"@wordpress/icons": "^9.
|
|
39
|
-
"@wordpress/interface": "^4.
|
|
40
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
41
|
-
"@wordpress/keyboard-shortcuts": "^3.
|
|
42
|
-
"@wordpress/keycodes": "^3.
|
|
43
|
-
"@wordpress/media-utils": "^4.
|
|
44
|
-
"@wordpress/preferences": "^2.
|
|
45
|
-
"@wordpress/widgets": "^2.
|
|
27
|
+
"@wordpress/block-editor": "^10.4.0",
|
|
28
|
+
"@wordpress/block-library": "^7.18.0",
|
|
29
|
+
"@wordpress/blocks": "^11.20.0",
|
|
30
|
+
"@wordpress/components": "^22.0.0",
|
|
31
|
+
"@wordpress/compose": "^5.19.0",
|
|
32
|
+
"@wordpress/core-data": "^5.4.0",
|
|
33
|
+
"@wordpress/data": "^7.5.0",
|
|
34
|
+
"@wordpress/dom": "^3.21.0",
|
|
35
|
+
"@wordpress/element": "^4.19.0",
|
|
36
|
+
"@wordpress/hooks": "^3.21.0",
|
|
37
|
+
"@wordpress/i18n": "^4.21.0",
|
|
38
|
+
"@wordpress/icons": "^9.12.0",
|
|
39
|
+
"@wordpress/interface": "^4.20.0",
|
|
40
|
+
"@wordpress/is-shallow-equal": "^4.21.0",
|
|
41
|
+
"@wordpress/keyboard-shortcuts": "^3.19.0",
|
|
42
|
+
"@wordpress/keycodes": "^3.21.0",
|
|
43
|
+
"@wordpress/media-utils": "^4.12.0",
|
|
44
|
+
"@wordpress/preferences": "^2.13.0",
|
|
45
|
+
"@wordpress/widgets": "^2.19.0",
|
|
46
46
|
"classnames": "^2.3.1",
|
|
47
47
|
"lodash": "^4.17.21"
|
|
48
48
|
},
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "511f4cc1f0138641bc4394bc1cf36e833109c791"
|
|
57
57
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { castArray } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -26,20 +21,22 @@ function KeyCombination( { keyCombination, forceAriaLabel } ) {
|
|
|
26
21
|
className="customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination"
|
|
27
22
|
aria-label={ forceAriaLabel || ariaLabel }
|
|
28
23
|
>
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
{ ( Array.isArray( shortcut ) ? shortcut : [ shortcut ] ).map(
|
|
25
|
+
( character, index ) => {
|
|
26
|
+
if ( character === '+' ) {
|
|
27
|
+
return <Fragment key={ index }>{ character }</Fragment>;
|
|
28
|
+
}
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
return (
|
|
31
|
+
<kbd
|
|
32
|
+
key={ index }
|
|
33
|
+
className="customize-widgets-keyboard-shortcut-help-modal__shortcut-key"
|
|
34
|
+
>
|
|
35
|
+
{ character }
|
|
36
|
+
</kbd>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
) }
|
|
43
40
|
</kbd>
|
|
44
41
|
);
|
|
45
42
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { without } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -63,7 +58,7 @@ const withMoveToSidebarToolbarItem = createHigherOrderComponent(
|
|
|
63
58
|
const oldSetting = activeSidebarControl.setting;
|
|
64
59
|
const newSetting = newSidebarControl.setting;
|
|
65
60
|
|
|
66
|
-
oldSetting(
|
|
61
|
+
oldSetting( oldSetting().filter( ( id ) => id !== widgetId ) );
|
|
67
62
|
newSetting( [ ...newSetting(), widgetId ] );
|
|
68
63
|
} else {
|
|
69
64
|
/**
|