@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/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Install the module
|
|
|
12
12
|
npm install @wordpress/customize-widgets
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
_This package assumes that your code will run in an **ES2015+** environment. If you're using an environment that has limited or no support for
|
|
15
|
+
_This package assumes that your code will run in an **ES2015+** environment. If you're using an environment that has limited or no support for such language features and APIs, you should include [the polyfill shipped in `@wordpress/babel-preset-default`](https://github.com/WordPress/gutenberg/tree/HEAD/packages/babel-preset-default#polyfill) in your code._
|
|
16
16
|
|
|
17
17
|
## Technical implementation details
|
|
18
18
|
|
|
@@ -20,11 +20,11 @@ The new Widgets Customizer replaces `Appearance > Customize > Widgets` with bloc
|
|
|
20
20
|
|
|
21
21
|
We extend the Customizer's sections and controls in the `/controls` directory and inject some custom logic for the editor. We use React portal to render each editor in its section to reuse most of the styles and scripts provided by the Customizer.
|
|
22
22
|
|
|
23
|
-
`components/sidebar-block-editor` is the entry point for each widget area's block editor. `component/sidebar-block-editor/sidebar-adapter.js` is an adapter to talk to [the Customize API](https://developer.wordpress.org/themes/customize-api/) and transform widget objects into widget instances.
|
|
23
|
+
`components/sidebar-block-editor` is the entry point for each widget area's block editor. `component/sidebar-block-editor/sidebar-adapter.js` is an adapter to talk to [the Customize API](https://developer.wordpress.org/themes/customize-api/) and transform widget objects into widget instances.
|
|
24
24
|
|
|
25
25
|
`components/sidebar-block-editor/use-sidebar-block-editor.js` is a custom React Hook to integrate the adapter into React and handle most of the translations between blocks and widgets. These allow us to implement basic editing features as well as real-time preview in a backwards-compatible way.
|
|
26
26
|
|
|
27
|
-
Whenever the blocks change, we run through each block to determine if there are created, edited, or deleted blocks. We then convert them to their widget counterparts and call the Customize API to update them.
|
|
27
|
+
Whenever the blocks change, we run through each block to determine if there are created, edited, or deleted blocks. We then convert them to their widget counterparts and call the Customize API to update them.
|
|
28
28
|
|
|
29
29
|
For React developers, this can be thought of as a custom reconciler or a custom renderer for the Customizer. But instead of targeting DOM as the render target, we are targeting WordPress widgets using the Customize API.
|
|
30
30
|
|
|
@@ -11,6 +11,8 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
|
|
12
12
|
var _components = require("@wordpress/components");
|
|
13
13
|
|
|
14
|
+
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
15
|
+
|
|
14
16
|
var _errorBoundary = _interopRequireDefault(require("../error-boundary"));
|
|
15
17
|
|
|
16
18
|
var _sidebarBlockEditor = _interopRequireDefault(require("../sidebar-block-editor"));
|
|
@@ -60,12 +62,12 @@ function CustomizeWidgets({
|
|
|
60
62
|
className: "customize-widgets-popover",
|
|
61
63
|
ref: popoverRef
|
|
62
64
|
}, (0, _element.createElement)(_components.Popover.Slot, null)), parentContainer);
|
|
63
|
-
return (0, _element.createElement)(_components.SlotFillProvider, null, (0, _element.createElement)(_sidebarControls.default, {
|
|
65
|
+
return (0, _element.createElement)(_keyboardShortcuts.ShortcutProvider, null, (0, _element.createElement)(_components.SlotFillProvider, null, (0, _element.createElement)(_sidebarControls.default, {
|
|
64
66
|
sidebarControls: sidebarControls,
|
|
65
67
|
activeSidebarControl: activeSidebarControl
|
|
66
68
|
}, (0, _element.createElement)(_focusControl.default, {
|
|
67
69
|
api: api,
|
|
68
70
|
sidebarControls: sidebarControls
|
|
69
|
-
}, activeSidebar, popover)));
|
|
71
|
+
}, activeSidebar, popover))));
|
|
70
72
|
}
|
|
71
73
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/customize-widgets/index.js"],"names":["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":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/customize-widgets/index.js"],"names":["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":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAdA;AACA;AACA;;AAKA;AACA;AACA;AAOe,SAASA,gBAAT,CAA2B;AACzCC,EAAAA,GADyC;AAEzCC,EAAAA,eAFyC;AAGzCC,EAAAA;AAHyC,CAA3B,EAIX;AACH,QAAM,CAAEC,oBAAF,EAAwBC,uBAAxB,IAAoD,uBAAU,IAAV,CAA1D;AACA,QAAMC,eAAe,GAAGC,QAAQ,CAACC,cAAT,CACvB,0BADuB,CAAxB;AAGA,QAAMC,UAAU,GAAG,sBAAnB;AAEA,sCAAuBL,oBAAvB,EAA6CK,UAA7C;AAEA,0BAAW,MAAM;AAChB,UAAMC,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,GAZD,EAYG,CAAEd,eAAF,CAZH;AAcA,QAAMe,aAAa,GAClBb,oBAAoB,IACpB,2BACC,4BAAC,sBAAD,QACC,4BAAC,2BAAD;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,CADD,EAUCjB,oBAAoB,CAACkB,SAArB,CAAgC,CAAhC,CAVD,CAFD,CAvBG,CAsCH;AACA;;AACA,QAAMC,OAAO,GACZjB,eAAe,IACf,2BACC;AAAK,IAAA,SAAS,EAAC,2BAAf;AAA2C,IAAA,GAAG,EAAGG;AAAjD,KACC,4BAAC,mBAAD,CAAS,IAAT,OADD,CADD,EAICH,eAJD,CAFD;AASA,SACC,4BAAC,mCAAD,QACC,4BAAC,4BAAD,QACC,4BAAC,wBAAD;AACC,IAAA,eAAe,EAAGJ,eADnB;AAEC,IAAA,oBAAoB,EAAGE;AAFxB,KAIC,4BAAC,qBAAD;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"]}
|
|
@@ -32,7 +32,7 @@ function Inserter({
|
|
|
32
32
|
setIsOpened
|
|
33
33
|
}) {
|
|
34
34
|
const inserterTitleId = (0, _compose.useInstanceId)(Inserter, 'customize-widget-layout__inserter-panel-title');
|
|
35
|
-
const insertionPoint = (0, _data.useSelect)(select => select(_store.store).__experimentalGetInsertionPoint());
|
|
35
|
+
const insertionPoint = (0, _data.useSelect)(select => select(_store.store).__experimentalGetInsertionPoint(), []);
|
|
36
36
|
return (0, _element.createElement)("div", {
|
|
37
37
|
className: "customize-widgets-layout__inserter-panel",
|
|
38
38
|
"aria-labelledby": inserterTitleId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/inserter/index.js"],"names":["Inserter","setIsOpened","inserterTitleId","insertionPoint","select","customizeWidgetsStore","__experimentalGetInsertionPoint","closeSmall","rootClientId","insertionIndex"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAbA;AACA;AACA;;AAQA;AACA;AACA;AAGA,SAASA,QAAT,CAAmB;AAAEC,EAAAA;AAAF,CAAnB,EAAqC;AACpC,QAAMC,eAAe,GAAG,4BACvBF,QADuB,EAEvB,+CAFuB,CAAxB;AAIA,QAAMG,cAAc,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/inserter/index.js"],"names":["Inserter","setIsOpened","inserterTitleId","insertionPoint","select","customizeWidgetsStore","__experimentalGetInsertionPoint","closeSmall","rootClientId","insertionIndex"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAbA;AACA;AACA;;AAQA;AACA;AACA;AAGA,SAASA,QAAT,CAAmB;AAAEC,EAAAA;AAAF,CAAnB,EAAqC;AACpC,QAAMC,eAAe,GAAG,4BACvBF,QADuB,EAEvB,+CAFuB,CAAxB;AAIA,QAAMG,cAAc,GAAG,qBACpBC,MAAF,IACCA,MAAM,CAAEC,YAAF,CAAN,CAAgCC,+BAAhC,EAFqB,EAGtB,EAHsB,CAAvB;AAMA,SACC;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,uBAAkBJ;AAFnB,KAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AACC,IAAA,EAAE,EAAGA,eADN;AAEC,IAAA,SAAS,EAAC;AAFX,KAIG,cAAI,aAAJ,CAJH,CADD,EAOC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,8DADX;AAEC,IAAA,IAAI,EAAGK,iBAFR;AAGC,IAAA,OAAO,EAAG,MAAMN,WAAW,CAAE,KAAF,CAH5B;AAIC,kBAAa,cAAI,gBAAJ;AAJd,IAPD,CAJD,EAkBC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kCAAD;AACC,IAAA,YAAY,EAAGE,cAAc,CAACK,YAD/B;AAEC,IAAA,4BAA4B,EAC3BL,cAAc,CAACM,cAHjB;AAKC,IAAA,qBAAqB,MALtB;AAMC,IAAA,QAAQ,EAAG,MAAMR,WAAW,CAAE,KAAF;AAN7B,IADD,CAlBD,CADD;AA+BA;;eAEcD,Q","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"]}
|
|
@@ -19,7 +19,7 @@ var _store = require("../../store");
|
|
|
19
19
|
* Internal dependencies
|
|
20
20
|
*/
|
|
21
21
|
function useInserter(inserter) {
|
|
22
|
-
const isInserterOpened = (0, _data.useSelect)(select => select(_store.store).isInserterOpened());
|
|
22
|
+
const isInserterOpened = (0, _data.useSelect)(select => select(_store.store).isInserterOpened(), []);
|
|
23
23
|
const {
|
|
24
24
|
setIsInserterOpened
|
|
25
25
|
} = (0, _data.useDispatch)(_store.store);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/inserter/use-inserter.js"],"names":["useInserter","inserter","isInserterOpened","select","customizeWidgetsStore","setIsInserterOpened","open","close","updater","isOpen"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGe,SAASA,WAAT,CAAsBC,QAAtB,EAAiC;AAC/C,QAAMC,gBAAgB,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/inserter/use-inserter.js"],"names":["useInserter","inserter","isInserterOpened","select","customizeWidgetsStore","setIsInserterOpened","open","close","updater","isOpen"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGe,SAASA,WAAT,CAAsBC,QAAtB,EAAiC;AAC/C,QAAMC,gBAAgB,GAAG,qBACtBC,MAAF,IAAcA,MAAM,CAAEC,YAAF,CAAN,CAAgCF,gBAAhC,EADU,EAExB,EAFwB,CAAzB;AAIA,QAAM;AAAEG,IAAAA;AAAF,MAA0B,uBAAaD,YAAb,CAAhC;AAEA,0BAAW,MAAM;AAChB,QAAKF,gBAAL,EAAwB;AACvBD,MAAAA,QAAQ,CAACK,IAAT;AACA,KAFD,MAEO;AACNL,MAAAA,QAAQ,CAACM,KAAT;AACA;AACD,GAND,EAMG,CAAEN,QAAF,EAAYC,gBAAZ,CANH;AAQA,SAAO,CACNA,gBADM,EAEN,0BACGM,OAAF,IAAe;AACd,QAAIC,MAAM,GAAGD,OAAb;;AACA,QAAK,OAAOA,OAAP,KAAmB,UAAxB,EAAqC;AACpCC,MAAAA,MAAM,GAAGD,OAAO,CACf,kBAAaJ,YAAb,EAAqCF,gBAArC,EADe,CAAhB;AAGA;;AAEDG,IAAAA,mBAAmB,CAAEI,MAAF,CAAnB;AACA,GAVF,EAWC,CAAEJ,mBAAF,CAXD,CAFM,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":["DynamicShortcut","name","keyCombination","description","aliases","select","getShortcutKeyCombination","getShortcutDescription","getShortcutAliases","keyboardShortcutsStore"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,eAAT,CAA0B;AAAEC,EAAAA;AAAF,CAA1B,EAAqC;AACpC,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,WAAlB;AAA+BC,IAAAA;AAA/B,MAA2C,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js"],"names":["DynamicShortcut","name","keyCombination","description","aliases","select","getShortcutKeyCombination","getShortcutDescription","getShortcutAliases","keyboardShortcutsStore"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,eAAT,CAA0B;AAAEC,EAAAA;AAAF,CAA1B,EAAqC;AACpC,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,WAAlB;AAA+BC,IAAAA;AAA/B,MAA2C,qBAC9CC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,yBADK;AAELC,MAAAA,sBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEI,wBAAF,CAJV;AAMA,WAAO;AACNP,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,GAb+C,EAchD,CAAEA,IAAF,CAdgD,CAAjD;;AAiBA,MAAK,CAAEC,cAAP,EAAwB;AACvB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,iBAAD;AACC,IAAA,cAAc,EAAGA,cADlB;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,OAAO,EAAGC;AAHX,IADD;AAOA;;eAEcJ,e","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"]}
|
|
@@ -101,9 +101,7 @@ function KeyboardShortcutHelpModal({
|
|
|
101
101
|
character: 'h'
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
|
-
(0, _keyboardShortcuts.useShortcut)('core/customize-widgets/keyboard-shortcuts', toggleModal
|
|
105
|
-
bindGlobal: true
|
|
106
|
-
});
|
|
104
|
+
(0, _keyboardShortcuts.useShortcut)('core/customize-widgets/keyboard-shortcuts', toggleModal);
|
|
107
105
|
|
|
108
106
|
if (!isModalActive) {
|
|
109
107
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/index.js"],"names":["ShortcutList","shortcuts","map","shortcut","index","ShortcutSection","title","className","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","keyboardShortcutsStore","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":["ShortcutList","shortcuts","map","shortcut","index","ShortcutSection","title","className","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","keyboardShortcutsStore","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","registerShortcut","name","category","description","keyCombination","modifier","character","ariaLabel","textFormattingShortcuts"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAIA;AACA;AACA;;AASA;AACA;AACA;AAKA,MAAMA,YAAY,GAAG,CAAE;AAAEC,EAAAA;AAAF,CAAF;AACpB;AACD;AACA;AACA;;AACC;AACA;AACC,EAAA,SAAS,EAAC,+DADX;AAEC,EAAA,IAAI,EAAC;AAFN,GAIGA,SAAS,CAACC,GAAV,C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EAAE,cAAI,mCAAJ,CAHI;AAIjBC,IAAAA,cAAc,EAAE;AACfC,MAAAA,QAAQ,EAAE,QADK;AAEfC,MAAAA,SAAS,EAAE;AAFI;AAJC,GAAF,CAAhB;AAUA,sCAAa,2CAAb,EAA0DP,WAA1D;;AAEA,MAAK,CAAED,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,iBAAD;AACC,IAAA,SAAS,EAAC,gDADX;AAEC,IAAA,KAAK,EAAG,cAAI,oBAAJ,CAFT;AAGC,IAAA,UAAU,EAAG,cAAI,OAAJ,CAHd;AAIC,IAAA,cAAc,EAAGC;AAJlB,KAMC,4BAAC,eAAD;AACC,IAAA,SAAS,EAAC,gEADX;AAEC,IAAA,SAAS,EAAG,CAAE,2CAAF;AAFb,IAND,EAUC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,kBAAJ,CADT;AAEC,IAAA,YAAY,EAAC;AAFd,IAVD,EAeC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,qBAAJ,CADT;AAEC,IAAA,YAAY,EAAC;AAFd,IAfD,EAoBC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,iBAAJ,CADT;AAEC,IAAA,YAAY,EAAC,OAFd;AAGC,IAAA,mBAAmB,EAAG,CACrB;AACCK,MAAAA,cAAc,EAAE;AAAEE,QAAAA,SAAS,EAAE;AAAb,OADjB;AAECH,MAAAA,WAAW,EAAE,cACZ,qDADY,CAFd;;AAKC;AACAI,MAAAA,SAAS,EAAE,cAAI,eAAJ;AANZ,KADqB;AAHvB,IApBD,EAkCC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,iBAAJ,CADT;AAEC,IAAA,SAAS,EAAGC;AAFb,IAlCD,CADD;AAyCA","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"]}
|
|
@@ -24,20 +24,14 @@ function KeyboardShortcuts({
|
|
|
24
24
|
(0, _keyboardShortcuts.useShortcut)('core/customize-widgets/undo', event => {
|
|
25
25
|
undo();
|
|
26
26
|
event.preventDefault();
|
|
27
|
-
}, {
|
|
28
|
-
bindGlobal: true
|
|
29
27
|
});
|
|
30
28
|
(0, _keyboardShortcuts.useShortcut)('core/customize-widgets/redo', event => {
|
|
31
29
|
redo();
|
|
32
30
|
event.preventDefault();
|
|
33
|
-
}, {
|
|
34
|
-
bindGlobal: true
|
|
35
31
|
});
|
|
36
32
|
(0, _keyboardShortcuts.useShortcut)('core/customize-widgets/save', event => {
|
|
37
33
|
event.preventDefault();
|
|
38
34
|
save();
|
|
39
|
-
}, {
|
|
40
|
-
bindGlobal: true
|
|
41
35
|
});
|
|
42
36
|
return null;
|
|
43
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcuts/index.js"],"names":["KeyboardShortcuts","undo","redo","save","event","preventDefault","
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcuts/index.js"],"names":["KeyboardShortcuts","undo","redo","save","event","preventDefault","KeyboardShortcutsRegister","registerShortcut","unregisterShortcut","keyboardShortcutsStore","name","category","description","keyCombination","modifier","character","Register"],"mappings":";;;;;;;AAGA;;AACA;;AAIA;;AACA;;AATA;AACA;AACA;AASA,SAASA,iBAAT,CAA4B;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,IAAR;AA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EAAE;AAFI;AAJC,KAAF,CAAhB;AAUA,WAAO,MAAM;AACZP,MAAAA,kBAAkB,CAAE,6BAAF,CAAlB;AACAA,MAAAA,kBAAkB,CAAE,6BAAF,CAAlB;AACAA,MAAAA,kBAAkB,CAAE,6BAAF,CAAlB;AACA,KAJD;AAKA,GApCD,EAoCG,CAAED,gBAAF,CApCH;AAsCA,SAAO,IAAP;AACA;;AAEDP,iBAAiB,CAACgB,QAAlB,GAA6BV,yBAA7B;eACeN,iB","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"]}
|
|
@@ -19,7 +19,7 @@ var _keycodes = require("@wordpress/keycodes");
|
|
|
19
19
|
|
|
20
20
|
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _interface = require("@wordpress/interface");
|
|
23
23
|
|
|
24
24
|
var _keyboardShortcutHelpModal = _interopRequireDefault(require("../keyboard-shortcut-help-modal"));
|
|
25
25
|
|
|
@@ -31,11 +31,7 @@ var _keyboardShortcutHelpModal = _interopRequireDefault(require("../keyboard-sho
|
|
|
31
31
|
* Internal dependencies
|
|
32
32
|
*/
|
|
33
33
|
const POPOVER_PROPS = {
|
|
34
|
-
className: 'customize-widgets-more-menu__content'
|
|
35
|
-
position: 'bottom left'
|
|
36
|
-
};
|
|
37
|
-
const TOGGLE_PROPS = {
|
|
38
|
-
tooltipPosition: 'bottom'
|
|
34
|
+
className: 'customize-widgets-more-menu__content'
|
|
39
35
|
};
|
|
40
36
|
|
|
41
37
|
function MoreMenu() {
|
|
@@ -43,20 +39,15 @@ function MoreMenu() {
|
|
|
43
39
|
|
|
44
40
|
const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive);
|
|
45
41
|
|
|
46
|
-
(0, _keyboardShortcuts.useShortcut)('core/customize-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.ToolbarDropdownMenu, {
|
|
42
|
+
(0, _keyboardShortcuts.useShortcut)('core/customize-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal);
|
|
43
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_interface.MoreMenuDropdown, {
|
|
44
|
+
as: _components.ToolbarDropdownMenu,
|
|
50
45
|
className: "customize-widgets-more-menu",
|
|
51
|
-
|
|
52
|
-
/* translators: button label text should, if possible, be under 16 characters. */
|
|
53
|
-
,
|
|
54
|
-
label: (0, _i18n.__)('Options'),
|
|
55
|
-
popoverProps: POPOVER_PROPS,
|
|
56
|
-
toggleProps: TOGGLE_PROPS
|
|
46
|
+
popoverProps: POPOVER_PROPS
|
|
57
47
|
}, () => (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.MenuGroup, {
|
|
58
48
|
label: (0, _i18n._x)('View', 'noun')
|
|
59
|
-
}, (0, _element.createElement)(
|
|
49
|
+
}, (0, _element.createElement)(_interface.MoreMenuFeatureToggle, {
|
|
50
|
+
scope: "core/customize-widgets",
|
|
60
51
|
feature: "fixedToolbar",
|
|
61
52
|
label: (0, _i18n.__)('Top toolbar'),
|
|
62
53
|
info: (0, _i18n.__)('Access all block and document tools in a single place'),
|
|
@@ -69,7 +60,8 @@ function MoreMenu() {
|
|
|
69
60
|
setIsKeyboardShortcutsModalVisible(true);
|
|
70
61
|
},
|
|
71
62
|
shortcut: _keycodes.displayShortcut.access('h')
|
|
72
|
-
}, (0, _i18n.__)('Keyboard shortcuts')), (0, _element.createElement)(
|
|
63
|
+
}, (0, _i18n.__)('Keyboard shortcuts')), (0, _element.createElement)(_interface.MoreMenuFeatureToggle, {
|
|
64
|
+
scope: "core/customize-widgets",
|
|
73
65
|
feature: "welcomeGuide",
|
|
74
66
|
label: (0, _i18n.__)('Welcome Guide')
|
|
75
67
|
}), (0, _element.createElement)(_components.MenuItem, {
|
|
@@ -84,7 +76,8 @@ function MoreMenu() {
|
|
|
84
76
|
/* translators: accessibility text */
|
|
85
77
|
(0, _i18n.__)('(opens in a new tab)')))), (0, _element.createElement)(_components.MenuGroup, {
|
|
86
78
|
label: (0, _i18n.__)('Preferences')
|
|
87
|
-
}, (0, _element.createElement)(
|
|
79
|
+
}, (0, _element.createElement)(_interface.MoreMenuFeatureToggle, {
|
|
80
|
+
scope: "core/customize-widgets",
|
|
88
81
|
feature: "keepCaretInsideBlock",
|
|
89
82
|
label: (0, _i18n.__)('Contain text cursor inside block'),
|
|
90
83
|
info: (0, _i18n.__)('Aids screen readers by stopping text caret from leaving blocks.'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/more-menu/index.js"],"names":["POPOVER_PROPS","className","
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/more-menu/index.js"],"names":["POPOVER_PROPS","className","MoreMenu","isKeyboardShortcutsModalActive","setIsKeyboardShortcutsModalVisible","toggleKeyboardShortcutsModal","ToolbarDropdownMenu","displayShortcut","access","external"],"mappings":";;;;;;;;;AASA;;AANA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAnBA;AACA;AACA;;AAcA;AACA;AACA;AAGA,MAAMA,aAAa,GAAG;AACrBC,EAAAA,SAAS,EAAE;AADU,CAAtB;;AAIe,SAASC,QAAT,GAAoB;AAClC,QAAM,CACLC,8BADK,EAELC,kCAFK,IAGF,uBAAU,KAAV,CAHJ;;AAIA,QAAMC,4BAA4B,GAAG,MACpCD,kCAAkC,CAAE,CAAED,8BAAJ,CADnC;;AAGA,sCACC,2CADD,EAECE,4BAFD;AAKA,SACC,qDACC,4BAAC,2BAAD;AACC,IAAA,EAAE,EAAGC,+BADN;AAEC,IAAA,SAAS,EAAC,6BAFX;AAGC,IAAA,YAAY,EAAGN;AAH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,CAHT;AAMC,IAAA,IAAI,EAAG,cACN,iEADM,CANR;AASC,IAAA,gBAAgB,EAAG,cAClB,4CADkB,CATpB;AAYC,IAAA,kBAAkB,EAAG,cACpB,8CADoB;AAZtB,IADD,CAjDD,CANF,CADD,EA6EC,4BAAC,kCAAD;AACC,IAAA,aAAa,EAAGN,8BADjB;AAEC,IAAA,WAAW,EAAGE;AAFf,IA7ED,CADD;AAoFA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tToolbarDropdownMenu,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { external } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { MoreMenuDropdown, MoreMenuFeatureToggle } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\n\nconst POPOVER_PROPS = {\n\tclassName: 'customize-widgets-more-menu__content',\n};\n\nexport default function MoreMenu() {\n\tconst [\n\t\tisKeyboardShortcutsModalActive,\n\t\tsetIsKeyboardShortcutsModalVisible,\n\t] = useState( false );\n\tconst toggleKeyboardShortcutsModal = () =>\n\t\tsetIsKeyboardShortcutsModalVisible( ! isKeyboardShortcutsModalActive );\n\n\tuseShortcut(\n\t\t'core/customize-widgets/keyboard-shortcuts',\n\t\ttoggleKeyboardShortcutsModal\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<MoreMenuDropdown\n\t\t\t\tas={ ToolbarDropdownMenu }\n\t\t\t\tclassName=\"customize-widgets-more-menu\"\n\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t>\n\t\t\t\t{ () => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t<MoreMenuFeatureToggle\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tfeature=\"fixedToolbar\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsKeyboardShortcutsModalVisible( true );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MoreMenuFeatureToggle\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tfeature=\"welcomeGuide\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Welcome Guide' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/block-based-widgets-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Preferences' ) }>\n\t\t\t\t\t\t\t<MoreMenuFeatureToggle\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tfeature=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Aids screen readers by stopping text caret from leaving blocks.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</MoreMenuDropdown>\n\t\t\t<KeyboardShortcutHelpModal\n\t\t\t\tisModalActive={ isKeyboardShortcutsModalActive }\n\t\t\t\ttoggleModal={ toggleKeyboardShortcutsModal }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -19,6 +19,8 @@ var _blockEditor = require("@wordpress/block-editor");
|
|
|
19
19
|
|
|
20
20
|
var _mediaUtils = require("@wordpress/media-utils");
|
|
21
21
|
|
|
22
|
+
var _interface = require("@wordpress/interface");
|
|
23
|
+
|
|
22
24
|
var _blockInspectorButton = _interopRequireDefault(require("../block-inspector-button"));
|
|
23
25
|
|
|
24
26
|
var _header = _interopRequireDefault(require("../header"));
|
|
@@ -27,8 +29,6 @@ var _useInserter = _interopRequireDefault(require("../inserter/use-inserter"));
|
|
|
27
29
|
|
|
28
30
|
var _sidebarEditorProvider = _interopRequireDefault(require("./sidebar-editor-provider"));
|
|
29
31
|
|
|
30
|
-
var _store = require("../../store");
|
|
31
|
-
|
|
32
32
|
var _welcomeGuide = _interopRequireDefault(require("../welcome-guide"));
|
|
33
33
|
|
|
34
34
|
var _keyboardShortcuts = _interopRequireDefault(require("../keyboard-shortcuts"));
|
|
@@ -59,11 +59,14 @@ function SidebarBlockEditor({
|
|
|
59
59
|
keepCaretInsideBlock,
|
|
60
60
|
isWelcomeGuideActive
|
|
61
61
|
} = (0, _data.useSelect)(select => {
|
|
62
|
+
const {
|
|
63
|
+
isFeatureActive
|
|
64
|
+
} = select(_interface.store);
|
|
62
65
|
return {
|
|
63
66
|
hasUploadPermissions: (0, _lodash.defaultTo)(select(_coreData.store).canUser('create', 'media'), true),
|
|
64
|
-
isFixedToolbarActive:
|
|
65
|
-
keepCaretInsideBlock:
|
|
66
|
-
isWelcomeGuideActive:
|
|
67
|
+
isFixedToolbarActive: isFeatureActive('core/customize-widgets', 'fixedToolbar'),
|
|
68
|
+
keepCaretInsideBlock: isFeatureActive('core/customize-widgets', 'keepCaretInsideBlock'),
|
|
69
|
+
isWelcomeGuideActive: isFeatureActive('core/customize-widgets', 'welcomeGuide')
|
|
67
70
|
};
|
|
68
71
|
}, []);
|
|
69
72
|
const settings = (0, _element.useMemo)(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/index.js"],"names":["SidebarBlockEditor","blockEditorSettings","sidebar","inserter","inspector","isInserterOpened","setIsInserterOpened","hasUploadPermissions","isFixedToolbarActive","keepCaretInsideBlock","isWelcomeGuideActive","select","
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/index.js"],"names":["SidebarBlockEditor","blockEditorSettings","sidebar","inserter","inspector","isInserterOpened","setIsInserterOpened","hasUploadPermissions","isFixedToolbarActive","keepCaretInsideBlock","isWelcomeGuideActive","select","isFeatureActive","interfaceStore","coreStore","canUser","settings","mediaUploadBlockEditor","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalSetIsInserterOpened","mediaUpload","hasFixedToolbar","__unstableHasCustomAppender","undo","redo","save","BlockAppender","event","preventDefault","contentContainer","onClose"],"mappings":";;;;;;;;;AAUA;;AAPA;;AAKA;;AACA;;AAEA;;AAWA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAlCA;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;AASe,SAASA,kBAAT,CAA6B;AAC3CC,EAAAA,mBAD2C;AAE3CC,EAAAA,OAF2C;AAG3CC,EAAAA,QAH2C;AAI3CC,EAAAA;AAJ2C,CAA7B,EAKX;AACH,QAAM,CAAEC,gBAAF,EAAoBC,mBAApB,IAA4C,0BAAaH,QAAb,CAAlD;AACA,QAAM;AACLI,IAAAA,oBADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA;AAJK,MAKF,qBAAaC,MAAF,IAAc;AAC5B,UAAM;AAAEC,MAAAA;AAAF,QAAsBD,MAAM,CAAEE,gBAAF,CAAlC;AACA,WAAO;AACNN,MAAAA,oBAAoB,EAAE,uBACrBI,MAAM,CAAEG,eAAF,CAAN,CAAoBC,OAApB,CAA6B,QAA7B,EAAuC,OAAvC,CADqB,EAErB,IAFqB,CADhB;AAKNP,MAAAA,oBAAoB,EAAEI,eAAe,CACpC,wBADoC,EAEpC,cAFoC,CAL/B;AASNH,MAAAA,oBAAoB,EAAEG,eAAe,CACpC,wBADoC,EA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AAI,EAAG1B,OAAO,CAAC2B;AAHhB,IADD,EAOC,4BAAC,eAAD;AACC,IAAA,OAAO,EAAG3B,OADX;AAEC,IAAA,QAAQ,EAAGC,QAFZ;AAGC,IAAA,gBAAgB,EAAGE,gBAHpB;AAIC,IAAA,mBAAmB,EAAGC,mBAJvB;AAKC,IAAA,oBAAoB,EAAGE;AALxB,IAPD,EAeC,4BAAC,wBAAD,QACC,4BAAC,uBAAD,QACC,4BAAC,kCAAD,QACC,4BAAC,wBAAD,QACC,4BAAC,0BAAD,QACC,4BAAC,sBAAD;AACC,IAAA,cAAc,EAAGsB;AADlB,IADD,CADD,CADD,CADD,CADD,CAfD,EA6BG,4BACD;AACA;AACA;AAAM,IAAA,QAAQ,EAAKC,KAAF,IAAaA,KAAK,CAACC,cAAN;AAA9B,KACC,4BAAC,2BAAD,OADD,CAHC,EAMD5B,SAAS,CAAC6B,gBAAV,CAA4B,CAA5B,CANC,CA7BH,CAJD,EA2CC,4BAAC,iDAAD,QACG,CAAE;AAAEC,IAAAA;AAAF,GAAF,KACD,4BAAC,6BAAD;AACC,IAAA,SAAS,EAAG9B,SADb;AAEC,IAAA,SAAS,EAAG8B;AAFb,IAFF,CA3CD,CADD;AAsDA","sourcesContent":["/**\n * External dependencies\n */\nimport { defaultTo } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, createPortal } from '@wordpress/element';\nimport {\n\tBlockList,\n\tBlockTools,\n\tBlockSelectionClearer,\n\tBlockInspector,\n\tCopyHandler,\n\tObserveTyping,\n\tWritingFlow,\n\tBlockEditorKeyboardShortcuts,\n\t__unstableBlockSettingsMenuFirstItem,\n} from '@wordpress/block-editor';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from '../block-inspector-button';\nimport Header from '../header';\nimport useInserter from '../inserter/use-inserter';\nimport SidebarEditorProvider from './sidebar-editor-provider';\nimport WelcomeGuide from '../welcome-guide';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport BlockAppender from '../block-appender';\n\nexport default function SidebarBlockEditor( {\n\tblockEditorSettings,\n\tsidebar,\n\tinserter,\n\tinspector,\n} ) {\n\tconst [ isInserterOpened, setIsInserterOpened ] = useInserter( inserter );\n\tconst {\n\t\thasUploadPermissions,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tisWelcomeGuideActive,\n\t} = useSelect( ( select ) => {\n\t\tconst { isFeatureActive } = select( interfaceStore );\n\t\treturn {\n\t\t\thasUploadPermissions: defaultTo(\n\t\t\t\tselect( coreStore ).canUser( 'create', 'media' ),\n\t\t\t\ttrue\n\t\t\t),\n\t\t\tisFixedToolbarActive: isFeatureActive(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: isFeatureActive(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tisWelcomeGuideActive: isFeatureActive(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'welcomeGuide'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( hasUploadPermissions ) {\n\t\t\tmediaUploadBlockEditor = ( { onError, ...argumentsObject } ) => {\n\t\t\t\tuploadMedia( {\n\t\t\t\t\twpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,\n\t\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t\t...argumentsObject,\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\t...blockEditorSettings,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\thasFixedToolbar: isFixedToolbarActive,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t__unstableHasCustomAppender: true,\n\t\t};\n\t}, [\n\t\thasUploadPermissions,\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tsetIsInserterOpened,\n\t] );\n\n\tif ( isWelcomeGuideActive ) {\n\t\treturn <WelcomeGuide sidebar={ sidebar } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t<KeyboardShortcuts.Register />\n\n\t\t\t<SidebarEditorProvider sidebar={ sidebar } settings={ settings }>\n\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\tundo={ sidebar.undo }\n\t\t\t\t\tredo={ sidebar.redo }\n\t\t\t\t\tsave={ sidebar.save }\n\t\t\t\t/>\n\n\t\t\t\t<Header\n\t\t\t\t\tsidebar={ sidebar }\n\t\t\t\t\tinserter={ inserter }\n\t\t\t\t\tisInserterOpened={ isInserterOpened }\n\t\t\t\t\tsetIsInserterOpened={ setIsInserterOpened }\n\t\t\t\t\tisFixedToolbarActive={ isFixedToolbarActive }\n\t\t\t\t/>\n\n\t\t\t\t<CopyHandler>\n\t\t\t\t\t<BlockTools>\n\t\t\t\t\t\t<BlockSelectionClearer>\n\t\t\t\t\t\t\t<WritingFlow>\n\t\t\t\t\t\t\t\t<ObserveTyping>\n\t\t\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\t\t\trenderAppender={ BlockAppender }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ObserveTyping>\n\t\t\t\t\t\t\t</WritingFlow>\n\t\t\t\t\t\t</BlockSelectionClearer>\n\t\t\t\t\t</BlockTools>\n\t\t\t\t</CopyHandler>\n\n\t\t\t\t{ createPortal(\n\t\t\t\t\t// This is a temporary hack to prevent button component inside <BlockInspector>\n\t\t\t\t\t// from submitting form when type=\"button\" is not specified.\n\t\t\t\t\t<form onSubmit={ ( event ) => event.preventDefault() }>\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t</form>,\n\t\t\t\t\tinspector.contentContainer[ 0 ]\n\t\t\t\t) }\n\t\t\t</SidebarEditorProvider>\n\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton\n\t\t\t\t\t\tinspector={ inspector }\n\t\t\t\t\t\tcloseMenu={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -13,21 +13,17 @@ var _components = require("@wordpress/components");
|
|
|
13
13
|
|
|
14
14
|
var _data = require("@wordpress/data");
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _interface = require("@wordpress/interface");
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* WordPress dependencies
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies
|
|
24
|
-
*/
|
|
25
21
|
function WelcomeGuide({
|
|
26
22
|
sidebar
|
|
27
23
|
}) {
|
|
28
24
|
const {
|
|
29
|
-
|
|
30
|
-
} = (0, _data.useDispatch)(
|
|
25
|
+
toggleFeature
|
|
26
|
+
} = (0, _data.useDispatch)(_interface.store);
|
|
31
27
|
const isEntirelyBlockWidgets = sidebar.getWidgets().every(widget => widget.id.startsWith('block-'));
|
|
32
28
|
return (0, _element.createElement)("div", {
|
|
33
29
|
className: "customize-widgets-welcome-guide"
|
|
@@ -49,7 +45,7 @@ function WelcomeGuide({
|
|
|
49
45
|
}, isEntirelyBlockWidgets ? (0, _i18n.__)('Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.') : (0, _i18n.__)('You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.')), (0, _element.createElement)(_components.Button, {
|
|
50
46
|
className: "customize-widgets-welcome-guide__button",
|
|
51
47
|
variant: "primary",
|
|
52
|
-
onClick: () => toggleFeature('welcomeGuide')
|
|
48
|
+
onClick: () => toggleFeature('core/customize-widgets', 'welcomeGuide')
|
|
53
49
|
}, (0, _i18n.__)('Got it')), (0, _element.createElement)("hr", {
|
|
54
50
|
className: "customize-widgets-welcome-guide__separator"
|
|
55
51
|
}), !isEntirelyBlockWidgets && (0, _element.createElement)("p", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/welcome-guide/index.js"],"names":["WelcomeGuide","sidebar","
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/welcome-guide/index.js"],"names":["WelcomeGuide","sidebar","toggleFeature","interfaceStore","isEntirelyBlockWidgets","getWidgets","every","widget","id","startsWith"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;AAMe,SAASA,YAAT,CAAuB;AAAEC,EAAAA;AAAF,CAAvB,EAAqC;AACnD,QAAM;AAAEC,IAAAA;AAAF,MAAoB,uBAAaC,gBAAb,CAA1B;AAEA,QAAMC,sBAAsB,GAAGH,OAAO,CACpCI,UAD6B,GAE7BC,KAF6B,CAEpBC,MAAF,IAAcA,MAAM,CAACC,EAAP,CAAUC,UAAV,CAAsB,QAAtB,CAFQ,CAA/B;AAIA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,6CACC;AACC,IAAA,MAAM,EAAC,wDADR;AAEC,IAAA,KAAK,EAAC;AAFP,IADD,EAKC;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,GAAG,EAAC,wDAFL;AAGC,IAAA,KAAK,EAAC,KAHP;AAIC,IAAA,MAAM,EAAC,KAJR;AAKC,IAAA,GAAG,EAAC;AALL,IALD,CADD,CADD,EAgBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACG,cAAI,0BAAJ,CADH,CAhBD,EAmBC;AAAG,IAAA,SAAS,EAAC;AAAb,KACGL,sBAAsB,GACrB,cACA,0LADA,CADqB,GAIrB,cACA,yHADA,CALJ,CAnBD,EA4BC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,yCADX;AAEC,IAAA,OAAO,EAAC,SAFT;AAGC,IAAA,OAAO,EAAG,MACTF,aAAa,CAAE,wBAAF,EAA4B,cAA5B;AAJf,KAOG,cAAI,QAAJ,CAPH,CA5BD,EAqCC;AAAI,IAAA,SAAS,EAAC;AAAd,IArCD,EAsCG,CAAEE,sBAAF,IACD;AAAG,IAAA,SAAS,EAAC;AAAb,KACG,cAAI,qCAAJ,CADH,EAEC,uCAFD,EAGC,4BAAC,wBAAD;AACC,IAAA,IAAI,EAAG,cACN,gDADM;AADR,KAKG,cAAI,iCAAJ,CALH,CAHD,CAvCF,EAmDC;AAAG,IAAA,SAAS,EAAC;AAAb,KACG,cAAI,0BAAJ,CADH,EAEC,uCAFD,EAGC,4BAAC,wBAAD;AACC,IAAA,IAAI,EAAG,cACN,yDADM;AADR,KAKG,cAAI,0BAAJ,CALH,CAHD,CAnDD,CADD;AAiEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button, ExternalLink } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\nexport default function WelcomeGuide( { sidebar } ) {\n\tconst { toggleFeature } = useDispatch( interfaceStore );\n\n\tconst isEntirelyBlockWidgets = sidebar\n\t\t.getWidgets()\n\t\t.every( ( widget ) => widget.id.startsWith( 'block-' ) );\n\n\treturn (\n\t\t<div className=\"customize-widgets-welcome-guide\">\n\t\t\t<div className=\"customize-widgets-welcome-guide__image__wrapper\">\n\t\t\t\t<picture>\n\t\t\t\t\t<source\n\t\t\t\t\t\tsrcSet=\"https://s.w.org/images/block-editor/welcome-editor.svg\"\n\t\t\t\t\t\tmedia=\"(prefers-reduced-motion: reduce)\"\n\t\t\t\t\t/>\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName=\"customize-widgets-welcome-guide__image\"\n\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/welcome-editor.gif\"\n\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t/>\n\t\t\t\t</picture>\n\t\t\t</div>\n\t\t\t<h1 className=\"customize-widgets-welcome-guide__heading\">\n\t\t\t\t{ __( 'Welcome to block Widgets' ) }\n\t\t\t</h1>\n\t\t\t<p className=\"customize-widgets-welcome-guide__text\">\n\t\t\t\t{ isEntirelyBlockWidgets\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.'\n\t\t\t\t\t )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.'\n\t\t\t\t\t ) }\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tclassName=\"customize-widgets-welcome-guide__button\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () =>\n\t\t\t\t\ttoggleFeature( 'core/customize-widgets', 'welcomeGuide' )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ __( 'Got it' ) }\n\t\t\t</Button>\n\t\t\t<hr className=\"customize-widgets-welcome-guide__separator\" />\n\t\t\t{ ! isEntirelyBlockWidgets && (\n\t\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t\t{ __( 'Want to stick with the old widgets?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t'https://wordpress.org/plugins/classic-widgets/'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Get the Classic Widgets plugin.' ) }\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t{ __( 'New to the block editor?' ) }\n\t\t\t\t<br />\n\t\t\t\t<ExternalLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/support/article/wordpress-editor/'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( \"Here's a detailed guide.\" ) }\n\t\t\t\t</ExternalLink>\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -16,12 +16,26 @@ function getInspectorSection() {
|
|
|
16
16
|
super(id, options);
|
|
17
17
|
this.parentSection = options.parentSection;
|
|
18
18
|
this.returnFocusWhenClose = null;
|
|
19
|
+
this._isOpen = false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get isOpen() {
|
|
23
|
+
return this._isOpen;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
set isOpen(value) {
|
|
27
|
+
this._isOpen = value;
|
|
28
|
+
this.triggerActiveCallbacks();
|
|
19
29
|
}
|
|
20
30
|
|
|
21
31
|
ready() {
|
|
22
32
|
this.contentContainer[0].classList.add('customize-widgets-layout__inspector');
|
|
23
33
|
}
|
|
24
34
|
|
|
35
|
+
isContextuallyActive() {
|
|
36
|
+
return this.isOpen;
|
|
37
|
+
}
|
|
38
|
+
|
|
25
39
|
onChangeExpanded(expanded, args) {
|
|
26
40
|
super.onChangeExpanded(expanded, args);
|
|
27
41
|
|
|
@@ -47,6 +61,7 @@ function getInspectorSection() {
|
|
|
47
61
|
open({
|
|
48
62
|
returnFocusWhenClose
|
|
49
63
|
} = {}) {
|
|
64
|
+
this.isOpen = true;
|
|
50
65
|
this.returnFocusWhenClose = returnFocusWhenClose;
|
|
51
66
|
this.expand({
|
|
52
67
|
allowMultiple: true
|
|
@@ -59,6 +74,36 @@ function getInspectorSection() {
|
|
|
59
74
|
});
|
|
60
75
|
}
|
|
61
76
|
|
|
77
|
+
collapse(options) {
|
|
78
|
+
// Overridden collapse() function. Mostly call the parent collapse(), but also
|
|
79
|
+
// move our .isOpen to false.
|
|
80
|
+
// Initially, I tried tracking this with onChangeExpanded(), but it doesn't work
|
|
81
|
+
// because the block settings sidebar is a layer "on top of" the G editor sidebar.
|
|
82
|
+
//
|
|
83
|
+
// For example, when closing the block settings sidebar, the G
|
|
84
|
+
// editor sidebar would display, and onChangeExpanded in
|
|
85
|
+
// inspector-section would run with expanded=true, but I want
|
|
86
|
+
// isOpen to be false when the block settings is closed.
|
|
87
|
+
this.isOpen = false;
|
|
88
|
+
super.collapse(options);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
triggerActiveCallbacks() {
|
|
92
|
+
// Manually fire the callbacks associated with moving this.active
|
|
93
|
+
// from false to true. "active" is always true for this section,
|
|
94
|
+
// and "isContextuallyActive" reflects if the block settings
|
|
95
|
+
// sidebar is currently visible, that is, it has replaced the main
|
|
96
|
+
// Gutenberg view.
|
|
97
|
+
// The WP customizer only checks ".isContextuallyActive()" when
|
|
98
|
+
// ".active" changes values. But our ".active" never changes value.
|
|
99
|
+
// The WP customizer never foresaw a section being used a way we
|
|
100
|
+
// fit the block settings sidebar into a section. By manually
|
|
101
|
+
// triggering the "this.active" callbacks, we force the WP
|
|
102
|
+
// customizer to query our .isContextuallyActive() function and
|
|
103
|
+
// update its view of our status.
|
|
104
|
+
this.active.callbacks.fireWith(this.active, [false, true]);
|
|
105
|
+
}
|
|
106
|
+
|
|
62
107
|
};
|
|
63
108
|
}
|
|
64
109
|
//# sourceMappingURL=inspector-section.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/controls/inspector-section.js"],"names":["getInspectorSection","wp","customize","window","InspectorSection","Section","constructor","id","options","parentSection","returnFocusWhenClose","ready","contentContainer","classList","add","onChangeExpanded","expanded","args","unchanged","collapse","manualTransition","expand","completeCallback","contains","focus","open","allowMultiple","close"],"mappings":";;;;;;;AAAe,SAASA,mBAAT,GAA+B;AAC7C,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA,SAAO,MAAMC,gBAAN,SAA+BF,SAAS,CAACG,OAAzC,CAAiD;AACvDC,IAAAA,WAAW,CAAEC,EAAF,EAAMC,OAAN,EAAgB;AAC1B,YAAOD,EAAP,EAAWC,OAAX;AAEA,WAAKC,aAAL,GAAqBD,OAAO,CAACC,aAA7B;AAEA,WAAKC,oBAAL,GAA4B,IAA5B;AACA;;AACDC,IAAAA,KAAK,GAAG;AACP,WAAKC,gBAAL,CAAuB,CAAvB,EAA2BC,SAA3B,CAAqCC,GAArC,CACC,qCADD;AAGA;;AACDC,IAAAA,gBAAgB,CAAEC,QAAF,EAAYC,IAAZ,EAAmB;AAClC,YAAMF,gBAAN,CAAwBC,QAAxB,EAAkCC,IAAlC;;AAEA,UAAK,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/controls/inspector-section.js"],"names":["getInspectorSection","wp","customize","window","InspectorSection","Section","constructor","id","options","parentSection","returnFocusWhenClose","_isOpen","isOpen","value","triggerActiveCallbacks","ready","contentContainer","classList","add","isContextuallyActive","onChangeExpanded","expanded","args","unchanged","collapse","manualTransition","expand","completeCallback","contains","focus","open","allowMultiple","close","active","callbacks","fireWith"],"mappings":";;;;;;;AAAe,SAASA,mBAAT,GAA+B;AAC7C,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA,SAAO,MAAMC,gBAAN,SAA+BF,SAAS,CAACG,OAAzC,CAAiD;AACvDC,IAAAA,WAAW,CAAEC,EAAF,EAAMC,OAAN,EAAgB;AAC1B,YAAOD,EAAP,EAAWC,OAAX;AAEA,WAAKC,aAAL,GAAqBD,OAAO,CAACC,aAA7B;AAEA,WAAKC,oBAAL,GAA4B,IAA5B;AACA,WAAKC,OAAL,GAAe,KAAf;AACA;;AACS,QAANC,MAAM,GAAG;AACZ,aAAO,KAAKD,OAAZ;AACA;;AACS,QA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A;AACA;AACA;AACA;AACA;AACA;AACA,WAAKI,MAAL,GAAc,KAAd;AACA,YAAMY,QAAN,CAAgBhB,OAAhB;AACA;;AACDM,IAAAA,sBAAsB,GAAG;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAKmB,MAAL,CAAYC,SAAZ,CAAsBC,QAAtB,CAAgC,KAAKF,MAArC,EAA6C,CAAE,KAAF,EAAS,IAAT,CAA7C;AACA;;AA1FsD,GAAxD;AA4FA","sourcesContent":["export default function getInspectorSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class InspectorSection extends customize.Section {\n\t\tconstructor( id, options ) {\n\t\t\tsuper( id, options );\n\n\t\t\tthis.parentSection = options.parentSection;\n\n\t\t\tthis.returnFocusWhenClose = null;\n\t\t\tthis._isOpen = false;\n\t\t}\n\t\tget isOpen() {\n\t\t\treturn this._isOpen;\n\t\t}\n\t\tset isOpen( value ) {\n\t\t\tthis._isOpen = value;\n\t\t\tthis.triggerActiveCallbacks();\n\t\t}\n\t\tready() {\n\t\t\tthis.contentContainer[ 0 ].classList.add(\n\t\t\t\t'customize-widgets-layout__inspector'\n\t\t\t);\n\t\t}\n\t\tisContextuallyActive() {\n\t\t\treturn this.isOpen;\n\t\t}\n\t\tonChangeExpanded( expanded, args ) {\n\t\t\tsuper.onChangeExpanded( expanded, args );\n\n\t\t\tif ( this.parentSection && ! args.unchanged ) {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tthis.parentSection.collapse( {\n\t\t\t\t\t\tmanualTransition: true,\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tthis.parentSection.expand( {\n\t\t\t\t\t\tmanualTransition: true,\n\t\t\t\t\t\tcompleteCallback: () => {\n\t\t\t\t\t\t\t// Return focus after finishing the transition.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tthis.returnFocusWhenClose &&\n\t\t\t\t\t\t\t\t! this.contentContainer[ 0 ].contains(\n\t\t\t\t\t\t\t\t\tthis.returnFocusWhenClose\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tthis.returnFocusWhenClose.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\topen( { returnFocusWhenClose } = {} ) {\n\t\t\tthis.isOpen = true;\n\t\t\tthis.returnFocusWhenClose = returnFocusWhenClose;\n\n\t\t\tthis.expand( {\n\t\t\t\tallowMultiple: true,\n\t\t\t} );\n\t\t}\n\t\tclose() {\n\t\t\tthis.collapse( {\n\t\t\t\tallowMultiple: true,\n\t\t\t} );\n\t\t}\n\t\tcollapse( options ) {\n\t\t\t// Overridden collapse() function. Mostly call the parent collapse(), but also\n\t\t\t// move our .isOpen to false.\n\t\t\t// Initially, I tried tracking this with onChangeExpanded(), but it doesn't work\n\t\t\t// because the block settings sidebar is a layer \"on top of\" the G editor sidebar.\n\t\t\t//\n\t\t\t// For example, when closing the block settings sidebar, the G\n\t\t\t// editor sidebar would display, and onChangeExpanded in\n\t\t\t// inspector-section would run with expanded=true, but I want\n\t\t\t// isOpen to be false when the block settings is closed.\n\t\t\tthis.isOpen = false;\n\t\t\tsuper.collapse( options );\n\t\t}\n\t\ttriggerActiveCallbacks() {\n\t\t\t// Manually fire the callbacks associated with moving this.active\n\t\t\t// from false to true. \"active\" is always true for this section,\n\t\t\t// and \"isContextuallyActive\" reflects if the block settings\n\t\t\t// sidebar is currently visible, that is, it has replaced the main\n\t\t\t// Gutenberg view.\n\t\t\t// The WP customizer only checks \".isContextuallyActive()\" when\n\t\t\t// \".active\" changes values. But our \".active\" never changes value.\n\t\t\t// The WP customizer never foresaw a section being used a way we\n\t\t\t// fit the block settings sidebar into a section. By manually\n\t\t\t// triggering the \"this.active\" callbacks, we force the WP\n\t\t\t// customizer to query our .isContextuallyActive() function and\n\t\t\t// update its view of our status.\n\t\t\tthis.active.callbacks.fireWith( this.active, [ false, true ] );\n\t\t}\n\t};\n}\n"]}
|