@wordpress/customize-widgets 2.0.1-next.5df0cd52b7.0 → 2.0.4
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/README.md +3 -3
- package/build/components/customize-widgets/index.js +4 -2
- package/build/components/customize-widgets/index.js.map +1 -1
- package/build/components/inserter/index.js +1 -1
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/use-inserter.js +1 -1
- package/build/components/inserter/use-inserter.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +1 -3
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +0 -6
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/more-menu/index.js +12 -19
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/sidebar-block-editor/index.js +8 -5
- package/build/components/sidebar-block-editor/index.js.map +1 -1
- package/build/components/welcome-guide/index.js +4 -8
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/controls/inspector-section.js +45 -0
- package/build/controls/inspector-section.js.map +1 -1
- package/build/index.js +13 -1
- package/build/index.js.map +1 -1
- package/build/store/actions.js +0 -20
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +1 -2
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +2 -51
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +0 -24
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/customize-widgets/index.js +3 -2
- package/build-module/components/customize-widgets/index.js.map +1 -1
- package/build-module/components/inserter/index.js +1 -1
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/use-inserter.js +1 -1
- package/build-module/components/inserter/use-inserter.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +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 +1 -3
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +0 -6
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/more-menu/index.js +14 -21
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/sidebar-block-editor/index.js +7 -4
- package/build-module/components/sidebar-block-editor/index.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +4 -8
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/controls/inspector-section.js +45 -0
- package/build-module/controls/inspector-section.js.map +1 -1
- package/build-module/index.js +13 -3
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +0 -18
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +1 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +1 -46
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +0 -21
- package/build-module/store/selectors.js.map +1 -1
- package/package.json +21 -20
- package/src/components/customize-widgets/index.js +17 -11
- package/src/components/inserter/index.js +4 -2
- package/src/components/inserter/style.scss +1 -1
- package/src/components/inserter/use-inserter.js +3 -2
- package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +15 -12
- package/src/components/keyboard-shortcut-help-modal/index.js +1 -3
- package/src/components/keyboard-shortcuts/index.js +12 -24
- package/src/components/more-menu/index.js +13 -20
- package/src/components/sidebar-block-editor/index.js +14 -10
- package/src/components/welcome-guide/index.js +5 -9
- package/src/controls/inspector-section.js +40 -0
- package/src/index.js +14 -1
- package/src/store/actions.js +0 -18
- package/src/store/index.js +0 -1
- package/src/store/reducer.js +0 -47
- package/src/store/selectors.js +0 -21
- package/build/components/more-menu/feature-toggle.js +0 -62
- package/build/components/more-menu/feature-toggle.js.map +0 -1
- package/build/store/defaults.js +0 -14
- package/build/store/defaults.js.map +0 -1
- package/build-module/components/more-menu/feature-toggle.js +0 -49
- package/build-module/components/more-menu/feature-toggle.js.map +0 -1
- package/build-module/store/defaults.js +0 -7
- package/build-module/store/defaults.js.map +0 -1
- package/src/components/more-menu/feature-toggle.js +0 -56
- package/src/store/defaults.js +0 -6
package/build/index.js
CHANGED
|
@@ -15,6 +15,10 @@ var _widgets = require("@wordpress/widgets");
|
|
|
15
15
|
|
|
16
16
|
var _blocks = require("@wordpress/blocks");
|
|
17
17
|
|
|
18
|
+
var _data = require("@wordpress/data");
|
|
19
|
+
|
|
20
|
+
var _interface = require("@wordpress/interface");
|
|
21
|
+
|
|
18
22
|
var _customizeWidgets = _interopRequireDefault(require("./components/customize-widgets"));
|
|
19
23
|
|
|
20
24
|
var _sidebarSection = _interopRequireDefault(require("./controls/sidebar-section"));
|
|
@@ -43,6 +47,13 @@ const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
|
|
|
43
47
|
*/
|
|
44
48
|
|
|
45
49
|
function initialize(editorName, blockEditorSettings) {
|
|
50
|
+
(0, _data.dispatch)(_interface.store).setFeatureDefaults('core/customize-widgets', {
|
|
51
|
+
fixedToolbar: false,
|
|
52
|
+
welcomeGuide: true
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
(0, _data.dispatch)(_blocks.store).__experimentalReapplyBlockTypeFilters();
|
|
56
|
+
|
|
46
57
|
const coreBlocks = (0, _blockLibrary.__experimentalGetCoreBlocks)().filter(block => {
|
|
47
58
|
return !(DISABLED_BLOCKS.includes(block.name) || block.name.startsWith('core/post') || block.name.startsWith('core/query') || block.name.startsWith('core/site'));
|
|
48
59
|
});
|
|
@@ -55,7 +66,8 @@ function initialize(editorName, blockEditorSettings) {
|
|
|
55
66
|
});
|
|
56
67
|
}
|
|
57
68
|
|
|
58
|
-
(0, _widgets.registerLegacyWidgetVariations)(blockEditorSettings);
|
|
69
|
+
(0, _widgets.registerLegacyWidgetVariations)(blockEditorSettings);
|
|
70
|
+
(0, _widgets.registerWidgetGroupBlock)(); // As we are unregistering `core/freeform` to avoid the Classic block, we must
|
|
59
71
|
// replace it with something as the default freeform content handler. Failure to
|
|
60
72
|
// do this will result in errors in the default block parser.
|
|
61
73
|
// see: https://github.com/WordPress/gutenberg/issues/33097
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/index.js"],"names":["wp","window","DISABLED_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","initialize","editorName","blockEditorSettings","coreBlocks","filter","block","includes","name","startsWith","process","env","GUTENBERG_PHASE","enableFSEBlocks","SidebarControl","customize","sectionConstructor","sidebar","controlConstructor","sidebar_block_editor","container","document","createElement","body","appendChild","bind","sidebarControls","control","each","push"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AAIA;;AAKA;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/index.js"],"names":["wp","window","DISABLED_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","initialize","editorName","blockEditorSettings","interfaceStore","setFeatureDefaults","fixedToolbar","welcomeGuide","blocksStore","__experimentalReapplyBlockTypeFilters","coreBlocks","filter","block","includes","name","startsWith","process","env","GUTENBERG_PHASE","enableFSEBlocks","SidebarControl","customize","sectionConstructor","sidebar","controlConstructor","sidebar_block_editor","container","document","createElement","body","appendChild","bind","sidebarControls","control","each","push"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AAKA;;AAIA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA3BA;AACA;AACA;;AAmBA;AACA;AACA;AAMA,MAAM;AAAEA,EAAAA;AAAF,IAASC,MAAf;AAEA,MAAMC,eAAe,GAAG,CAAE,WAAF,EAAe,YAAf,EAA6B,eAA7B,CAAxB;AACA,MAAMC,8BAA8B,GAAG,KAAvC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,UAAT,CAAqBC,UAArB,EAAiCC,mBAAjC,EAAuD;AAC7D,sBAAUC,gBAAV,EAA2BC,kBAA3B,CAA+C,wBAA/C,EAAyE;AACxEC,IAAAA,YAAY,EAAE,KAD0D;AAExEC,IAAAA,YAAY,EAAE;AAF0D,GAAzE;;AAKA,sBAAUC,aAAV,EAAwBC,qCAAxB;;AACA,QAAMC,UAAU,GAAG,iDAA8BC,MAA9B,CAAwCC,KAAF,IAAa;AACrE,WAAO,EACNb,eAAe,CAACc,QAAhB,CAA0BD,KAAK,CAACE,IAAhC,KACAF,KAAK,CAACE,IAAN,CAAWC,UAAX,CAAuB,WAAvB,CADA,IAEAH,KAAK,CAACE,IAAN,CAAWC,UAAX,CAAuB,YAAvB,CAFA,IAGAH,KAAK,CAACE,IAAN,CAAWC,UAAX,CAAuB,WAAvB,CAJM,CAAP;AAMA,GAPkB,CAAnB;AAQA,wCAAoBL,UAApB;AACA;;AACA,MAAKM,OAAO,CAACC,GAAR,CAAYC,eAAZ,KAAgC,CAArC,EAAyC;AACxC,oEAA8C;AAC7CC,MAAAA,eAAe,EAAEnB;AAD4B,KAA9C;AAGA;;AACD,+CAAgCG,mBAAhC;AACA,2CAvB6D,CAyB7D;AACA;AACA;AACA;;AACA,6CAA+B,WAA/B;AAEA,QAAMiB,cAAc,GAAG,6BAAmBjB,mBAAnB,CAAvB;AAEAN,EAAAA,EAAE,CAACwB,SAAH,CAAaC,kBAAb,CAAgCC,OAAhC,GAA0C,8BAA1C;AACA1B,EAAAA,EAAE,CAACwB,SAAH,CAAaG,kBAAb,CAAgCC,oBAAhC,GAAuDL,cAAvD;AAEA,QAAMM,SAAS,GAAGC,QAAQ,CAACC,aAAT,CAAwB,KAAxB,CAAlB;AACAD,EAAAA,QAAQ,CAACE,IAAT,CAAcC,WAAd,CAA2BJ,SAA3B;AAEA7B,EAAAA,EAAE,CAACwB,SAAH,CAAaU,IAAb,CAAmB,OAAnB,EAA4B,MAAM;AACjC,UAAMC,eAAe,GAAG,EAAxB;AACAnC,IAAAA,EAAE,CAACwB,SAAH,CAAaY,OAAb,CAAqBC,IAArB,CAA6BD,OAAF,IAAe;AACzC,UAAKA,OAAO,YAAYb,cAAxB,EAAyC;AACxCY,QAAAA,eAAe,CAACG,IAAhB,CAAsBF,OAAtB;AACA;AACD,KAJD;AAMA,yBACC,4BAAC,yBAAD;AACC,MAAA,GAAG,EAAGpC,EAAE,CAACwB,SADV;AAEC,MAAA,eAAe,EAAGW,eAFnB;AAGC,MAAA,mBAAmB,EAAG7B;AAHvB,MADD,EAMCuB,SAND;AAQA,GAhBD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { render } from '@wordpress/element';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterLegacyWidgetVariations,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport {\n\tsetFreeformContentHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { dispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport CustomizeWidgets from './components/customize-widgets';\nimport getSidebarSection from './controls/sidebar-section';\nimport getSidebarControl from './controls/sidebar-control';\nimport './filters';\n\nconst { wp } = window;\n\nconst DISABLED_BLOCKS = [ 'core/more', 'core/block', 'core/freeform' ];\nconst ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;\n\n/**\n * Initializes the widgets block editor in the customizer.\n *\n * @param {string} editorName The editor name.\n * @param {Object} blockEditorSettings Block editor settings.\n */\nexport function initialize( editorName, blockEditorSettings ) {\n\tdispatch( interfaceStore ).setFeatureDefaults( 'core/customize-widgets', {\n\t\tfixedToolbar: false,\n\t\twelcomeGuide: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {\n\t\treturn ! (\n\t\t\tDISABLED_BLOCKS.includes( block.name ) ||\n\t\t\tblock.name.startsWith( 'core/post' ) ||\n\t\t\tblock.name.startsWith( 'core/query' ) ||\n\t\t\tblock.name.startsWith( 'core/site' )\n\t\t);\n\t} );\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( process.env.GUTENBERG_PHASE === 2 ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS,\n\t\t} );\n\t}\n\tregisterLegacyWidgetVariations( blockEditorSettings );\n\tregisterWidgetGroupBlock();\n\n\t// As we are unregistering `core/freeform` to avoid the Classic block, we must\n\t// replace it with something as the default freeform content handler. Failure to\n\t// do this will result in errors in the default block parser.\n\t// see: https://github.com/WordPress/gutenberg/issues/33097\n\tsetFreeformContentHandlerName( 'core/html' );\n\n\tconst SidebarControl = getSidebarControl( blockEditorSettings );\n\n\twp.customize.sectionConstructor.sidebar = getSidebarSection();\n\twp.customize.controlConstructor.sidebar_block_editor = SidebarControl;\n\n\tconst container = document.createElement( 'div' );\n\tdocument.body.appendChild( container );\n\n\twp.customize.bind( 'ready', () => {\n\t\tconst sidebarControls = [];\n\t\twp.customize.control.each( ( control ) => {\n\t\t\tif ( control instanceof SidebarControl ) {\n\t\t\t\tsidebarControls.push( control );\n\t\t\t}\n\t\t} );\n\n\t\trender(\n\t\t\t<CustomizeWidgets\n\t\t\t\tapi={ wp.customize }\n\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t/>,\n\t\t\tcontainer\n\t\t);\n\t} );\n}\n"]}
|
package/build/store/actions.js
CHANGED
|
@@ -3,26 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.__unstableToggleFeature = __unstableToggleFeature;
|
|
7
6
|
exports.setIsInserterOpened = setIsInserterOpened;
|
|
8
7
|
|
|
9
|
-
/**
|
|
10
|
-
* Returns an action object used to toggle a feature flag.
|
|
11
|
-
*
|
|
12
|
-
* This function is unstable, as it is mostly copied from the edit-post
|
|
13
|
-
* package. Editor features and preferences have a lot of scope for
|
|
14
|
-
* being generalized and refactored.
|
|
15
|
-
*
|
|
16
|
-
* @param {string} feature Feature name.
|
|
17
|
-
*
|
|
18
|
-
* @return {Object} Action object.
|
|
19
|
-
*/
|
|
20
|
-
function __unstableToggleFeature(feature) {
|
|
21
|
-
return {
|
|
22
|
-
type: 'TOGGLE_FEATURE',
|
|
23
|
-
feature
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
8
|
/**
|
|
27
9
|
* Returns an action object used to open/close the inserter.
|
|
28
10
|
*
|
|
@@ -35,8 +17,6 @@ function __unstableToggleFeature(feature) {
|
|
|
35
17
|
*
|
|
36
18
|
* @return {Object} Action object.
|
|
37
19
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
20
|
function setIsInserterOpened(value) {
|
|
41
21
|
return {
|
|
42
22
|
type: 'SET_IS_INSERTER_OPENED',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/store/actions.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/store/actions.js"],"names":["setIsInserterOpened","value","type"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAT,CAA8BC,KAA9B,EAAsC;AAC5C,SAAO;AACNC,IAAAA,IAAI,EAAE,wBADA;AAEND,IAAAA;AAFM,GAAP;AAIA","sourcesContent":["/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n"]}
|
package/build/store/index.js
CHANGED
package/build/store/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/store/index.js"],"names":["storeConfig","reducer","selectors","actions","
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/store/index.js"],"names":["storeConfig","reducer","selectors","actions","store","STORE_NAME"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,WAAW,GAAG;AACnBC,EAAAA,OAAO,EAAPA,gBADmB;AAEnBC,EAAAA,SAFmB;AAGnBC,EAAAA;AAHmB,CAApB;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMC,KAAK,GAAG,4BAAkBC,qBAAlB,EAA8BL,WAA9B,CAAd,C,CAEP;AACA;;;AACA,yBAAeK,qBAAf,EAA2BL,WAA3B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, registerStore } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport { STORE_NAME } from './constants';\n\n/**\n * Block editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore\n *\n * @type {Object}\n */\nconst storeConfig = {\n\treducer,\n\tselectors,\n\tactions,\n};\n\n/**\n * Store definition for the edit widgets namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig );\n\n// Once we build a more generic persistence plugin that works across types of stores\n// we'd be able to replace this with a register call.\nregisterStore( STORE_NAME, storeConfig );\n"]}
|
package/build/store/reducer.js
CHANGED
|
@@ -3,45 +3,20 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
7
|
-
|
|
8
|
-
var _lodash = require("lodash");
|
|
6
|
+
exports.default = void 0;
|
|
9
7
|
|
|
10
8
|
var _data = require("@wordpress/data");
|
|
11
9
|
|
|
12
|
-
var _defaults = require("./defaults");
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* External dependencies
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
10
|
/**
|
|
19
11
|
* WordPress dependencies
|
|
20
12
|
*/
|
|
21
13
|
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Higher-order reducer creator which provides the given initial state for the
|
|
28
|
-
* original reducer.
|
|
29
|
-
*
|
|
30
|
-
* @param {*} initialState Initial state to provide to reducer.
|
|
31
|
-
*
|
|
32
|
-
* @return {Function} Higher-order reducer.
|
|
33
|
-
*/
|
|
34
|
-
const createWithInitialState = initialState => reducer => {
|
|
35
|
-
return (state = initialState, action) => reducer(state, action);
|
|
36
|
-
};
|
|
37
14
|
/**
|
|
38
15
|
* Reducer tracking whether the inserter is open.
|
|
39
16
|
*
|
|
40
17
|
* @param {boolean|Object} state
|
|
41
18
|
* @param {Object} action
|
|
42
19
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
20
|
function blockInserterPanel(state = false, action) {
|
|
46
21
|
switch (action.type) {
|
|
47
22
|
case 'SET_IS_INSERTER_OPENED':
|
|
@@ -50,33 +25,9 @@ function blockInserterPanel(state = false, action) {
|
|
|
50
25
|
|
|
51
26
|
return state;
|
|
52
27
|
}
|
|
53
|
-
/**
|
|
54
|
-
* Reducer returning the user preferences.
|
|
55
|
-
*
|
|
56
|
-
* @param {Object} state Current state.
|
|
57
|
-
* @param {Object} action Dispatched action.
|
|
58
|
-
*
|
|
59
|
-
* @return {Object} Updated state.
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const preferences = (0, _lodash.flow)([_data.combineReducers, createWithInitialState(_defaults.PREFERENCES_DEFAULTS)])({
|
|
64
|
-
features(state, action) {
|
|
65
|
-
if (action.type === 'TOGGLE_FEATURE') {
|
|
66
|
-
return { ...state,
|
|
67
|
-
[action.feature]: !state[action.feature]
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return state;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
});
|
|
75
|
-
exports.preferences = preferences;
|
|
76
28
|
|
|
77
29
|
var _default = (0, _data.combineReducers)({
|
|
78
|
-
blockInserterPanel
|
|
79
|
-
preferences
|
|
30
|
+
blockInserterPanel
|
|
80
31
|
});
|
|
81
32
|
|
|
82
33
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/store/reducer.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/store/reducer.js"],"names":["blockInserterPanel","state","action","type","value"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,kBAAT,CAA6BC,KAAK,GAAG,KAArC,EAA4CC,MAA5C,EAAqD;AACpD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,wBAAL;AACC,aAAOD,MAAM,CAACE,KAAd;AAFF;;AAIA,SAAOH,KAAP;AACA;;eAEc,2BAAiB;AAC/BD,EAAAA;AAD+B,CAAjB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer tracking whether the inserter is open.\n *\n * @param {boolean|Object} state\n * @param {Object} action\n */\nfunction blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tblockInserterPanel,\n} );\n"]}
|
package/build/store/selectors.js
CHANGED
|
@@ -3,31 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.__unstableIsFeatureActive = __unstableIsFeatureActive;
|
|
7
6
|
exports.isInserterOpened = isInserterOpened;
|
|
8
7
|
exports.__experimentalGetInsertionPoint = __experimentalGetInsertionPoint;
|
|
9
8
|
|
|
10
|
-
var _lodash = require("lodash");
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* External dependencies
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Returns whether the given feature is enabled or not.
|
|
18
|
-
*
|
|
19
|
-
* This function is unstable, as it is mostly copied from the edit-post
|
|
20
|
-
* package. Editor features and preferences have a lot of scope for
|
|
21
|
-
* being generalized and refactored.
|
|
22
|
-
*
|
|
23
|
-
* @param {Object} state Global application state.
|
|
24
|
-
* @param {string} feature Feature slug.
|
|
25
|
-
*
|
|
26
|
-
* @return {boolean} Is active.
|
|
27
|
-
*/
|
|
28
|
-
function __unstableIsFeatureActive(state, feature) {
|
|
29
|
-
return (0, _lodash.get)(state.preferences.features, [feature], false);
|
|
30
|
-
}
|
|
31
9
|
/**
|
|
32
10
|
* Returns true if the inserter is opened.
|
|
33
11
|
*
|
|
@@ -35,8 +13,6 @@ function __unstableIsFeatureActive(state, feature) {
|
|
|
35
13
|
*
|
|
36
14
|
* @return {boolean} Whether the inserter is opened.
|
|
37
15
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
16
|
function isInserterOpened(state) {
|
|
41
17
|
return !!state.blockInserterPanel;
|
|
42
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/store/selectors.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/store/selectors.js"],"names":["isInserterOpened","state","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CAA2BC,KAA3B,EAAmC;AACzC,SAAO,CAAC,CAAEA,KAAK,CAACC,kBAAhB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,+BAAT,CAA0CF,KAA1C,EAAkD;AACxD,QAAM;AAAEG,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAAmCJ,KAAK,CAACC,kBAA/C;AACA,SAAO;AAAEE,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,GAAP;AACA","sourcesContent":["/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID and index to insert at.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst { rootClientId, insertionIndex } = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex };\n}\n"]}
|
|
@@ -5,6 +5,7 @@ import { createElement } from "@wordpress/element";
|
|
|
5
5
|
*/
|
|
6
6
|
import { useState, useEffect, useRef, createPortal } from '@wordpress/element';
|
|
7
7
|
import { SlotFillProvider, Popover } from '@wordpress/components';
|
|
8
|
+
import { ShortcutProvider } from '@wordpress/keyboard-shortcuts';
|
|
8
9
|
/**
|
|
9
10
|
* Internal dependencies
|
|
10
11
|
*/
|
|
@@ -46,12 +47,12 @@ export default function CustomizeWidgets({
|
|
|
46
47
|
className: "customize-widgets-popover",
|
|
47
48
|
ref: popoverRef
|
|
48
49
|
}, createElement(Popover.Slot, null)), parentContainer);
|
|
49
|
-
return createElement(SlotFillProvider, null, createElement(SidebarControls, {
|
|
50
|
+
return createElement(ShortcutProvider, null, createElement(SlotFillProvider, null, createElement(SidebarControls, {
|
|
50
51
|
sidebarControls: sidebarControls,
|
|
51
52
|
activeSidebarControl: activeSidebarControl
|
|
52
53
|
}, createElement(FocusControl, {
|
|
53
54
|
api: api,
|
|
54
55
|
sidebarControls: sidebarControls
|
|
55
|
-
}, activeSidebar, popover)));
|
|
56
|
+
}, activeSidebar, popover))));
|
|
56
57
|
}
|
|
57
58
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/customize-widgets/index.js"],"names":["useState","useEffect","useRef","createPortal","SlotFillProvider","Popover","ErrorBoundary","SidebarBlockEditor","FocusControl","SidebarControls","useClearSelectedBlock","CustomizeWidgets","api","sidebarControls","blockEditorSettings","activeSidebarControl","setActiveSidebarControl","parentContainer","document","getElementById","popoverRef","unsubscribers","map","sidebarControl","subscribe","expanded","forEach","unsubscriber","activeSidebar","id","sidebarAdapter","inserter","inspector","container","popover"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,SAAnB,EAA8BC,MAA9B,EAAsCC,YAAtC,QAA0D,oBAA1D;AACA,SAASC,gBAAT,EAA2BC,OAA3B,QAA0C,uBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AAEA,eAAe,SAASC,gBAAT,CAA2B;AACzCC,EAAAA,GADyC;AAEzCC,EAAAA,eAFyC;AAGzCC,EAAAA;AAHyC,CAA3B,EAIX;AACH,QAAM,CAAEC,oBAAF,EAAwBC,uBAAxB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/customize-widgets/index.js"],"names":["useState","useEffect","useRef","createPortal","SlotFillProvider","Popover","ShortcutProvider","ErrorBoundary","SidebarBlockEditor","FocusControl","SidebarControls","useClearSelectedBlock","CustomizeWidgets","api","sidebarControls","blockEditorSettings","activeSidebarControl","setActiveSidebarControl","parentContainer","document","getElementById","popoverRef","unsubscribers","map","sidebarControl","subscribe","expanded","forEach","unsubscriber","activeSidebar","id","sidebarAdapter","inserter","inspector","container","popover"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,SAAnB,EAA8BC,MAA9B,EAAsCC,YAAtC,QAA0D,oBAA1D;AACA,SAASC,gBAAT,EAA2BC,OAA3B,QAA0C,uBAA1C;AACA,SAASC,gBAAT,QAAiC,+BAAjC;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AAEA,eAAe,SAASC,gBAAT,CAA2B;AACzCC,EAAAA,GADyC;AAEzCC,EAAAA,eAFyC;AAGzCC,EAAAA;AAHyC,CAA3B,EAIX;AACH,QAAM,CAAEC,oBAAF,EAAwBC,uBAAxB,IAAoDjB,QAAQ,CAAE,IAAF,CAAlE;AACA,QAAMkB,eAAe,GAAGC,QAAQ,CAACC,cAAT,CACvB,0BADuB,CAAxB;AAGA,QAAMC,UAAU,GAAGnB,MAAM,EAAzB;AAEAS,EAAAA,qBAAqB,CAAEK,oBAAF,EAAwBK,UAAxB,CAArB;AAEApB,EAAAA,SAAS,CAAE,MAAM;AAChB,UAAMqB,aAAa,GAAGR,eAAe,CAACS,GAAhB,CAAuBC,cAAF,IAC1CA,cAAc,CAACC,SAAf,CAA4BC,QAAF,IAAgB;AACzC,UAAKA,QAAL,EAAgB;AACfT,QAAAA,uBAAuB,CAAEO,cAAF,CAAvB;AACA;AACD,KAJD,CADqB,CAAtB;AAQA,WAAO,MAAM;AACZF,MAAAA,aAAa,CAACK,OAAd,CAAyBC,YAAF,IAAoBA,YAAY,EAAvD;AACA,KAFD;AAGA,GAZQ,EAYN,CAAEd,eAAF,CAZM,CAAT;AAcA,QAAMe,aAAa,GAClBb,oBAAoB,IACpBb,YAAY,CACX,cAAC,aAAD,QACC,cAAC,kBAAD;AACC,IAAA,GAAG,EAAGa,oBAAoB,CAACc,EAD5B;AAEC,IAAA,mBAAmB,EAAGf,mBAFvB;AAGC,IAAA,OAAO,EAAGC,oBAAoB,CAACe,cAHhC;AAIC,IAAA,QAAQ,EAAGf,oBAAoB,CAACgB,QAJjC;AAKC,IAAA,SAAS,EAAGhB,oBAAoB,CAACiB;AALlC,IADD,CADW,EAUXjB,oBAAoB,CAACkB,SAArB,CAAgC,CAAhC,CAVW,CAFb,CAvBG,CAsCH;AACA;;AACA,QAAMC,OAAO,GACZjB,eAAe,IACff,YAAY,CACX;AAAK,IAAA,SAAS,EAAC,2BAAf;AAA2C,IAAA,GAAG,EAAGkB;AAAjD,KACC,cAAC,OAAD,CAAS,IAAT,OADD,CADW,EAIXH,eAJW,CAFb;AASA,SACC,cAAC,gBAAD,QACC,cAAC,gBAAD,QACC,cAAC,eAAD;AACC,IAAA,eAAe,EAAGJ,eADnB;AAEC,IAAA,oBAAoB,EAAGE;AAFxB,KAIC,cAAC,YAAD;AACC,IAAA,GAAG,EAAGH,GADP;AAEC,IAAA,eAAe,EAAGC;AAFnB,KAIGe,aAJH,EAKGM,OALH,CAJD,CADD,CADD,CADD;AAkBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef, createPortal } from '@wordpress/element';\nimport { SlotFillProvider, Popover } from '@wordpress/components';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport ErrorBoundary from '../error-boundary';\nimport SidebarBlockEditor from '../sidebar-block-editor';\nimport FocusControl from '../focus-control';\nimport SidebarControls from '../sidebar-controls';\nimport useClearSelectedBlock from './use-clear-selected-block';\n\nexport default function CustomizeWidgets( {\n\tapi,\n\tsidebarControls,\n\tblockEditorSettings,\n} ) {\n\tconst [ activeSidebarControl, setActiveSidebarControl ] = useState( null );\n\tconst parentContainer = document.getElementById(\n\t\t'customize-theme-controls'\n\t);\n\tconst popoverRef = useRef();\n\n\tuseClearSelectedBlock( activeSidebarControl, popoverRef );\n\n\tuseEffect( () => {\n\t\tconst unsubscribers = sidebarControls.map( ( sidebarControl ) =>\n\t\t\tsidebarControl.subscribe( ( expanded ) => {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tsetActiveSidebarControl( sidebarControl );\n\t\t\t\t}\n\t\t\t} )\n\t\t);\n\n\t\treturn () => {\n\t\t\tunsubscribers.forEach( ( unsubscriber ) => unsubscriber() );\n\t\t};\n\t}, [ sidebarControls ] );\n\n\tconst activeSidebar =\n\t\tactiveSidebarControl &&\n\t\tcreatePortal(\n\t\t\t<ErrorBoundary>\n\t\t\t\t<SidebarBlockEditor\n\t\t\t\t\tkey={ activeSidebarControl.id }\n\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\tsidebar={ activeSidebarControl.sidebarAdapter }\n\t\t\t\t\tinserter={ activeSidebarControl.inserter }\n\t\t\t\t\tinspector={ activeSidebarControl.inspector }\n\t\t\t\t/>\n\t\t\t</ErrorBoundary>,\n\t\t\tactiveSidebarControl.container[ 0 ]\n\t\t);\n\n\t// We have to portal this to the parent of both the editor and the inspector,\n\t// so that the popovers will appear above both of them.\n\tconst popover =\n\t\tparentContainer &&\n\t\tcreatePortal(\n\t\t\t<div className=\"customize-widgets-popover\" ref={ popoverRef }>\n\t\t\t\t<Popover.Slot />\n\t\t\t</div>,\n\t\t\tparentContainer\n\t\t);\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<SidebarControls\n\t\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\t\tactiveSidebarControl={ activeSidebarControl }\n\t\t\t\t>\n\t\t\t\t\t<FocusControl\n\t\t\t\t\t\tapi={ api }\n\t\t\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ activeSidebar }\n\t\t\t\t\t\t{ popover }\n\t\t\t\t\t</FocusControl>\n\t\t\t\t</SidebarControls>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n"]}
|
|
@@ -19,7 +19,7 @@ function Inserter({
|
|
|
19
19
|
setIsOpened
|
|
20
20
|
}) {
|
|
21
21
|
const inserterTitleId = useInstanceId(Inserter, 'customize-widget-layout__inserter-panel-title');
|
|
22
|
-
const insertionPoint = useSelect(select => select(customizeWidgetsStore).__experimentalGetInsertionPoint());
|
|
22
|
+
const insertionPoint = useSelect(select => select(customizeWidgetsStore).__experimentalGetInsertionPoint(), []);
|
|
23
23
|
return createElement("div", {
|
|
24
24
|
className: "customize-widgets-layout__inserter-panel",
|
|
25
25
|
"aria-labelledby": inserterTitleId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/inserter/index.js"],"names":["__","__experimentalLibrary","Library","Button","useInstanceId","useSelect","closeSmall","store","customizeWidgetsStore","Inserter","setIsOpened","inserterTitleId","insertionPoint","select","__experimentalGetInsertionPoint","rootClientId","insertionIndex"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,qBAAqB,IAAIC,OAAlC,QAAiD,yBAAjD;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,UAAT,QAA2B,kBAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,qBAAlB,QAA+C,aAA/C;;AAEA,SAASC,QAAT,CAAmB;AAAEC,EAAAA;AAAF,CAAnB,EAAqC;AACpC,QAAMC,eAAe,GAAGP,aAAa,CACpCK,QADoC,EAEpC,+CAFoC,CAArC;AAIA,QAAMG,cAAc,GAAGP,SAAS,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/inserter/index.js"],"names":["__","__experimentalLibrary","Library","Button","useInstanceId","useSelect","closeSmall","store","customizeWidgetsStore","Inserter","setIsOpened","inserterTitleId","insertionPoint","select","__experimentalGetInsertionPoint","rootClientId","insertionIndex"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,qBAAqB,IAAIC,OAAlC,QAAiD,yBAAjD;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,UAAT,QAA2B,kBAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,qBAAlB,QAA+C,aAA/C;;AAEA,SAASC,QAAT,CAAmB;AAAEC,EAAAA;AAAF,CAAnB,EAAqC;AACpC,QAAMC,eAAe,GAAGP,aAAa,CACpCK,QADoC,EAEpC,+CAFoC,CAArC;AAIA,QAAMG,cAAc,GAAGP,SAAS,CAC7BQ,MAAF,IACCA,MAAM,CAAEL,qBAAF,CAAN,CAAgCM,+BAAhC,EAF8B,EAG/B,EAH+B,CAAhC;AAMA,SACC;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,uBAAkBH;AAFnB,KAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AACC,IAAA,EAAE,EAAGA,eADN;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGX,EAAE,CAAE,aAAF,CAJL,CADD,EAOC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,8DADX;AAEC,IAAA,IAAI,EAAGM,UAFR;AAGC,IAAA,OAAO,EAAG,MAAMI,WAAW,CAAE,KAAF,CAH5B;AAIC,kBAAaV,EAAE,CAAE,gBAAF;AAJhB,IAPD,CAJD,EAkBC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,OAAD;AACC,IAAA,YAAY,EAAGY,cAAc,CAACG,YAD/B;AAEC,IAAA,4BAA4B,EAC3BH,cAAc,CAACI,cAHjB;AAKC,IAAA,qBAAqB,MALtB;AAMC,IAAA,QAAQ,EAAG,MAAMN,WAAW,CAAE,KAAF;AAN7B,IADD,CAlBD,CADD;AA+BA;;AAED,eAAeD,QAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as customizeWidgetsStore } from '../../store';\n\nfunction Inserter( { setIsOpened } ) {\n\tconst inserterTitleId = useInstanceId(\n\t\tInserter,\n\t\t'customize-widget-layout__inserter-panel-title'\n\t);\n\tconst insertionPoint = useSelect(\n\t\t( select ) =>\n\t\t\tselect( customizeWidgetsStore ).__experimentalGetInsertionPoint(),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"customize-widgets-layout__inserter-panel\"\n\t\t\taria-labelledby={ inserterTitleId }\n\t\t>\n\t\t\t<div className=\"customize-widgets-layout__inserter-panel-header\">\n\t\t\t\t<h2\n\t\t\t\t\tid={ inserterTitleId }\n\t\t\t\t\tclassName=\"customize-widgets-layout__inserter-panel-header-title\"\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Add a block' ) }\n\t\t\t\t</h2>\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"customize-widgets-layout__inserter-panel-header-close-button\"\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tonClick={ () => setIsOpened( false ) }\n\t\t\t\t\taria-label={ __( 'Close inserter' ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div className=\"customize-widgets-layout__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\trootClientId={ insertionPoint.rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\tinsertionPoint.insertionIndex\n\t\t\t\t\t}\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tonSelect={ () => setIsOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default Inserter;\n"]}
|
|
@@ -9,7 +9,7 @@ import { useSelect, useDispatch, select as selectStore } from '@wordpress/data';
|
|
|
9
9
|
|
|
10
10
|
import { store as customizeWidgetsStore } from '../../store';
|
|
11
11
|
export default function useInserter(inserter) {
|
|
12
|
-
const isInserterOpened = useSelect(select => select(customizeWidgetsStore).isInserterOpened());
|
|
12
|
+
const isInserterOpened = useSelect(select => select(customizeWidgetsStore).isInserterOpened(), []);
|
|
13
13
|
const {
|
|
14
14
|
setIsInserterOpened
|
|
15
15
|
} = useDispatch(customizeWidgetsStore);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/inserter/use-inserter.js"],"names":["useEffect","useCallback","useSelect","useDispatch","select","selectStore","store","customizeWidgetsStore","useInserter","inserter","isInserterOpened","setIsInserterOpened","open","close","updater","isOpen"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,oBAAvC;AACA,SAASC,SAAT,EAAoBC,WAApB,EAAiCC,MAAM,IAAIC,WAA3C,QAA8D,iBAA9D;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,qBAAlB,QAA+C,aAA/C;AAEA,eAAe,SAASC,WAAT,CAAsBC,QAAtB,EAAiC;AAC/C,QAAMC,gBAAgB,GAAGR,SAAS,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/inserter/use-inserter.js"],"names":["useEffect","useCallback","useSelect","useDispatch","select","selectStore","store","customizeWidgetsStore","useInserter","inserter","isInserterOpened","setIsInserterOpened","open","close","updater","isOpen"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,oBAAvC;AACA,SAASC,SAAT,EAAoBC,WAApB,EAAiCC,MAAM,IAAIC,WAA3C,QAA8D,iBAA9D;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,qBAAlB,QAA+C,aAA/C;AAEA,eAAe,SAASC,WAAT,CAAsBC,QAAtB,EAAiC;AAC/C,QAAMC,gBAAgB,GAAGR,SAAS,CAC/BE,MAAF,IAAcA,MAAM,CAAEG,qBAAF,CAAN,CAAgCG,gBAAhC,EADmB,EAEjC,EAFiC,CAAlC;AAIA,QAAM;AAAEC,IAAAA;AAAF,MAA0BR,WAAW,CAAEI,qBAAF,CAA3C;AAEAP,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKU,gBAAL,EAAwB;AACvBD,MAAAA,QAAQ,CAACG,IAAT;AACA,KAFD,MAEO;AACNH,MAAAA,QAAQ,CAACI,KAAT;AACA;AACD,GANQ,EAMN,CAAEJ,QAAF,EAAYC,gBAAZ,CANM,CAAT;AAQA,SAAO,CACNA,gBADM,EAENT,WAAW,CACRa,OAAF,IAAe;AACd,QAAIC,MAAM,GAAGD,OAAb;;AACA,QAAK,OAAOA,OAAP,KAAmB,UAAxB,EAAqC;AACpCC,MAAAA,MAAM,GAAGD,OAAO,CACfT,WAAW,CAAEE,qBAAF,CAAX,CAAqCG,gBAArC,EADe,CAAhB;AAGA;;AAEDC,IAAAA,mBAAmB,CAAEI,MAAF,CAAnB;AACA,GAVS,EAWV,CAAEJ,mBAAF,CAXU,CAFL,CAAP;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useCallback } from '@wordpress/element';\nimport { useSelect, useDispatch, select as selectStore } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as customizeWidgetsStore } from '../../store';\n\nexport default function useInserter( inserter ) {\n\tconst isInserterOpened = useSelect(\n\t\t( select ) => select( customizeWidgetsStore ).isInserterOpened(),\n\t\t[]\n\t);\n\tconst { setIsInserterOpened } = useDispatch( customizeWidgetsStore );\n\n\tuseEffect( () => {\n\t\tif ( isInserterOpened ) {\n\t\t\tinserter.open();\n\t\t} else {\n\t\t\tinserter.close();\n\t\t}\n\t}, [ inserter, isInserterOpened ] );\n\n\treturn [\n\t\tisInserterOpened,\n\t\tuseCallback(\n\t\t\t( updater ) => {\n\t\t\t\tlet isOpen = updater;\n\t\t\t\tif ( typeof updater === 'function' ) {\n\t\t\t\t\tisOpen = updater(\n\t\t\t\t\t\tselectStore( customizeWidgetsStore ).isInserterOpened()\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tsetIsInserterOpened( isOpen );\n\t\t\t},\n\t\t\t[ setIsInserterOpened ]\n\t\t),\n\t];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js"],"names":["useSelect","store","keyboardShortcutsStore","Shortcut","DynamicShortcut","name","keyCombination","description","aliases","select","getShortcutKeyCombination","getShortcutDescription","getShortcutAliases"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,sBAAlB,QAAgD,+BAAhD;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,YAArB;;AAEA,SAASC,eAAT,CAA0B;AAAEC,EAAAA;AAAF,CAA1B,EAAqC;AACpC,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,WAAlB;AAA+BC,IAAAA;AAA/B,MAA2CR,SAAS,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js"],"names":["useSelect","store","keyboardShortcutsStore","Shortcut","DynamicShortcut","name","keyCombination","description","aliases","select","getShortcutKeyCombination","getShortcutDescription","getShortcutAliases"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,sBAAlB,QAAgD,+BAAhD;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,YAArB;;AAEA,SAASC,eAAT,CAA0B;AAAEC,EAAAA;AAAF,CAA1B,EAAqC;AACpC,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,WAAlB;AAA+BC,IAAAA;AAA/B,MAA2CR,SAAS,CACvDS,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,yBADK;AAELC,MAAAA,sBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEP,sBAAF,CAJV;AAMA,WAAO;AACNI,MAAAA,cAAc,EAAEI,yBAAyB,CAAEL,IAAF,CADnC;AAENG,MAAAA,OAAO,EAAEI,kBAAkB,CAAEP,IAAF,CAFrB;AAGNE,MAAAA,WAAW,EAAEI,sBAAsB,CAAEN,IAAF;AAH7B,KAAP;AAKA,GAbwD,EAczD,CAAEA,IAAF,CAdyD,CAA1D;;AAiBA,MAAK,CAAEC,cAAP,EAAwB;AACvB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,QAAD;AACC,IAAA,cAAc,EAAGA,cADlB;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,OAAO,EAAGC;AAHX,IADD;AAOA;;AAED,eAAeJ,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport Shortcut from './shortcut';\n\nfunction DynamicShortcut( { name } ) {\n\tconst { keyCombination, description, aliases } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetShortcutKeyCombination,\n\t\t\t\tgetShortcutDescription,\n\t\t\t\tgetShortcutAliases,\n\t\t\t} = select( keyboardShortcutsStore );\n\n\t\t\treturn {\n\t\t\t\tkeyCombination: getShortcutKeyCombination( name ),\n\t\t\t\taliases: getShortcutAliases( name ),\n\t\t\t\tdescription: getShortcutDescription( name ),\n\t\t\t};\n\t\t},\n\t\t[ name ]\n\t);\n\n\tif ( ! keyCombination ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Shortcut\n\t\t\tkeyCombination={ keyCombination }\n\t\t\tdescription={ description }\n\t\t\taliases={ aliases }\n\t\t/>\n\t);\n}\n\nexport default DynamicShortcut;\n"]}
|
|
@@ -84,9 +84,7 @@ export default function KeyboardShortcutHelpModal({
|
|
|
84
84
|
character: 'h'
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
|
-
useShortcut('core/customize-widgets/keyboard-shortcuts', toggleModal
|
|
88
|
-
bindGlobal: true
|
|
89
|
-
});
|
|
87
|
+
useShortcut('core/customize-widgets/keyboard-shortcuts', toggleModal);
|
|
90
88
|
|
|
91
89
|
if (!isModalActive) {
|
|
92
90
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/index.js"],"names":["classnames","isString","Modal","__","useShortcut","store","keyboardShortcutsStore","useDispatch","useSelect","textFormattingShortcuts","Shortcut","DynamicShortcut","ShortcutList","shortcuts","map","shortcut","index","ShortcutSection","title","className","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","registerShortcut","name","category","description","keyCombination","modifier","character","
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/index.js"],"names":["classnames","isString","Modal","__","useShortcut","store","keyboardShortcutsStore","useDispatch","useSelect","textFormattingShortcuts","Shortcut","DynamicShortcut","ShortcutList","shortcuts","map","shortcut","index","ShortcutSection","title","className","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","registerShortcut","name","category","description","keyCombination","modifier","character","ariaLabel"],"mappings":"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","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { isString } from 'lodash';\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{ isString( shortcut ) ? (\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={ classnames(\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\tcloseLabel={ __( 'Close' ) }\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"]}
|
|
@@ -14,20 +14,14 @@ function KeyboardShortcuts({
|
|
|
14
14
|
useShortcut('core/customize-widgets/undo', event => {
|
|
15
15
|
undo();
|
|
16
16
|
event.preventDefault();
|
|
17
|
-
}, {
|
|
18
|
-
bindGlobal: true
|
|
19
17
|
});
|
|
20
18
|
useShortcut('core/customize-widgets/redo', event => {
|
|
21
19
|
redo();
|
|
22
20
|
event.preventDefault();
|
|
23
|
-
}, {
|
|
24
|
-
bindGlobal: true
|
|
25
21
|
});
|
|
26
22
|
useShortcut('core/customize-widgets/save', event => {
|
|
27
23
|
event.preventDefault();
|
|
28
24
|
save();
|
|
29
|
-
}, {
|
|
30
|
-
bindGlobal: true
|
|
31
25
|
});
|
|
32
26
|
return null;
|
|
33
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcuts/index.js"],"names":["useEffect","useShortcut","store","keyboardShortcutsStore","useDispatch","__","KeyboardShortcuts","undo","redo","save","event","preventDefault","
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcuts/index.js"],"names":["useEffect","useShortcut","store","keyboardShortcutsStore","useDispatch","__","KeyboardShortcuts","undo","redo","save","event","preventDefault","KeyboardShortcutsRegister","registerShortcut","unregisterShortcut","name","category","description","keyCombination","modifier","character","Register"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SACCC,WADD,EAECC,KAAK,IAAIC,sBAFV,QAGO,+BAHP;AAIA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,EAAT,QAAmB,iBAAnB;;AAEA,SAASC,iBAAT,CAA4B;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,IAAR;AAAcC,EAAAA;AAAd,CAA5B,EAAmD;AAClDR,EAAAA,WAAW,CAAE,6BAAF,EAAmCS,KAAF,IAAa;AACxDH,IAAAA,IAAI;AACJG,IAAAA,KAAK,CAACC,cAAN;AACA,GAHU,CAAX;AAKAV,EAAAA,WAAW,CAAE,6BAAF,EAAmCS,KAAF,IAAa;AACxDF,IAAAA,IAAI;AACJE,IAAAA,KAAK,CAACC,cAAN;AACA,GAHU,CAAX;AAKAV,EAAAA,WAAW,CAAE,6BAAF,EAAmCS,KAAF,IAAa;AACxDA,IAAAA,KAAK,CAACC,cAAN;AACAF,IAAAA,IAAI;AACJ,GAHU,CAAX;AAKA,SAAO,IAAP;AACA;;AAED,SAASG,yBAAT,GAAqC;AACpC,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MAA2CV,WAAW,CAC3DD,sBAD2D,CAA5D;AAIAH,EAAAA,SAAS,CAAE,MAAM;AAChBa,IAAAA,gBAAgB,CAAE;AACjBE,MAAAA,IAAI,EAAE,6BADW;AAEjBC,MAAAA,QAAQ,EAAE,QAFO;AAGjBC,MAAAA,WAAW,EAAEZ,EAAE,CAAE,yBAAF,CAHE;AAIjBa,MAAAA,cAAc,EAAE;AACfC,QAAAA,QAAQ,EAAE,SADK;AAEfC,QAAAA,SAAS,EAAE;AAFI;AAJC,KAAF,CAAhB;AAUAP,IAAAA,gBAAgB,CAAE;AACjBE,MAAAA,IAAI,EAAE,6BADW;AAEjBC,MAAAA,QAAQ,EAAE,QAFO;AAGjBC,MAAAA,WAAW,EAAEZ,EAAE,CAAE,sBAAF,CAHE;AAIjBa,MAAAA,cAAc,EAAE;AACfC,QAAAA,QAAQ,EAAE,cADK;AAEfC,QAAAA,SAAS,EAAE;AAFI;AAJC,KAAF,CAAhB;AAUAP,IAAAA,gBAAgB,CAAE;AACjBE,MAAAA,IAAI,EAAE,6BADW;AAEjBC,MAAAA,QAAQ,EAAE,QAFO;AAGjBC,MAAAA,WAAW,EAAEZ,EAAE,CAAE,oBAAF,CAHE;AAIjBa,MAAAA,cAAc,EAAE;AACfC,QAAAA,QAAQ,EAAE,SADK;AAEfC,QAAAA,SAAS,EAAE;AAFI;AAJC,KAAF,CAAhB;AAUA,WAAO,MAAM;AACZN,MAAAA,kBAAkB,CAAE,6BAAF,CAAlB;AACAA,MAAAA,kBAAkB,CAAE,6BAAF,CAAlB;AACAA,MAAAA,kBAAkB,CAAE,6BAAF,CAAlB;AACA,KAJD;AAKA,GApCQ,EAoCN,CAAED,gBAAF,CApCM,CAAT;AAsCA,SAAO,IAAP;AACA;;AAEDP,iBAAiB,CAACe,QAAlB,GAA6BT,yBAA7B;AACA,eAAeN,iBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\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} );\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"]}
|
|
@@ -3,44 +3,35 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { MenuGroup, MenuItem, ToolbarDropdownMenu, VisuallyHidden } from '@wordpress/components';
|
|
7
7
|
import { useState } from '@wordpress/element';
|
|
8
8
|
import { __, _x } from '@wordpress/i18n';
|
|
9
|
-
import { external
|
|
9
|
+
import { external } from '@wordpress/icons';
|
|
10
10
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
11
11
|
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
12
|
+
import { MoreMenuDropdown, MoreMenuFeatureToggle } from '@wordpress/interface';
|
|
12
13
|
/**
|
|
13
14
|
* Internal dependencies
|
|
14
15
|
*/
|
|
15
16
|
|
|
16
|
-
import FeatureToggle from './feature-toggle';
|
|
17
17
|
import KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';
|
|
18
18
|
const POPOVER_PROPS = {
|
|
19
|
-
className: 'customize-widgets-more-menu__content'
|
|
20
|
-
position: 'bottom left'
|
|
21
|
-
};
|
|
22
|
-
const TOGGLE_PROPS = {
|
|
23
|
-
tooltipPosition: 'bottom'
|
|
19
|
+
className: 'customize-widgets-more-menu__content'
|
|
24
20
|
};
|
|
25
21
|
export default function MoreMenu() {
|
|
26
22
|
const [isKeyboardShortcutsModalActive, setIsKeyboardShortcutsModalVisible] = useState(false);
|
|
27
23
|
|
|
28
24
|
const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive);
|
|
29
25
|
|
|
30
|
-
useShortcut('core/customize-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return createElement(Fragment, null, createElement(ToolbarDropdownMenu, {
|
|
26
|
+
useShortcut('core/customize-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal);
|
|
27
|
+
return createElement(Fragment, null, createElement(MoreMenuDropdown, {
|
|
28
|
+
as: ToolbarDropdownMenu,
|
|
34
29
|
className: "customize-widgets-more-menu",
|
|
35
|
-
|
|
36
|
-
/* translators: button label text should, if possible, be under 16 characters. */
|
|
37
|
-
,
|
|
38
|
-
label: __('Options'),
|
|
39
|
-
popoverProps: POPOVER_PROPS,
|
|
40
|
-
toggleProps: TOGGLE_PROPS
|
|
30
|
+
popoverProps: POPOVER_PROPS
|
|
41
31
|
}, () => createElement(Fragment, null, createElement(MenuGroup, {
|
|
42
32
|
label: _x('View', 'noun')
|
|
43
|
-
}, createElement(
|
|
33
|
+
}, createElement(MoreMenuFeatureToggle, {
|
|
34
|
+
scope: "core/customize-widgets",
|
|
44
35
|
feature: "fixedToolbar",
|
|
45
36
|
label: __('Top toolbar'),
|
|
46
37
|
info: __('Access all block and document tools in a single place'),
|
|
@@ -53,7 +44,8 @@ export default function MoreMenu() {
|
|
|
53
44
|
setIsKeyboardShortcutsModalVisible(true);
|
|
54
45
|
},
|
|
55
46
|
shortcut: displayShortcut.access('h')
|
|
56
|
-
}, __('Keyboard shortcuts')), createElement(
|
|
47
|
+
}, __('Keyboard shortcuts')), createElement(MoreMenuFeatureToggle, {
|
|
48
|
+
scope: "core/customize-widgets",
|
|
57
49
|
feature: "welcomeGuide",
|
|
58
50
|
label: __('Welcome Guide')
|
|
59
51
|
}), createElement(MenuItem, {
|
|
@@ -68,7 +60,8 @@ export default function MoreMenu() {
|
|
|
68
60
|
/* translators: accessibility text */
|
|
69
61
|
__('(opens in a new tab)')))), createElement(MenuGroup, {
|
|
70
62
|
label: __('Preferences')
|
|
71
|
-
}, createElement(
|
|
63
|
+
}, createElement(MoreMenuFeatureToggle, {
|
|
64
|
+
scope: "core/customize-widgets",
|
|
72
65
|
feature: "keepCaretInsideBlock",
|
|
73
66
|
label: __('Contain text cursor inside block'),
|
|
74
67
|
info: __('Aids screen readers by stopping text caret from leaving blocks.'),
|