@wordpress/customize-widgets 1.0.18 → 1.0.21

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.
Files changed (61) hide show
  1. package/build/components/customize-widgets/index.js +4 -2
  2. package/build/components/customize-widgets/index.js.map +1 -1
  3. package/build/components/error-boundary/index.js +67 -0
  4. package/build/components/error-boundary/index.js.map +1 -0
  5. package/build/components/inserter/index.js +11 -0
  6. package/build/components/inserter/index.js.map +1 -1
  7. package/build/components/inserter/use-inserter.js +21 -10
  8. package/build/components/inserter/use-inserter.js.map +1 -1
  9. package/build/components/more-menu/index.js +1 -1
  10. package/build/components/more-menu/index.js.map +1 -1
  11. package/build/components/sidebar-block-editor/index.js +1 -1
  12. package/build/components/sidebar-block-editor/index.js.map +1 -1
  13. package/build/controls/inserter-outer-section.js +25 -13
  14. package/build/controls/inserter-outer-section.js.map +1 -1
  15. package/build/controls/sidebar-control.js +9 -1
  16. package/build/controls/sidebar-control.js.map +1 -1
  17. package/build/controls/sidebar-section.js +3 -1
  18. package/build/controls/sidebar-section.js.map +1 -1
  19. package/build/store/actions.js +21 -0
  20. package/build/store/actions.js.map +1 -1
  21. package/build/store/reducer.js +17 -0
  22. package/build/store/reducer.js.map +1 -1
  23. package/build/store/selectors.js +33 -0
  24. package/build/store/selectors.js.map +1 -1
  25. package/build-module/components/customize-widgets/index.js +3 -2
  26. package/build-module/components/customize-widgets/index.js.map +1 -1
  27. package/build-module/components/error-boundary/index.js +56 -0
  28. package/build-module/components/error-boundary/index.js.map +1 -0
  29. package/build-module/components/inserter/index.js +9 -0
  30. package/build-module/components/inserter/index.js.map +1 -1
  31. package/build-module/components/inserter/use-inserter.js +20 -11
  32. package/build-module/components/inserter/use-inserter.js.map +1 -1
  33. package/build-module/components/more-menu/index.js +1 -1
  34. package/build-module/components/more-menu/index.js.map +1 -1
  35. package/build-module/components/sidebar-block-editor/index.js +1 -1
  36. package/build-module/components/sidebar-block-editor/index.js.map +1 -1
  37. package/build-module/controls/inserter-outer-section.js +22 -12
  38. package/build-module/controls/inserter-outer-section.js.map +1 -1
  39. package/build-module/controls/sidebar-control.js +7 -1
  40. package/build-module/controls/sidebar-control.js.map +1 -1
  41. package/build-module/controls/sidebar-section.js +3 -1
  42. package/build-module/controls/sidebar-section.js.map +1 -1
  43. package/build-module/store/actions.js +19 -0
  44. package/build-module/store/actions.js.map +1 -1
  45. package/build-module/store/reducer.js +17 -0
  46. package/build-module/store/reducer.js.map +1 -1
  47. package/build-module/store/selectors.js +29 -0
  48. package/build-module/store/selectors.js.map +1 -1
  49. package/package.json +18 -18
  50. package/src/components/customize-widgets/index.js +10 -7
  51. package/src/components/error-boundary/index.js +50 -0
  52. package/src/components/inserter/index.js +13 -0
  53. package/src/components/inserter/use-inserter.js +21 -12
  54. package/src/components/more-menu/index.js +1 -1
  55. package/src/components/sidebar-block-editor/index.js +1 -0
  56. package/src/controls/inserter-outer-section.js +29 -12
  57. package/src/controls/sidebar-control.js +9 -1
  58. package/src/controls/sidebar-section.js +1 -1
  59. package/src/store/actions.js +19 -0
  60. package/src/store/reducer.js +15 -0
  61. package/src/store/selectors.js +23 -0
@@ -11,6 +11,8 @@ var _element = require("@wordpress/element");
11
11
 
12
12
  var _components = require("@wordpress/components");
13
13
 
14
+ var _errorBoundary = _interopRequireDefault(require("../error-boundary"));
15
+
14
16
  var _sidebarBlockEditor = _interopRequireDefault(require("../sidebar-block-editor"));
15
17
 
16
18
  var _focusControl = _interopRequireDefault(require("../focus-control"));
@@ -45,13 +47,13 @@ function CustomizeWidgets({
45
47
  unsubscribers.forEach(unsubscriber => unsubscriber());
46
48
  };
47
49
  }, [sidebarControls]);
48
- const activeSidebar = activeSidebarControl && (0, _element.createPortal)((0, _element.createElement)(_sidebarBlockEditor.default, {
50
+ const activeSidebar = activeSidebarControl && (0, _element.createPortal)((0, _element.createElement)(_errorBoundary.default, null, (0, _element.createElement)(_sidebarBlockEditor.default, {
49
51
  key: activeSidebarControl.id,
50
52
  blockEditorSettings: blockEditorSettings,
51
53
  sidebar: activeSidebarControl.sidebarAdapter,
52
54
  inserter: activeSidebarControl.inserter,
53
55
  inspector: activeSidebarControl.inspector
54
- }), activeSidebarControl.container[0]); // We have to portal this to the parent of both the editor and the inspector,
56
+ })), activeSidebarControl.container[0]); // We have to portal this to the parent of both the editor and the inspector,
55
57
  // so that the popovers will appear above both of them.
56
58
 
57
59
  const popover = parentContainer && (0, _element.createPortal)((0, _element.createElement)("div", {
@@ -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;;AAZA;AACA;AACA;;AAIA;AACA;AACA;AAMe,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,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,EAQCjB,oBAAoB,CAACkB,SAArB,CAAgC,CAAhC,CARD,CAFD,CAvBG,CAoCH;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,4BAAD,QACC,4BAAC,wBAAD;AACC,IAAA,eAAe,EAAGJ,eADnB;AAEC,IAAA,oBAAoB,EAAGE;AAFxB,KAIC,4BAAC,qBAAD;AAAc,IAAA,GAAG,EAAGH,GAApB;AAA0B,IAAA,eAAe,EAAGC;AAA5C,KACGe,aADH,EAEGM,OAFH,CAJD,CADD,CADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef, createPortal } from '@wordpress/element';\nimport { SlotFillProvider, Popover } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\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<SidebarBlockEditor\n\t\t\t\tkey={ activeSidebarControl.id }\n\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\tsidebar={ activeSidebarControl.sidebarAdapter }\n\t\t\t\tinserter={ activeSidebarControl.inserter }\n\t\t\t\tinspector={ activeSidebarControl.inspector }\n\t\t\t/>,\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<SlotFillProvider>\n\t\t\t<SidebarControls\n\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\tactiveSidebarControl={ activeSidebarControl }\n\t\t\t>\n\t\t\t\t<FocusControl api={ api } sidebarControls={ sidebarControls }>\n\t\t\t\t\t{ activeSidebar }\n\t\t\t\t\t{ popover }\n\t\t\t\t</FocusControl>\n\t\t\t</SidebarControls>\n\t\t</SlotFillProvider>\n\t);\n}\n"]}
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;;AAbA;AACA;AACA;;AAIA;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,4BAAD,QACC,4BAAC,wBAAD;AACC,IAAA,eAAe,EAAGJ,eADnB;AAEC,IAAA,oBAAoB,EAAGE;AAFxB,KAIC,4BAAC,qBAAD;AAAc,IAAA,GAAG,EAAGH,GAApB;AAA0B,IAAA,eAAe,EAAGC;AAA5C,KACGe,aADH,EAEGM,OAFH,CAJD,CADD,CADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef, createPortal } from '@wordpress/element';\nimport { SlotFillProvider, Popover } from '@wordpress/components';\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<SlotFillProvider>\n\t\t\t<SidebarControls\n\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\tactiveSidebarControl={ activeSidebarControl }\n\t\t\t>\n\t\t\t\t<FocusControl api={ api } sidebarControls={ sidebarControls }>\n\t\t\t\t\t{ activeSidebar }\n\t\t\t\t\t{ popover }\n\t\t\t\t</FocusControl>\n\t\t\t</SidebarControls>\n\t\t</SlotFillProvider>\n\t);\n}\n"]}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _element = require("@wordpress/element");
9
+
10
+ var _i18n = require("@wordpress/i18n");
11
+
12
+ var _components = require("@wordpress/components");
13
+
14
+ var _blockEditor = require("@wordpress/block-editor");
15
+
16
+ var _compose = require("@wordpress/compose");
17
+
18
+ /**
19
+ * WordPress dependencies
20
+ */
21
+ function CopyButton({
22
+ text,
23
+ children
24
+ }) {
25
+ const ref = (0, _compose.useCopyToClipboard)(text);
26
+ return (0, _element.createElement)(_components.Button, {
27
+ variant: "secondary",
28
+ ref: ref
29
+ }, children);
30
+ }
31
+
32
+ class ErrorBoundary extends _element.Component {
33
+ constructor() {
34
+ super(...arguments);
35
+ this.state = {
36
+ error: null
37
+ };
38
+ }
39
+
40
+ componentDidCatch(error) {
41
+ this.setState({
42
+ error
43
+ });
44
+ }
45
+
46
+ render() {
47
+ const {
48
+ error
49
+ } = this.state;
50
+
51
+ if (!error) {
52
+ return this.props.children;
53
+ }
54
+
55
+ return (0, _element.createElement)(_blockEditor.Warning, {
56
+ className: "customize-widgets-error-boundary",
57
+ actions: [(0, _element.createElement)(CopyButton, {
58
+ key: "copy-error",
59
+ text: error.stack
60
+ }, (0, _i18n.__)('Copy Error'))]
61
+ }, (0, _i18n.__)('The editor has encountered an unexpected error.'));
62
+ }
63
+
64
+ }
65
+
66
+ exports.default = ErrorBoundary;
67
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/error-boundary/index.js"],"names":["CopyButton","text","children","ref","ErrorBoundary","Component","constructor","arguments","state","error","componentDidCatch","setState","render","props","stack"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAPA;AACA;AACA;AAOA,SAASA,UAAT,CAAqB;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,CAArB,EAA0C;AACzC,QAAMC,GAAG,GAAG,iCAAoBF,IAApB,CAAZ;AACA,SACC,4BAAC,kBAAD;AAAQ,IAAA,OAAO,EAAC,WAAhB;AAA4B,IAAA,GAAG,EAAGE;AAAlC,KACGD,QADH,CADD;AAKA;;AAEc,MAAME,aAAN,SAA4BC,kBAA5B,CAAsC;AACpDC,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AACA,SAAKC,KAAL,GAAa;AACZC,MAAAA,KAAK,EAAE;AADK,KAAb;AAGA;;AAEDC,EAAAA,iBAAiB,CAAED,KAAF,EAAU;AAC1B,SAAKE,QAAL,CAAe;AAAEF,MAAAA;AAAF,KAAf;AACA;;AAEDG,EAAAA,MAAM,GAAG;AACR,UAAM;AAAEH,MAAAA;AAAF,QAAY,KAAKD,KAAvB;;AACA,QAAK,CAAEC,KAAP,EAAe;AACd,aAAO,KAAKI,KAAL,CAAWX,QAAlB;AACA;;AAED,WACC,4BAAC,oBAAD;AACC,MAAA,SAAS,EAAC,kCADX;AAEC,MAAA,OAAO,EAAG,CACT,4BAAC,UAAD;AAAY,QAAA,GAAG,EAAC,YAAhB;AAA6B,QAAA,IAAI,EAAGO,KAAK,CAACK;AAA1C,SACG,cAAI,YAAJ,CADH,CADS;AAFX,OAQG,cAAI,iDAAJ,CARH,CADD;AAYA;;AA9BmD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tthis.setState( { error } );\n\t}\n\n\trender() {\n\t\tconst { error } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<Warning\n\t\t\t\tclassName=\"customize-widgets-error-boundary\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t\t\t\t{ __( 'Copy Error' ) }\n\t\t\t\t\t</CopyButton>,\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ __( 'The editor has encountered an unexpected error.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n}\n"]}
@@ -15,15 +15,24 @@ var _components = require("@wordpress/components");
15
15
 
16
16
  var _compose = require("@wordpress/compose");
17
17
 
18
+ var _data = require("@wordpress/data");
19
+
18
20
  var _icons = require("@wordpress/icons");
19
21
 
22
+ var _store = require("../../store");
23
+
20
24
  /**
21
25
  * WordPress dependencies
22
26
  */
27
+
28
+ /**
29
+ * Internal dependencies
30
+ */
23
31
  function Inserter({
24
32
  setIsOpened
25
33
  }) {
26
34
  const inserterTitleId = (0, _compose.useInstanceId)(Inserter, 'customize-widget-layout__inserter-panel-title');
35
+ const insertionPoint = (0, _data.useSelect)(select => select(_store.store).__experimentalGetInsertionPoint());
27
36
  return (0, _element.createElement)("div", {
28
37
  className: "customize-widgets-layout__inserter-panel",
29
38
  "aria-labelledby": inserterTitleId
@@ -40,6 +49,8 @@ function Inserter({
40
49
  })), (0, _element.createElement)("div", {
41
50
  className: "customize-widgets-layout__inserter-panel-content"
42
51
  }, (0, _element.createElement)(_blockEditor.__experimentalLibrary, {
52
+ rootClientId: insertionPoint.rootClientId,
53
+ __experimentalInsertionIndex: insertionPoint.insertionIndex,
43
54
  showInserterHelpPanel: true,
44
55
  onSelect: () => setIsOpened(false)
45
56
  })));
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/inserter/index.js"],"names":["Inserter","setIsOpened","inserterTitleId","closeSmall"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAPA;AACA;AACA;AAOA,SAASA,QAAT,CAAmB;AAAEC,EAAAA;AAAF,CAAnB,EAAqC;AACpC,QAAMC,eAAe,GAAG,4BACvBF,QADuB,EAEvB,+CAFuB,CAAxB;AAKA,SACC;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,uBAAkBE;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,EAAGC,iBAFR;AAGC,IAAA,OAAO,EAAG,MAAMF,WAAW,CAAE,KAAF,CAH5B;AAIC,kBAAa,cAAI,gBAAJ;AAJd,IAPD,CAJD,EAkBC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kCAAD;AACC,IAAA,qBAAqB,MADtB;AAEC,IAAA,QAAQ,EAAG,MAAMA,WAAW,CAAE,KAAF;AAF7B,IADD,CAlBD,CADD;AA2BA;;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 { closeSmall } from '@wordpress/icons';\n\nfunction Inserter( { setIsOpened } ) {\n\tconst inserterTitleId = useInstanceId(\n\t\tInserter,\n\t\t'customize-widget-layout__inserter-panel-title'\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\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"]}
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,qBAAaC,MAAF,IACjCA,MAAM,CAAEC,YAAF,CAAN,CAAgCC,+BAAhC,EADsB,CAAvB;AAIA,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( ( select ) =>\n\t\tselect( customizeWidgetsStore ).__experimentalGetInsertionPoint()\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"]}
@@ -7,26 +7,37 @@ exports.default = useInserter;
7
7
 
8
8
  var _element = require("@wordpress/element");
9
9
 
10
+ var _data = require("@wordpress/data");
11
+
12
+ var _store = require("../../store");
13
+
10
14
  /**
11
15
  * WordPress dependencies
12
16
  */
17
+
18
+ /**
19
+ * Internal dependencies
20
+ */
13
21
  function useInserter(inserter) {
14
- const [isInserterOpened, setIsInserterOpened] = (0, _element.useState)(() => inserter.isOpen);
22
+ const isInserterOpened = (0, _data.useSelect)(select => select(_store.store).isInserterOpened());
23
+ const {
24
+ setIsInserterOpened
25
+ } = (0, _data.useDispatch)(_store.store);
15
26
  (0, _element.useEffect)(() => {
16
- return inserter.subscribe(setIsInserterOpened);
17
- }, [inserter]);
27
+ if (isInserterOpened) {
28
+ inserter.open();
29
+ } else {
30
+ inserter.close();
31
+ }
32
+ }, [inserter, isInserterOpened]);
18
33
  return [isInserterOpened, (0, _element.useCallback)(updater => {
19
34
  let isOpen = updater;
20
35
 
21
36
  if (typeof updater === 'function') {
22
- isOpen = updater(inserter.isOpen);
37
+ isOpen = updater((0, _data.select)(_store.store).isInserterOpened());
23
38
  }
24
39
 
25
- if (isOpen) {
26
- inserter.open();
27
- } else {
28
- inserter.close();
29
- }
30
- }, [inserter])];
40
+ setIsInserterOpened(isOpen);
41
+ }, [setIsInserterOpened])];
31
42
  }
32
43
  //# sourceMappingURL=use-inserter.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/inserter/use-inserter.js"],"names":["useInserter","inserter","isInserterOpened","setIsInserterOpened","isOpen","subscribe","updater","open","close"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,WAAT,CAAsBC,QAAtB,EAAiC;AAC/C,QAAM,CAAEC,gBAAF,EAAoBC,mBAApB,IAA4C,uBACjD,MAAMF,QAAQ,CAACG,MADkC,CAAlD;AAIA,0BAAW,MAAM;AAChB,WAAOH,QAAQ,CAACI,SAAT,CAAoBF,mBAApB,CAAP;AACA,GAFD,EAEG,CAAEF,QAAF,CAFH;AAIA,SAAO,CACNC,gBADM,EAEN,0BACGI,OAAF,IAAe;AACd,QAAIF,MAAM,GAAGE,OAAb;;AACA,QAAK,OAAOA,OAAP,KAAmB,UAAxB,EAAqC;AACpCF,MAAAA,MAAM,GAAGE,OAAO,CAAEL,QAAQ,CAACG,MAAX,CAAhB;AACA;;AAED,QAAKA,MAAL,EAAc;AACbH,MAAAA,QAAQ,CAACM,IAAT;AACA,KAFD,MAEO;AACNN,MAAAA,QAAQ,CAACO,KAAT;AACA;AACD,GAZF,EAaC,CAAEP,QAAF,CAbD,CAFM,CAAP;AAkBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useCallback } from '@wordpress/element';\n\nexport default function useInserter( inserter ) {\n\tconst [ isInserterOpened, setIsInserterOpened ] = useState(\n\t\t() => inserter.isOpen\n\t);\n\n\tuseEffect( () => {\n\t\treturn inserter.subscribe( setIsInserterOpened );\n\t}, [ inserter ] );\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( inserter.isOpen );\n\t\t\t\t}\n\n\t\t\t\tif ( isOpen ) {\n\t\t\t\t\tinserter.open();\n\t\t\t\t} else {\n\t\t\t\t\tinserter.close();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[ inserter ]\n\t\t),\n\t];\n}\n"]}
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,qBAAaC,MAAF,IACnCA,MAAM,CAAEC,YAAF,CAAN,CAAgCF,gBAAhC,EADwB,CAAzB;AAGA,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( ( select ) =>\n\t\tselect( customizeWidgetsStore ).isInserterOpened()\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"]}
@@ -75,7 +75,7 @@ function MoreMenu() {
75
75
  }), (0, _element.createElement)(_components.MenuItem, {
76
76
  role: "menuitem",
77
77
  icon: _icons.external,
78
- href: (0, _i18n.__)('https://wordpress.org/support/article/wordpress-editor/'),
78
+ href: (0, _i18n.__)('https://wordpress.org/support/article/block-based-widgets-editor/'),
79
79
  target: "_blank",
80
80
  rel: "noopener noreferrer"
81
81
  }, (0, _i18n.__)('Help'), (0, _element.createElement)(_components.VisuallyHidden, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/more-menu/index.js"],"names":["POPOVER_PROPS","className","position","TOGGLE_PROPS","tooltipPosition","MoreMenu","isKeyboardShortcutsModalActive","setIsKeyboardShortcutsModalVisible","toggleKeyboardShortcutsModal","bindGlobal","moreVertical","displayShortcut","access","external"],"mappings":";;;;;;;;;AASA;;AANA;;AAOA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAaA;AACA;AACA;AAIA,MAAMA,aAAa,GAAG;AACrBC,EAAAA,SAAS,EAAE,sCADU;AAErBC,EAAAA,QAAQ,EAAE;AAFW,CAAtB;AAIA,MAAMC,YAAY,GAAG;AACpBC,EAAAA,eAAe,EAAE;AADG,CAArB;;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,EAGC;AACCC,IAAAA,UAAU,EAAE;AADb,GAHD;AAQA,SACC,qDACC,4BAAC,+BAAD;AACC,IAAA,SAAS,EAAC,6BADX;AAEC,IAAA,IAAI,EAAGC;AACP;AAHD;AAIC,IAAA,KAAK,EAAG,cAAI,SAAJ,CAJT;AAKC,IAAA,YAAY,EAAGV,aALhB;AAMC,IAAA,WAAW,EAAGG;AANf,KAQG,MACD,qDACC,4BAAC,qBAAD;AAAW,I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IADD,CA/CD,CATF,CADD,EA6EC,4BAAC,kCAAD;AACC,IAAA,aAAa,EAAGP,8BADjB;AAEC,IAAA,WAAW,EAAGE;AAFf,IA7ED,CADD;AAoFA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { external, moreVertical } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport FeatureToggle from './feature-toggle';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\n\nconst POPOVER_PROPS = {\n\tclassName: 'customize-widgets-more-menu__content',\n\tposition: 'bottom left',\n};\nconst TOGGLE_PROPS = {\n\ttooltipPosition: 'bottom',\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\t{\n\t\t\tbindGlobal: true,\n\t\t}\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarDropdownMenu\n\t\t\t\tclassName=\"customize-widgets-more-menu\"\n\t\t\t\ticon={ moreVertical }\n\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\ttoggleProps={ TOGGLE_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<FeatureToggle\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<FeatureToggle\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/wordpress-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<FeatureToggle\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</ToolbarDropdownMenu>\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"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/more-menu/index.js"],"names":["POPOVER_PROPS","className","position","TOGGLE_PROPS","tooltipPosition","MoreMenu","isKeyboardShortcutsModalActive","setIsKeyboardShortcutsModalVisible","toggleKeyboardShortcutsModal","bindGlobal","moreVertical","displayShortcut","access","external"],"mappings":";;;;;;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JZ,KAMG,cAAI,oBAAJ,CANH,CADD,EASC,4BAAC,sBAAD;AACC,IAAA,OAAO,EAAC,cADT;AAEC,IAAA,KAAK,EAAG,cAAI,eAAJ;AAFT,IATD,EAaC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAC,UADN;AAEC,IAAA,IAAI,EAAGC,eAFR;AAGC,IAAA,IAAI,EAAG,cACN,mEADM,CAHR;AAMC,IAAA,MAAM,EAAC,QANR;AAOC,IAAA,GAAG,EAAC;AAPL,KASG,cAAI,MAAJ,CATH,EAUC,4BAAC,0BAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB;AAEE;AACA,gBAAI,sBAAJ,CAHF,CAVD,CAbD,CAhBD,EA+CC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,aAAJ;AAAnB,KACC,4BAAC,sBAAD;AACC,IAAA,OAAO,EAAC,sBADT;AAEC,IAAA,KAAK,EAAG,cACP,kCADO,CAFT;AAKC,IAAA,IAAI,EAAG,cACN,iEADM,CALR;AAQC,IAAA,gBAAgB,EAAG,cAClB,4CADkB,CARpB;AAWC,IAAA,kBAAkB,EAAG,cACpB,8CADoB;AAXtB,IADD,CA/CD,CATF,CADD,EA6EC,4BAAC,kCAAD;AACC,IAAA,aAAa,EAAGP,8BADjB;AAEC,IAAA,WAAW,EAAGE;AAFf,IA7ED,CADD;AAoFA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { external, moreVertical } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport FeatureToggle from './feature-toggle';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\n\nconst POPOVER_PROPS = {\n\tclassName: 'customize-widgets-more-menu__content',\n\tposition: 'bottom left',\n};\nconst TOGGLE_PROPS = {\n\ttooltipPosition: 'bottom',\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\t{\n\t\t\tbindGlobal: true,\n\t\t}\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarDropdownMenu\n\t\t\t\tclassName=\"customize-widgets-more-menu\"\n\t\t\t\ticon={ moreVertical }\n\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\ttoggleProps={ TOGGLE_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<FeatureToggle\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<FeatureToggle\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<FeatureToggle\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</ToolbarDropdownMenu>\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"]}
@@ -91,7 +91,7 @@ function SidebarBlockEditor({
91
91
  keepCaretInsideBlock,
92
92
  __unstableHasCustomAppender: true
93
93
  };
94
- }, [hasUploadPermissions, blockEditorSettings, isFixedToolbarActive, keepCaretInsideBlock]);
94
+ }, [hasUploadPermissions, blockEditorSettings, isFixedToolbarActive, keepCaretInsideBlock, setIsInserterOpened]);
95
95
 
96
96
  if (isWelcomeGuideActive) {
97
97
  return (0, _element.createElement)(_welcomeGuide.default, {
@@ -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","coreStore","canUser","customizeWidgetsStore","__unstableIsFeatureActive","settings","mediaUploadBlockEditor","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalSetIsInserterOpened","mediaUpload","hasFixedToolbar","__unstableHasCustomAppender","undo","redo","save","BlockAppender","event","preventDefault","contentContainer","onClose"],"mappings":";;;;;;;;;AAUA;;AAPA;;AA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AAAM,IAAA,QAAQ,EAAKC,KAAF,IAAaA,KAAK,CAACC,cAAN;AAA9B,KACC,4BAAC,2BAAD,OADD,CAHC,EAMD5B,SAAS,CAAC6B,gBAAV,CAA4B,CAA5B,CANC,CA9BH,CAJD,EA4CC,4BAAC,iDAAD,QACG,CAAE;AAAEC,IAAAA;AAAF,GAAF,KACD,4BAAC,6BAAD;AACC,IAAA,SAAS,EAAG9B,SADb;AAEC,IAAA,SAAS,EAAG8B;AAFb,IAFF,CA5CD,CADD;AAuDA","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';\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 { store as customizeWidgetsStore } from '../../store';\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\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: select(\n\t\t\t\tcustomizeWidgetsStore\n\t\t\t).__unstableIsFeatureActive( 'fixedToolbar' ),\n\t\t\tkeepCaretInsideBlock: select(\n\t\t\t\tcustomizeWidgetsStore\n\t\t\t).__unstableIsFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\tisWelcomeGuideActive: select(\n\t\t\t\tcustomizeWidgetsStore\n\t\t\t).__unstableIsFeatureActive( 'welcomeGuide' ),\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] );\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<BlockEditorKeyboardShortcuts />\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"]}
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","coreStore","canUser","customizeWidgetsStore","__unstableIsFeatureActive","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;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAlCA;AACA;AACA;;AAGA;AACA;AACA;;AAiBA;AACA;AACA;AAUe,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,WAAO;AACNJ,MAAAA,oBAAoB,EAAE,uBACrBI,MAAM,CAAEC,eAAF,CAAN,CAAoBC,OAApB,CAA6B,QAA7B,EAAuC,OAAvC,CADqB,EAErB,IAFqB,CADhB;AAKNL,MAAAA,oBAAoB,EAAEG,MAAM,CAC3BG,YAD2B,CAAN,CAEpBC,yBAFoB,CAEO,cAFP,CALhB;AAQNN,MAAAA,oBAAoB,EAAEE,MAAM,CAC3BG,YAD2B,CAAN,CAEpBC,yBAFoB,CAEO,sBAFP,CARhB;AAWNL,MAAAA,oBAAoB,EAAEC,MAAM,CAC3BG,YAD2B,CAAN,CAEpBC,yBAFoB,CAEO,cAFP;AAXhB,KAAP;AAeA,GAhBG,EAgBD,EAhBC,CALJ;AAsBA,QAAM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QAFZ;AAGC,IAAA,gBAAgB,EAAGE,gBAHpB;AAIC,IAAA,mBAAmB,EAAGC,mBAJvB;AAKC,IAAA,oBAAoB,EAAGE;AALxB,IARD,EAgBC,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,CAhBD,EA8BG,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,CA9BH,CAJD,EA4CC,4BAAC,iDAAD,QACG,CAAE;AAAEC,IAAAA;AAAF,GAAF,KACD,4BAAC,6BAAD;AACC,IAAA,SAAS,EAAG9B,SADb;AAEC,IAAA,SAAS,EAAG8B;AAFb,IAFF,CA5CD,CADD;AAuDA","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';\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 { store as customizeWidgetsStore } from '../../store';\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\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: select(\n\t\t\t\tcustomizeWidgetsStore\n\t\t\t).__unstableIsFeatureActive( 'fixedToolbar' ),\n\t\t\tkeepCaretInsideBlock: select(\n\t\t\t\tcustomizeWidgetsStore\n\t\t\t).__unstableIsFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\tisWelcomeGuideActive: select(\n\t\t\t\tcustomizeWidgetsStore\n\t\t\t).__unstableIsFeatureActive( 'welcomeGuide' ),\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<BlockEditorKeyboardShortcuts />\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"]}
@@ -9,9 +9,17 @@ var _keycodes = require("@wordpress/keycodes");
9
9
 
10
10
  var _dom = require("@wordpress/dom");
11
11
 
12
+ var _data = require("@wordpress/data");
13
+
14
+ var _store = require("../store");
15
+
12
16
  /**
13
17
  * WordPress dependencies
14
18
  */
19
+
20
+ /**
21
+ * Internal dependencies
22
+ */
15
23
  function getInserterOuterSection() {
16
24
  const {
17
25
  wp: {
@@ -50,28 +58,31 @@ function getInserterOuterSection() {
50
58
  const ownerWindow = this.contentContainer[0].ownerDocument.defaultView; // Handle closing the inserter when pressing the Escape key.
51
59
 
52
60
  ownerWindow.addEventListener('keydown', event => {
53
- if (this.isOpen && (event.keyCode === _keycodes.ESCAPE || event.code === 'Escape')) {
61
+ if (this.expanded() && (event.keyCode === _keycodes.ESCAPE || event.code === 'Escape')) {
54
62
  event.stopPropagation();
55
- this.close();
63
+ (0, _data.dispatch)(_store.store).setIsInserterOpened(false);
56
64
  }
57
65
  }, // Use capture mode to make this run before other event listeners.
58
66
  true);
59
- this.contentContainer.addClass('widgets-inserter');
60
- }
61
-
62
- get isOpen() {
63
- return this.expanded();
64
- }
67
+ this.contentContainer.addClass('widgets-inserter'); // Set a flag if the state is being changed from open() or close().
68
+ // Don't propagate the event if it's an internal action to prevent infinite loop.
69
+
70
+ this.isFromInternalAction = false;
71
+ this.expanded.bind(() => {
72
+ if (!this.isFromInternalAction) {
73
+ // Propagate the event to React to sync the state.
74
+ (0, _data.dispatch)(_store.store).setIsInserterOpened(this.expanded());
75
+ }
65
76
 
66
- subscribe(handler) {
67
- this.expanded.bind(handler);
68
- return () => this.expanded.unbind(handler);
77
+ this.isFromInternalAction = false;
78
+ });
69
79
  }
70
80
 
71
81
  open() {
72
- if (!this.isOpen) {
82
+ if (!this.expanded()) {
73
83
  const contentContainer = this.contentContainer[0];
74
84
  this.activeElementBeforeExpanded = contentContainer.ownerDocument.activeElement;
85
+ this.isFromInternalAction = true;
75
86
  this.expand({
76
87
  completeCallback() {
77
88
  // We have to do this in a "completeCallback" or else the elements will not yet be visible/tabbable.
@@ -89,9 +100,10 @@ function getInserterOuterSection() {
89
100
  }
90
101
 
91
102
  close() {
92
- if (this.isOpen) {
103
+ if (this.expanded()) {
93
104
  const contentContainer = this.contentContainer[0];
94
105
  const activeElement = contentContainer.ownerDocument.activeElement;
106
+ this.isFromInternalAction = true;
95
107
  this.collapse({
96
108
  completeCallback() {
97
109
  // Return back the focus when closing the inserter.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/controls/inserter-outer-section.js"],"names":["getInserterOuterSection","wp","customize","window","OuterSection","onChangeExpanded","expanded","args","section","each","params","type","id","collapse","sectionConstructor","outer","InserterOuterSection","constructor","activeElementBeforeExpanded","ownerWindow","contentContainer","ownerDocument","defaultView","addEventListener","event","isOpen","keyCode","ESCAPE","code","stopPropagation","close","addClass","subscribe","handler","bind","unbind","open","activeElement","expand","completeCallback","searchBox","focus","tabbable","find","contains"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIe,SAASA,uBAAT,GAAmC;AACjD,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA,QAAMC,YAAY,GAAGF,SAAS,CAACE,YAA/B,CALiD,CAMjD;AACA;AACA;;AACAF,EAAAA,SAAS,CAACE,YAAV,GAAyB,cAAcA,YAAd,CAA2B;AACnDC,IAAAA,gBAAgB,CAAEC,QAAF,EAAYC,IAAZ,EAAmB;AAClC,UAAKD,QAAL,EAAgB;AACfJ,QAAAA,SAAS,CAACM,OAAV,CAAkBC,IAAl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3B,QAAL,CAAc6B,MAAd,CAAsBF,OAAtB,CAAb;AACA;;AACDG,IAAAA,IAAI,GAAG;AACN,UAAK,CAAE,KAAKX,MAAZ,EAAqB;AACpB,cAAML,gBAAgB,GAAG,KAAKA,gBAAL,CAAuB,CAAvB,CAAzB;AACA,aAAKF,2BAAL,GACCE,gBAAgB,CAACC,aAAjB,CAA+BgB,aADhC;AAGA,aAAKC,MAAL,CAAa;AACZC,UAAAA,gBAAgB,GAAG;AAClB;AACA;AACA;AACA,kBAAMC,SAAS,GAAGC,WAAMC,QAAN,CAAeC,IAAf,CACjBvB,gBADiB,EAEf,CAFe,CAAlB;;AAGA,gBAAKoB,SAAL,EAAiB;AAChBA,cAAAA,SAAS,CAACC,KAAV;AACA;AACD;;AAXW,SAAb;AAaA;AACD;;AACDX,IAAAA,KAAK,GAAG;AACP,UAAK,KAAKL,MAAV,EAAmB;AAClB,cAAML,gBAAgB,GAAG,KAAKA,gBAAL,CAAuB,CAAvB,CAAzB;AACA,cAAMiB,aAAa,GAClBjB,gBAAgB,CAACC,aAAjB,CAA+BgB,aADhC;AAGA,aAAKxB,QAAL,CAAe;AACd0B,UAAAA,gBAAgB,GAAG;AAClB;AACA;AACA;AACA;AACA;AACA,gBAAKnB,gBAAgB,CAACwB,QAAjB,CAA2BP,aAA3B,CAAL,EAAkD;AACjD;AACA,kBAAK,KAAKnB,2BAAV,EAAwC;AACvC,qBAAKA,2BAAL,CAAiCuB,KAAjC;AACA;AACD;AACD;;AAba,SAAf;AAeA;AACD;;AAlF+D,GAAjE;AAoFA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\n\nexport default function getInserterOuterSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\tconst OuterSection = customize.OuterSection;\n\t// Override the OuterSection class to handle multiple outer sections.\n\t// It closes all the other outer sections whenever one is opened.\n\t// The result is that at most one outer section can be opened at the same time.\n\tcustomize.OuterSection = class extends OuterSection {\n\t\tonChangeExpanded( expanded, args ) {\n\t\t\tif ( expanded ) {\n\t\t\t\tcustomize.section.each( ( section ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tsection.params.type === 'outer' &&\n\t\t\t\t\t\tsection.id !== this.id\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ( section.expanded() ) {\n\t\t\t\t\t\t\tsection.collapse();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn super.onChangeExpanded( expanded, args );\n\t\t}\n\t};\n\t// Handle constructor so that \"params.type\" can be correctly pointed to \"outer\".\n\tcustomize.sectionConstructor.outer = customize.OuterSection;\n\n\treturn class InserterOuterSection extends customize.OuterSection {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\t// This is necessary since we're creating a new class which is not identical to the original OuterSection.\n\t\t\t// @See https://github.com/WordPress/wordpress-develop/blob/42b05c397c50d9dc244083eff52991413909d4bd/src/js/_enqueues/wp/customize/controls.js#L1427-L1436\n\t\t\tthis.params.type = 'outer';\n\n\t\t\tthis.activeElementBeforeExpanded = null;\n\n\t\t\tconst ownerWindow = this.contentContainer[ 0 ].ownerDocument\n\t\t\t\t.defaultView;\n\n\t\t\t// Handle closing the inserter when pressing the Escape key.\n\t\t\townerWindow.addEventListener(\n\t\t\t\t'keydown',\n\t\t\t\t( event ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.isOpen &&\n\t\t\t\t\t\t( event.keyCode === ESCAPE || event.code === 'Escape' )\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.stopPropagation();\n\n\t\t\t\t\t\tthis.close();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t// Use capture mode to make this run before other event listeners.\n\t\t\t\ttrue\n\t\t\t);\n\n\t\t\tthis.contentContainer.addClass( 'widgets-inserter' );\n\t\t}\n\t\tget isOpen() {\n\t\t\treturn this.expanded();\n\t\t}\n\t\tsubscribe( handler ) {\n\t\t\tthis.expanded.bind( handler );\n\t\t\treturn () => this.expanded.unbind( handler );\n\t\t}\n\t\topen() {\n\t\t\tif ( ! this.isOpen ) {\n\t\t\t\tconst contentContainer = this.contentContainer[ 0 ];\n\t\t\t\tthis.activeElementBeforeExpanded =\n\t\t\t\t\tcontentContainer.ownerDocument.activeElement;\n\n\t\t\t\tthis.expand( {\n\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t// We have to do this in a \"completeCallback\" or else the elements will not yet be visible/tabbable.\n\t\t\t\t\t\t// The first one should be the close button,\n\t\t\t\t\t\t// we want to skip it and choose the second one instead, which is the search box.\n\t\t\t\t\t\tconst searchBox = focus.tabbable.find(\n\t\t\t\t\t\t\tcontentContainer\n\t\t\t\t\t\t)[ 1 ];\n\t\t\t\t\t\tif ( searchBox ) {\n\t\t\t\t\t\t\tsearchBox.focus();\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\tclose() {\n\t\t\tif ( this.isOpen ) {\n\t\t\t\tconst contentContainer = this.contentContainer[ 0 ];\n\t\t\t\tconst activeElement =\n\t\t\t\t\tcontentContainer.ownerDocument.activeElement;\n\n\t\t\t\tthis.collapse( {\n\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t// Return back the focus when closing the inserter.\n\t\t\t\t\t\t// Only do this if the active element which triggers the action is inside the inserter,\n\t\t\t\t\t\t// (the close button for instance). In that case the focus will be lost.\n\t\t\t\t\t\t// Otherwise, we don't hijack the focus when the user is focusing on other elements\n\t\t\t\t\t\t// (like the quick inserter).\n\t\t\t\t\t\tif ( contentContainer.contains( activeElement ) ) {\n\t\t\t\t\t\t\t// Return back the focus when closing the inserter.\n\t\t\t\t\t\t\tif ( this.activeElementBeforeExpanded ) {\n\t\t\t\t\t\t\t\tthis.activeElementBeforeExpanded.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};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/controls/inserter-outer-section.js"],"names":["getInserterOuterSection","wp","customize","window","OuterSection","onChangeExpanded","expanded","args","section","each","params","type","id","collapse","sectionConstructor","outer","InserterOuterSection","constructor","activeElementBeforeExpanded","ownerWindow","contentContainer","ownerDocument","defaultView","addEventListener","event","keyCode","ESCAPE","code","stopPropagation","customizeWidgetsStore","setIsInserterOpened","addClass","isFromInternalAction","bind","open","activeElement","expand","completeCallback","searchBox","focus","tabbable","find","close","contains"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAGe,SAASA,uBAAT,GAAmC;AACjD,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA,QAAMC,YAAY,GAAGF,SAAS,CAACE,YAA/B,CALiD,CAMjD;AACA;AACA;;AACAF,EAAAA,SAAS,CAACE,YAAV,GAAyB,cAAcA,YAAd,CAA2B;AACnDC,IAAAA,gBAAgB,CAAEC,QAAF,EAAYC,IAAZ,EAAmB;AAClC,UAAKD,QAAL,EAAgB;AACfJ,QAAAA,SAAS,CAACM,OAAV,CAAkBC,IAAlB,CAA0BD,OAAF,IAAe;AACtC,cACCA,OAAO,CAACE,MAAR,CAAeC,IAAf,KAAwB,OAAxB,IACAH,OAAO,CAACI,EAAR,KAAe,KAAKA,EAFrB,EAGE;AACD,gBAAKJ,OAAO,CAACF,QAAR,EAAL,EAA0B;AACzBE,cAAAA,OAAO,CAACK,QAAR;AACA;AACD;AACD,SATD;AAUA;;AAED,aAAO,MAAMR,gBAAN,CAAwBC,QAAxB,EAAkCC,IAAlC,CAAP;AACA;;AAhBkD,GAApD,CATiD,CA2BjD;;AACAL,EAAAA,SAAS,CAACY,kBAAV,CAA6BC,KAA7B,GAAqCb,SAAS,CAACE,YAA/C;AAEA,SAAO,MAAMY,oBAAN,SAAmC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GC,WAAMC,QAAN,CAAeC,IAAf,CACjBrB,gBADiB,EAEf,CAFe,CAAlB;;AAGA,gBAAKkB,SAAL,EAAiB;AAChBA,cAAAA,SAAS,CAACC,KAAV;AACA;AACD;;AAXW,SAAb;AAaA;AACD;;AACDG,IAAAA,KAAK,GAAG;AACP,UAAK,KAAKpC,QAAL,EAAL,EAAuB;AACtB,cAAMc,gBAAgB,GAAG,KAAKA,gBAAL,CAAuB,CAAvB,CAAzB;AACA,cAAMe,aAAa,GAClBf,gBAAgB,CAACC,aAAjB,CAA+Bc,aADhC;AAGA,aAAKH,oBAAL,GAA4B,IAA5B;AAEA,aAAKnB,QAAL,CAAe;AACdwB,UAAAA,gBAAgB,GAAG;AAClB;AACA;AACA;AACA;AACA;AACA,gBAAKjB,gBAAgB,CAACuB,QAAjB,CAA2BR,aAA3B,CAAL,EAAkD;AACjD;AACA,kBAAK,KAAKjB,2BAAV,EAAwC;AACvC,qBAAKA,2BAAL,CAAiCqB,KAAjC;AACA;AACD;AACD;;AAba,SAAf;AAeA;AACD;;AA7F+D,GAAjE;AA+FA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as customizeWidgetsStore } from '../store';\n\nexport default function getInserterOuterSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\tconst OuterSection = customize.OuterSection;\n\t// Override the OuterSection class to handle multiple outer sections.\n\t// It closes all the other outer sections whenever one is opened.\n\t// The result is that at most one outer section can be opened at the same time.\n\tcustomize.OuterSection = class extends OuterSection {\n\t\tonChangeExpanded( expanded, args ) {\n\t\t\tif ( expanded ) {\n\t\t\t\tcustomize.section.each( ( section ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tsection.params.type === 'outer' &&\n\t\t\t\t\t\tsection.id !== this.id\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ( section.expanded() ) {\n\t\t\t\t\t\t\tsection.collapse();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn super.onChangeExpanded( expanded, args );\n\t\t}\n\t};\n\t// Handle constructor so that \"params.type\" can be correctly pointed to \"outer\".\n\tcustomize.sectionConstructor.outer = customize.OuterSection;\n\n\treturn class InserterOuterSection extends customize.OuterSection {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\t// This is necessary since we're creating a new class which is not identical to the original OuterSection.\n\t\t\t// @See https://github.com/WordPress/wordpress-develop/blob/42b05c397c50d9dc244083eff52991413909d4bd/src/js/_enqueues/wp/customize/controls.js#L1427-L1436\n\t\t\tthis.params.type = 'outer';\n\n\t\t\tthis.activeElementBeforeExpanded = null;\n\n\t\t\tconst ownerWindow = this.contentContainer[ 0 ].ownerDocument\n\t\t\t\t.defaultView;\n\n\t\t\t// Handle closing the inserter when pressing the Escape key.\n\t\t\townerWindow.addEventListener(\n\t\t\t\t'keydown',\n\t\t\t\t( event ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.expanded() &&\n\t\t\t\t\t\t( event.keyCode === ESCAPE || event.code === 'Escape' )\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t// Use capture mode to make this run before other event listeners.\n\t\t\t\ttrue\n\t\t\t);\n\n\t\t\tthis.contentContainer.addClass( 'widgets-inserter' );\n\n\t\t\t// Set a flag if the state is being changed from open() or close().\n\t\t\t// Don't propagate the event if it's an internal action to prevent infinite loop.\n\t\t\tthis.isFromInternalAction = false;\n\t\t\tthis.expanded.bind( () => {\n\t\t\t\tif ( ! this.isFromInternalAction ) {\n\t\t\t\t\t// Propagate the event to React to sync the state.\n\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\tthis.expanded()\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.isFromInternalAction = false;\n\t\t\t} );\n\t\t}\n\t\topen() {\n\t\t\tif ( ! this.expanded() ) {\n\t\t\t\tconst contentContainer = this.contentContainer[ 0 ];\n\t\t\t\tthis.activeElementBeforeExpanded =\n\t\t\t\t\tcontentContainer.ownerDocument.activeElement;\n\n\t\t\t\tthis.isFromInternalAction = true;\n\n\t\t\t\tthis.expand( {\n\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t// We have to do this in a \"completeCallback\" or else the elements will not yet be visible/tabbable.\n\t\t\t\t\t\t// The first one should be the close button,\n\t\t\t\t\t\t// we want to skip it and choose the second one instead, which is the search box.\n\t\t\t\t\t\tconst searchBox = focus.tabbable.find(\n\t\t\t\t\t\t\tcontentContainer\n\t\t\t\t\t\t)[ 1 ];\n\t\t\t\t\t\tif ( searchBox ) {\n\t\t\t\t\t\t\tsearchBox.focus();\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\tclose() {\n\t\t\tif ( this.expanded() ) {\n\t\t\t\tconst contentContainer = this.contentContainer[ 0 ];\n\t\t\t\tconst activeElement =\n\t\t\t\t\tcontentContainer.ownerDocument.activeElement;\n\n\t\t\t\tthis.isFromInternalAction = true;\n\n\t\t\t\tthis.collapse( {\n\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t// Return back the focus when closing the inserter.\n\t\t\t\t\t\t// Only do this if the active element which triggers the action is inside the inserter,\n\t\t\t\t\t\t// (the close button for instance). In that case the focus will be lost.\n\t\t\t\t\t\t// Otherwise, we don't hijack the focus when the user is focusing on other elements\n\t\t\t\t\t\t// (like the quick inserter).\n\t\t\t\t\t\tif ( contentContainer.contains( activeElement ) ) {\n\t\t\t\t\t\t\t// Return back the focus when closing the inserter.\n\t\t\t\t\t\t\tif ( this.activeElementBeforeExpanded ) {\n\t\t\t\t\t\t\t\tthis.activeElementBeforeExpanded.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};\n}\n"]}
@@ -7,10 +7,18 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = getSidebarControl;
9
9
 
10
+ var _data = require("@wordpress/data");
11
+
10
12
  var _sidebarAdapter = _interopRequireDefault(require("../components/sidebar-block-editor/sidebar-adapter"));
11
13
 
12
14
  var _inserterOuterSection = _interopRequireDefault(require("./inserter-outer-section"));
13
15
 
16
+ var _store = require("../store");
17
+
18
+ /**
19
+ * WordPress dependencies
20
+ */
21
+
14
22
  /**
15
23
  * Internal dependencies
16
24
  */
@@ -48,7 +56,7 @@ function getSidebarControl() {
48
56
  if (!args.unchanged) {
49
57
  // Close the inserter when the section collapses.
50
58
  if (!expanded) {
51
- this.inserter.close();
59
+ (0, _data.dispatch)(_store.store).setIsInserterOpened(false);
52
60
  }
53
61
 
54
62
  this.subscribers.forEach(subscriber => subscriber(expanded, args));
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/controls/sidebar-control.js"],"names":["getInserterId","controlId","getSidebarControl","wp","customize","window","SidebarControl","Control","constructor","args","subscribers","Set","ready","InserterOuterSection","inserter","id","section","add","sectionInstance","inspector","sidebarAdapter","SidebarAdapter","setting","subscribe","callback","delete","onChangeSectionExpanded","expanded","unchanged","close","forEach","subscriber"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,MAAMA,aAAa,GAAKC,SAAF,IAAkB,oBAAoBA,SAAW,EAAvE;;AAEe,SAASC,iBAAT,GAA6B;AAC3C,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA,SAAO,MAAMC,cAAN,SAA6BF,SAAS,CAACG,OAAvC,CAA+C;AACrDC,IAAAA,WAAW,CAAE,GAAGC,IAAL,EAAY;AACtB,YAAO,GAAGA,IAAV;AAEA,WAAKC,WAAL,GAAmB,IAAIC,GAAJ,EAAnB;AACA;;AAEDC,IAAAA,KAAK,GAAG;AACP,YAAMC,oBAAoB,GAAG,oCAA7B;AACA,WAAKC,QAAL,GAAgB,IAAID,oBAAJ,CACfb,aAAa,CAAE,KAAKe,EAAP,CADE,EAEf,EAFe,CAAhB;AAIAX,MAAAA,SAAS,CAACY,OAAV,CAAkBC,GAAlB,CAAuB,KAAKH,QAA5B;AAEA,WAAKI,eAAL,GAAuBd,SAAS,CAACY,OAAV,CAAmB,KAAKA,OAAL,EAAnB,CAAvB;AAEA,WAAKG,SAAL,GAAiB,KAAKD,eAAL,CAAqBC,SAAtC;AAEA,WAAKC,cAAL,GAAsB,IAAIC,uBAAJ,CAAoB,KAAKC,OAAzB,EAAkClB,SAAlC,CAAtB;AACA;;AAEDmB,IAAAA,SAAS,CAAEC,QAAF,EAAa;AACrB,WAAKd,WAAL,CAAiBO,GAAjB,CAAsBO,QAAtB;AAEA,aAAO,MAAM;AACZ,aAAKd,WAAL,CAAiBe,MAAjB,CAAyBD,QAAzB;AACA,OAFD;AAGA;;AAEDE,IAAAA,uBAAuB,CAAEC,QAAF,EAAYlB,IAAZ,EAAmB;AACzC,UAAK,CAAEA,IAAI,CAACmB,SAAZ,EAAwB;AACvB;AACA,YAAK,CAAED,QAAP,EAAkB;AACjB,eAAKb,QAAL,CAAce,KAAd;AACA;;AAED,aAAKnB,WAAL,CAAiBoB,OAAjB,CAA4BC,UAAF,IACzBA,UAAU,CAAEJ,QAAF,EAAYlB,IAAZ,CADX;AAGA;AACD;;AAzCoD,GAAtD;AA2CA","sourcesContent":["/**\n * Internal dependencies\n */\nimport SidebarAdapter from '../components/sidebar-block-editor/sidebar-adapter';\nimport getInserterOuterSection from './inserter-outer-section';\n\nconst getInserterId = ( controlId ) => `widgets-inserter-${ controlId }`;\n\nexport default function getSidebarControl() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class SidebarControl extends customize.Control {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\tthis.subscribers = new Set();\n\t\t}\n\n\t\tready() {\n\t\t\tconst InserterOuterSection = getInserterOuterSection();\n\t\t\tthis.inserter = new InserterOuterSection(\n\t\t\t\tgetInserterId( this.id ),\n\t\t\t\t{}\n\t\t\t);\n\t\t\tcustomize.section.add( this.inserter );\n\n\t\t\tthis.sectionInstance = customize.section( this.section() );\n\n\t\t\tthis.inspector = this.sectionInstance.inspector;\n\n\t\t\tthis.sidebarAdapter = new SidebarAdapter( this.setting, customize );\n\t\t}\n\n\t\tsubscribe( callback ) {\n\t\t\tthis.subscribers.add( callback );\n\n\t\t\treturn () => {\n\t\t\t\tthis.subscribers.delete( callback );\n\t\t\t};\n\t\t}\n\n\t\tonChangeSectionExpanded( expanded, args ) {\n\t\t\tif ( ! args.unchanged ) {\n\t\t\t\t// Close the inserter when the section collapses.\n\t\t\t\tif ( ! expanded ) {\n\t\t\t\t\tthis.inserter.close();\n\t\t\t\t}\n\n\t\t\t\tthis.subscribers.forEach( ( subscriber ) =>\n\t\t\t\t\tsubscriber( expanded, args )\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/controls/sidebar-control.js"],"names":["getInserterId","controlId","getSidebarControl","wp","customize","window","SidebarControl","Control","constructor","args","subscribers","Set","ready","InserterOuterSection","inserter","id","section","add","sectionInstance","inspector","sidebarAdapter","SidebarAdapter","setting","subscribe","callback","delete","onChangeSectionExpanded","expanded","unchanged","customizeWidgetsStore","setIsInserterOpened","forEach","subscriber"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAKA,MAAMA,aAAa,GAAKC,SAAF,IAAkB,oBAAoBA,SAAW,EAAvE;;AAEe,SAASC,iBAAT,GAA6B;AAC3C,QAAM;AACLC,IAA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nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SidebarAdapter from '../components/sidebar-block-editor/sidebar-adapter';\nimport getInserterOuterSection from './inserter-outer-section';\nimport { store as customizeWidgetsStore } from '../store';\n\nconst getInserterId = ( controlId ) => `widgets-inserter-${ controlId }`;\n\nexport default function getSidebarControl() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class SidebarControl extends customize.Control {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\tthis.subscribers = new Set();\n\t\t}\n\n\t\tready() {\n\t\t\tconst InserterOuterSection = getInserterOuterSection();\n\t\t\tthis.inserter = new InserterOuterSection(\n\t\t\t\tgetInserterId( this.id ),\n\t\t\t\t{}\n\t\t\t);\n\t\t\tcustomize.section.add( this.inserter );\n\n\t\t\tthis.sectionInstance = customize.section( this.section() );\n\n\t\t\tthis.inspector = this.sectionInstance.inspector;\n\n\t\t\tthis.sidebarAdapter = new SidebarAdapter( this.setting, customize );\n\t\t}\n\n\t\tsubscribe( callback ) {\n\t\t\tthis.subscribers.add( callback );\n\n\t\t\treturn () => {\n\t\t\t\tthis.subscribers.delete( callback );\n\t\t\t};\n\t\t}\n\n\t\tonChangeSectionExpanded( expanded, args ) {\n\t\t\tif ( ! args.unchanged ) {\n\t\t\t\t// Close the inserter when the section collapses.\n\t\t\t\tif ( ! expanded ) {\n\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\tfalse\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.subscribers.forEach( ( subscriber ) =>\n\t\t\t\t\tsubscriber( expanded, args )\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t};\n}\n"]}
@@ -50,7 +50,9 @@ function getSidebarSection() {
50
50
  var _args$completeCallbac;
51
51
 
52
52
  controls.forEach(control => {
53
- control.onChangeSectionExpanded(expanded, args);
53
+ var _control$onChangeSect;
54
+
55
+ (_control$onChangeSect = control.onChangeSectionExpanded) === null || _control$onChangeSect === void 0 ? void 0 : _control$onChangeSect.call(control, expanded, args);
54
56
  });
55
57
  (_args$completeCallbac = _args.completeCallback) === null || _args$completeCallbac === void 0 ? void 0 : _args$completeCallbac.call(_args);
56
58
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/controls/sidebar-section.js"],"names":["getInspectorSectionId","sidebarId","getSidebarSection","wp","customize","window","SidebarSection","Section","ready","InspectorSection","inspector","id","title","parentSection","customizeAction","params","join","section","add","contentContainer","classList","hasSubSectionOpened","expanded","onChangeExpanded","_args","controls","args","completeCallback","forEach","control","onChangeSectionExpanded","manualTransition","addClass","removeClass","closest","one"],"mappings":";;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,qBAAqB,GAAKC,SAAF,IAC5B,qBAAqBA,SAAW,EADlC;;AAGe,SAASC,iBAAT,GAA6B;AAC3C,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA,SAAO,MAAMC,cAAN,SAA6BF,SAAS,CAACG,OAAvC,CAA+C;AACrDC,IAAAA,KAAK,GAAG;AACP,YAAMC,gBAAgB,GAAG,gCAAzB;AACA,WAAKC,SAAL,GAAiB,IAAID,gBAAJ,CAChBT,qBAAqB,CAAE,KAAKW,EAAP,CADL,EAEhB;AACCC,QAAAA,KAAK,EAAE,cAAI,gBAAJ,CADR;AAECC,QAAAA,aAAa,EAAE,IAFhB;AAGCC,QAAAA,eAAe,EAAE,CAChB,cAAI,aAAJ,CADgB,EAEhB,cAAI,SAAJ,CAFgB,EAGhB,KAAKC,MAAL,CAAYH,KAHI,EAIfI,IAJe,CAIT,KAJS;AAHlB,OAFgB,CAAjB;AAYAZ,MAAAA,SAAS,CAACa,OAAV,CAAkBC,GAAlB,CAAuB,KAAKR,SAA5B;AACA,WAAKS,gBAAL,CAAuB,CAAvB,EAA2BC,SAA3B,CAAqC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AnC;AACAP,YAAAA,IAAI,CAACC,gBAAL;AACA,WAHD;AAIA;AACD,OAzBD,MAyBO;AACN,cAAMJ,gBAAN,CAAwBD,QAAxB,EAAkCI,IAAlC;AACA;AACD;;AA/DoD,GAAtD;AAiEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport getInspectorSection from './inspector-section';\n\nconst getInspectorSectionId = ( sidebarId ) =>\n\t`widgets-inspector-${ sidebarId }`;\n\nexport default function getSidebarSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class SidebarSection extends customize.Section {\n\t\tready() {\n\t\t\tconst InspectorSection = getInspectorSection();\n\t\t\tthis.inspector = new InspectorSection(\n\t\t\t\tgetInspectorSectionId( this.id ),\n\t\t\t\t{\n\t\t\t\t\ttitle: __( 'Block Settings' ),\n\t\t\t\t\tparentSection: this,\n\t\t\t\t\tcustomizeAction: [\n\t\t\t\t\t\t__( 'Customizing' ),\n\t\t\t\t\t\t__( 'Widgets' ),\n\t\t\t\t\t\tthis.params.title,\n\t\t\t\t\t].join( ' ▸ ' ),\n\t\t\t\t}\n\t\t\t);\n\t\t\tcustomize.section.add( this.inspector );\n\t\t\tthis.contentContainer[ 0 ].classList.add(\n\t\t\t\t'customize-widgets__sidebar-section'\n\t\t\t);\n\t\t}\n\t\thasSubSectionOpened() {\n\t\t\treturn this.inspector.expanded();\n\t\t}\n\t\tonChangeExpanded( expanded, _args ) {\n\t\t\tconst controls = this.controls();\n\t\t\tconst args = {\n\t\t\t\t..._args,\n\t\t\t\tcompleteCallback() {\n\t\t\t\t\tcontrols.forEach( ( control ) => {\n\t\t\t\t\t\tcontrol.onChangeSectionExpanded( expanded, args );\n\t\t\t\t\t} );\n\t\t\t\t\t_args.completeCallback?.();\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tif ( args.manualTransition ) {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tthis.contentContainer.addClass( [ 'busy', 'open' ] );\n\t\t\t\t\tthis.contentContainer.removeClass( 'is-sub-section-open' );\n\t\t\t\t\tthis.contentContainer\n\t\t\t\t\t\t.closest( '.wp-full-overlay' )\n\t\t\t\t\t\t.addClass( 'section-open' );\n\t\t\t\t\tthis.contentContainer.one( 'transitionend', () => {\n\t\t\t\t\t\tthis.contentContainer.removeClass( 'busy' );\n\t\t\t\t\t\targs.completeCallback();\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tthis.contentContainer.addClass( [\n\t\t\t\t\t\t'busy',\n\t\t\t\t\t\t'is-sub-section-open',\n\t\t\t\t\t] );\n\t\t\t\t\tthis.contentContainer\n\t\t\t\t\t\t.closest( '.wp-full-overlay' )\n\t\t\t\t\t\t.addClass( 'section-open' );\n\t\t\t\t\tthis.contentContainer.removeClass( 'open' );\n\t\t\t\t\tthis.contentContainer.one( 'transitionend', () => {\n\t\t\t\t\t\tthis.contentContainer.removeClass( 'busy' );\n\t\t\t\t\t\targs.completeCallback();\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsuper.onChangeExpanded( expanded, args );\n\t\t\t}\n\t\t}\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/controls/sidebar-section.js"],"names":["getInspectorSectionId","sidebarId","getSidebarSection","wp","customize","window","SidebarSection","Section","ready","InspectorSection","inspector","id","title","parentSection","customizeAction","params","join","section","add","contentContainer","classList","hasSubSectionOpened","expanded","onChangeExpanded","_args","controls","args","completeCallback","forEach","control","onChangeSectionExpanded","manualTransition","addClass","removeClass","closest","one"],"mappings":";;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,qBAAqB,GAAKC,SAAF,IAC5B,qBAAqBA,SAAW,EADlC;;AAGe,SAASC,iBAAT,GAA6B;AAC3C,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA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BAAL,CAAsBc,WAAtB,CAAmC,qBAAnC;AACA,eAAKd,gBAAL,CACEe,OADF,CACW,kBADX,EAEEF,QAFF,CAEY,cAFZ;AAGA,eAAKb,gBAAL,CAAsBgB,GAAtB,CAA2B,eAA3B,EAA4C,MAAM;AACjD,iBAAKhB,gBAAL,CAAsBc,WAAtB,CAAmC,MAAnC;AACAP,YAAAA,IAAI,CAACC,gBAAL;AACA,WAHD;AAIA,SAVD,MAUO;AACN,eAAKR,gBAAL,CAAsBa,QAAtB,CAAgC,CAC/B,MAD+B,EAE/B,qBAF+B,CAAhC;AAIA,eAAKb,gBAAL,CACEe,OADF,CACW,kBADX,EAEEF,QAFF,CAEY,cAFZ;AAGA,eAAKb,gBAAL,CAAsBc,WAAtB,CAAmC,MAAnC;AACA,eAAKd,gBAAL,CAAsBgB,GAAtB,CAA2B,eAA3B,EAA4C,MAAM;AACjD,iBAAKhB,gBAAL,CAAsBc,WAAtB,CAAmC,MAAnC;AACAP,YAAAA,IAAI,CAACC,gBAAL;AACA,WAHD;AAIA;AACD,OAzBD,MAyBO;AACN,cAAMJ,gBAAN,CAAwBD,QAAxB,EAAkCI,IAAlC;AACA;AACD;;AA/DoD,GAAtD;AAiEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport getInspectorSection from './inspector-section';\n\nconst getInspectorSectionId = ( sidebarId ) =>\n\t`widgets-inspector-${ sidebarId }`;\n\nexport default function getSidebarSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class SidebarSection extends customize.Section {\n\t\tready() {\n\t\t\tconst InspectorSection = getInspectorSection();\n\t\t\tthis.inspector = new InspectorSection(\n\t\t\t\tgetInspectorSectionId( this.id ),\n\t\t\t\t{\n\t\t\t\t\ttitle: __( 'Block Settings' ),\n\t\t\t\t\tparentSection: this,\n\t\t\t\t\tcustomizeAction: [\n\t\t\t\t\t\t__( 'Customizing' ),\n\t\t\t\t\t\t__( 'Widgets' ),\n\t\t\t\t\t\tthis.params.title,\n\t\t\t\t\t].join( ' ▸ ' ),\n\t\t\t\t}\n\t\t\t);\n\t\t\tcustomize.section.add( this.inspector );\n\t\t\tthis.contentContainer[ 0 ].classList.add(\n\t\t\t\t'customize-widgets__sidebar-section'\n\t\t\t);\n\t\t}\n\t\thasSubSectionOpened() {\n\t\t\treturn this.inspector.expanded();\n\t\t}\n\t\tonChangeExpanded( expanded, _args ) {\n\t\t\tconst controls = this.controls();\n\t\t\tconst args = {\n\t\t\t\t..._args,\n\t\t\t\tcompleteCallback() {\n\t\t\t\t\tcontrols.forEach( ( control ) => {\n\t\t\t\t\t\tcontrol.onChangeSectionExpanded?.( expanded, args );\n\t\t\t\t\t} );\n\t\t\t\t\t_args.completeCallback?.();\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tif ( args.manualTransition ) {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tthis.contentContainer.addClass( [ 'busy', 'open' ] );\n\t\t\t\t\tthis.contentContainer.removeClass( 'is-sub-section-open' );\n\t\t\t\t\tthis.contentContainer\n\t\t\t\t\t\t.closest( '.wp-full-overlay' )\n\t\t\t\t\t\t.addClass( 'section-open' );\n\t\t\t\t\tthis.contentContainer.one( 'transitionend', () => {\n\t\t\t\t\t\tthis.contentContainer.removeClass( 'busy' );\n\t\t\t\t\t\targs.completeCallback();\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tthis.contentContainer.addClass( [\n\t\t\t\t\t\t'busy',\n\t\t\t\t\t\t'is-sub-section-open',\n\t\t\t\t\t] );\n\t\t\t\t\tthis.contentContainer\n\t\t\t\t\t\t.closest( '.wp-full-overlay' )\n\t\t\t\t\t\t.addClass( 'section-open' );\n\t\t\t\t\tthis.contentContainer.removeClass( 'open' );\n\t\t\t\t\tthis.contentContainer.one( 'transitionend', () => {\n\t\t\t\t\t\tthis.contentContainer.removeClass( 'busy' );\n\t\t\t\t\t\targs.completeCallback();\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsuper.onChangeExpanded( expanded, args );\n\t\t\t}\n\t\t}\n\t};\n}\n"]}
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.__unstableToggleFeature = __unstableToggleFeature;
7
+ exports.setIsInserterOpened = setIsInserterOpened;
7
8
 
8
9
  /**
9
10
  * Returns an action object used to toggle a feature flag.
@@ -22,4 +23,24 @@ function __unstableToggleFeature(feature) {
22
23
  feature
23
24
  };
24
25
  }
26
+ /**
27
+ * Returns an action object used to open/close the inserter.
28
+ *
29
+ * @param {boolean|Object} value Whether the inserter should be
30
+ * opened (true) or closed (false).
31
+ * To specify an insertion point,
32
+ * use an object.
33
+ * @param {string} value.rootClientId The root client ID to insert at.
34
+ * @param {number} value.insertionIndex The index to insert at.
35
+ *
36
+ * @return {Object} Action object.
37
+ */
38
+
39
+
40
+ function setIsInserterOpened(value) {
41
+ return {
42
+ type: 'SET_IS_INSERTER_OPENED',
43
+ value
44
+ };
45
+ }
25
46
  //# sourceMappingURL=actions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/store/actions.js"],"names":["__unstableToggleFeature","feature","type"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,uBAAT,CAAkCC,OAAlC,EAA4C;AAClD,SAAO;AACNC,IAAAA,IAAI,EAAE,gBADA;AAEND,IAAAA;AAFM,GAAP;AAIA","sourcesContent":["/**\n * Returns an action object used to toggle a feature flag.\n *\n * This function is unstable, as it is mostly copied from the edit-post\n * package. Editor features and preferences have a lot of scope for\n * being generalized and refactored.\n *\n * @param {string} feature Feature name.\n *\n * @return {Object} Action object.\n */\nexport function __unstableToggleFeature( feature ) {\n\treturn {\n\t\ttype: 'TOGGLE_FEATURE',\n\t\tfeature,\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/store/actions.js"],"names":["__unstableToggleFeature","feature","type","setIsInserterOpened","value"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,uBAAT,CAAkCC,OAAlC,EAA4C;AAClD,SAAO;AACNC,IAAAA,IAAI,EAAE,gBADA;AAEND,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,mBAAT,CAA8BC,KAA9B,EAAsC;AAC5C,SAAO;AACNF,IAAAA,IAAI,EAAE,wBADA;AAENE,IAAAA;AAFM,GAAP;AAIA","sourcesContent":["/**\n * Returns an action object used to toggle a feature flag.\n *\n * This function is unstable, as it is mostly copied from the edit-post\n * package. Editor features and preferences have a lot of scope for\n * being generalized and refactored.\n *\n * @param {string} feature Feature name.\n *\n * @return {Object} Action object.\n */\nexport function __unstableToggleFeature( feature ) {\n\treturn {\n\t\ttype: 'TOGGLE_FEATURE',\n\t\tfeature,\n\t};\n}\n\n/**\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"]}