@wordpress/customize-widgets 4.11.0 → 4.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/block-appender/index.js +2 -6
- package/build/components/block-appender/index.js.map +1 -1
- package/build/components/block-inspector-button/index.js +9 -13
- package/build/components/block-inspector-button/index.js.map +1 -1
- package/build/components/customize-widgets/index.js +5 -6
- package/build/components/customize-widgets/index.js.map +1 -1
- package/build/components/error-boundary/index.js +4 -5
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/focus-control/index.js +5 -6
- package/build/components/focus-control/index.js.map +1 -1
- package/build/components/focus-control/use-blocks-focus-control.js +1 -1
- package/build/components/focus-control/use-blocks-focus-control.js.map +1 -1
- package/build/components/header/index.js +7 -8
- package/build/components/header/index.js.map +1 -1
- package/build/components/inserter/index.js +3 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +42 -50
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +6 -7
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/sidebar-block-editor/index.js +19 -27
- package/build/components/sidebar-block-editor/index.js.map +1 -1
- package/build/components/sidebar-block-editor/sidebar-adapter.js +3 -7
- package/build/components/sidebar-block-editor/sidebar-adapter.js.map +1 -1
- package/build/components/sidebar-block-editor/sidebar-editor-provider.js +8 -9
- package/build/components/sidebar-block-editor/sidebar-editor-provider.js.map +1 -1
- package/build/components/sidebar-controls/index.js +5 -6
- package/build/components/sidebar-controls/index.js.map +1 -1
- package/build/components/welcome-guide/index.js +3 -4
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/controls/inserter-outer-section.js +2 -2
- package/build/controls/inserter-outer-section.js.map +1 -1
- package/build/controls/inspector-section.js +3 -4
- package/build/controls/inspector-section.js.map +1 -1
- package/build/controls/sidebar-control.js +2 -2
- package/build/controls/sidebar-control.js.map +1 -1
- package/build/controls/sidebar-section.js +2 -6
- package/build/controls/sidebar-section.js.map +1 -1
- package/build/filters/move-to-sidebar.js +4 -3
- package/build/filters/move-to-sidebar.js.map +1 -1
- package/build/filters/wide-widget-display.js +4 -8
- package/build/filters/wide-widget-display.js.map +1 -1
- package/build/{private-apis.js → lock-unlock.js} +1 -1
- package/build/lock-unlock.js.map +1 -0
- package/build/store/reducer.js +1 -4
- package/build/store/reducer.js.map +1 -1
- package/build/utils.js +8 -10
- package/build/utils.js.map +1 -1
- package/build-module/components/block-appender/index.js +2 -3
- package/build-module/components/block-appender/index.js.map +1 -1
- package/build-module/components/block-inspector-button/index.js +9 -10
- package/build-module/components/block-inspector-button/index.js.map +1 -1
- package/build-module/components/customize-widgets/index.js +5 -6
- package/build-module/components/customize-widgets/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +4 -5
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/focus-control/index.js +5 -6
- package/build-module/components/focus-control/index.js.map +1 -1
- package/build-module/components/focus-control/use-blocks-focus-control.js +1 -1
- package/build-module/components/focus-control/use-blocks-focus-control.js.map +1 -1
- package/build-module/components/header/index.js +7 -8
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/inserter/index.js +3 -4
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +40 -48
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +6 -7
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/sidebar-block-editor/index.js +19 -27
- package/build-module/components/sidebar-block-editor/index.js.map +1 -1
- package/build-module/components/sidebar-block-editor/sidebar-adapter.js +3 -7
- package/build-module/components/sidebar-block-editor/sidebar-adapter.js.map +1 -1
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js +6 -7
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js.map +1 -1
- package/build-module/components/sidebar-controls/index.js +5 -6
- package/build-module/components/sidebar-controls/index.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +3 -4
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/controls/inserter-outer-section.js +2 -2
- package/build-module/controls/inserter-outer-section.js.map +1 -1
- package/build-module/controls/inspector-section.js +3 -4
- package/build-module/controls/inspector-section.js.map +1 -1
- package/build-module/controls/sidebar-control.js +2 -2
- package/build-module/controls/sidebar-control.js.map +1 -1
- package/build-module/controls/sidebar-section.js +2 -6
- package/build-module/controls/sidebar-section.js.map +1 -1
- package/build-module/filters/move-to-sidebar.js +4 -3
- package/build-module/filters/move-to-sidebar.js.map +1 -1
- package/build-module/filters/wide-widget-display.js +4 -5
- package/build-module/filters/wide-widget-display.js.map +1 -1
- package/build-module/{private-apis.js → lock-unlock.js} +1 -1
- package/build-module/lock-unlock.js.map +1 -0
- package/build-module/store/reducer.js +1 -4
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/utils.js +8 -10
- package/build-module/utils.js.map +1 -1
- package/build-style/style-rtl.css +25 -0
- package/build-style/style.css +25 -0
- package/package.json +22 -22
- package/src/components/keyboard-shortcuts/index.js +1 -1
- package/src/components/sidebar-block-editor/sidebar-editor-provider.js +1 -1
- package/src/style.scss +31 -0
- package/build/private-apis.js.map +0 -1
- package/build-module/private-apis.js.map +0 -1
- /package/src/{private-apis.js → lock-unlock.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/welcome-guide/index.js"],"names":["__","Button","ExternalLink","useDispatch","store","preferencesStore","WelcomeGuide","sidebar","toggle","isEntirelyBlockWidgets","getWidgets","every","widget","id","startsWith"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,YAAjB,QAAqC,uBAArC;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA,eAAe,SAASC,YAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/welcome-guide/index.js"],"names":["__","Button","ExternalLink","useDispatch","store","preferencesStore","WelcomeGuide","sidebar","toggle","isEntirelyBlockWidgets","getWidgets","every","widget","id","startsWith"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,YAAjB,QAAqC,uBAArC;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA,eAAe,SAASC,YAAT,CAAuB;AAAEC,EAAAA;AAAF,CAAvB,EAAqC;AACnD,QAAM;AAAEC,IAAAA;AAAF,MAAaL,WAAW,CAAEE,gBAAF,CAA9B;AAEA,QAAMI,sBAAsB,GAAGF,OAAO,CACpCG,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,+BACC;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,KACGd,EAAE,CAAE,0BAAF,CADL,CAhBD,EAmBC;AAAG,IAAA,SAAS,EAAC;AAAb,KACGS,sBAAsB,GACrBT,EAAE,CACF,0LADE,CADmB,GAIrBA,EAAE,CACF,yHADE,CALN,CAnBD,EA4BC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,yCADX;AAEC,IAAA,OAAO,EAAC,SAFT;AAGC,IAAA,OAAO,EAAG,MACTQ,MAAM,CAAE,wBAAF,EAA4B,cAA5B;AAJR,KAOGR,EAAE,CAAE,QAAF,CAPL,CA5BD,EAqCC;AAAI,IAAA,SAAS,EAAC;AAAd,IArCD,EAsCG,CAAES,sBAAF,IACD;AAAG,IAAA,SAAS,EAAC;AAAb,KACGT,EAAE,CAAE,qCAAF,CADL,EAEC,yBAFD,EAGC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGA,EAAE,CACR,gDADQ;AADV,KAKGA,EAAE,CAAE,iCAAF,CALL,CAHD,CAvCF,EAmDC;AAAG,IAAA,SAAS,EAAC;AAAb,KACGA,EAAE,CAAE,0BAAF,CADL,EAEC,yBAFD,EAGC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGA,EAAE,CACR,qEADQ;AADV,KAKGA,EAAE,CAAE,0BAAF,CALL,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 preferencesStore } from '@wordpress/preferences';\n\nexport default function WelcomeGuide( { sidebar } ) {\n\tconst { toggle } = useDispatch( preferencesStore );\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\ttoggle( '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/documentation/article/wordpress-block-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"]}
|
|
@@ -38,8 +38,8 @@ export default function getInserterOuterSection() {
|
|
|
38
38
|
|
|
39
39
|
customize.sectionConstructor.outer = customize.OuterSection;
|
|
40
40
|
return class InserterOuterSection extends customize.OuterSection {
|
|
41
|
-
constructor() {
|
|
42
|
-
super(...
|
|
41
|
+
constructor(...args) {
|
|
42
|
+
super(...args); // This is necessary since we're creating a new class which is not identical to the original OuterSection.
|
|
43
43
|
// @See https://github.com/WordPress/wordpress-develop/blob/42b05c397c50d9dc244083eff52991413909d4bd/src/js/_enqueues/wp/customize/controls.js#L1427-L1436
|
|
44
44
|
|
|
45
45
|
this.params.type = 'outer';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/controls/inserter-outer-section.js"],"names":["ESCAPE","focus","dispatch","store","customizeWidgetsStore","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","code","defaultPrevented","preventDefault","stopPropagation","setIsInserterOpened","addClass","isFromInternalAction","bind","open","activeElement","expand","completeCallback","searchBox","tabbable","find","close","contains"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,qBAAvB;AACA,SAASC,KAAT,QAAsB,gBAAtB;AACA,SAASC,QAAT,QAAyB,iBAAzB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,qBAAlB,QAA+C,UAA/C;AAEA,eAAe,SAASC,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,SAAmCd,SAAS,CAACE,YAA7C,CAA0D;AAChEa,IAAAA,WAAW,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/controls/inserter-outer-section.js"],"names":["ESCAPE","focus","dispatch","store","customizeWidgetsStore","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","code","defaultPrevented","preventDefault","stopPropagation","setIsInserterOpened","addClass","isFromInternalAction","bind","open","activeElement","expand","completeCallback","searchBox","tabbable","find","close","contains"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,qBAAvB;AACA,SAASC,KAAT,QAAsB,gBAAtB;AACA,SAASC,QAAT,QAAyB,iBAAzB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,qBAAlB,QAA+C,UAA/C;AAEA,eAAe,SAASC,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,C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B,CAACC,aAAjB,CAA+Bc,aADhC;AAGA,aAAKH,oBAAL,GAA4B,IAA5B;AAEA,aAAKI,MAAL,CAAa;AACZC,UAAAA,gBAAgB,GAAG;AAClB;AACA;AACA;AACA,kBAAMC,SAAS,GACd1C,KAAK,CAAC2C,QAAN,CAAeC,IAAf,CAAqBpB,gBAArB,EAAyC,CAAzC,CADD;;AAEA,gBAAKkB,SAAL,EAAiB;AAChBA,cAAAA,SAAS,CAAC1C,KAAV;AACA;AACD;;AAVW,SAAb;AAYA;AACD;;AACD6C,IAAAA,KAAK,GAAG;AACP,UAAK,KAAKnC,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,CAACsB,QAAjB,CAA2BP,aAA3B,CAAL,EAAkD;AACjD;AACA,kBAAK,KAAKjB,2BAAV,EAAwC;AACvC,qBAAKA,2BAAL,CAAiCtB,KAAjC;AACA;AACD;AACD;;AAba,SAAf;AAeA;AACD;;AA/F+D,GAAjE;AAiGA","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 =\n\t\t\t\tthis.contentContainer[ 0 ].ownerDocument.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 ||\n\t\t\t\t\t\t\tevent.code === 'Escape' ) &&\n\t\t\t\t\t\t! event.defaultPrevented\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.preventDefault();\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 =\n\t\t\t\t\t\t\tfocus.tabbable.find( contentContainer )[ 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"]}
|
|
@@ -51,10 +51,9 @@ export default function getInspectorSection() {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
open(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
54
|
+
open({
|
|
55
|
+
returnFocusWhenClose
|
|
56
|
+
} = {}) {
|
|
58
57
|
this.isOpen = true;
|
|
59
58
|
this.returnFocusWhenClose = returnFocusWhenClose;
|
|
60
59
|
this.expand({
|
|
@@ -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","_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":"AAAA,eAAe,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,QAANC,MAAM,CAAEC,KAAF,EAAU;AACnB,WAAKF,OAAL,GAAeE,KAAf;AACA,WAAKC,sBAAL;AACA;;AACDC,IAAAA,KAAK,GAAG;AACP,WAAKC,gBAAL,CAAuB,CAAvB,EAA2BC,SAA3B,CAAqCC,GAArC,CACC,qCADD;AAGA;;AACDC,IAAAA,oBAAoB,GAAG;AACtB,aAAO,KAAKP,MAAZ;AACA;;AACDQ,IAAAA,gBAAgB,CAAEC,QAAF,EAAYC,IAAZ,EAAmB;AAClC,YAAMF,gBAAN,CAAwBC,QAAxB,EAAkCC,IAAlC;;AAEA,UAAK,KAAKb,aAAL,IAAsB,CAAEa,IAAI,CAACC,SAAlC,EAA8C;AAC7C,YAAKF,QAAL,EAAgB;AACf,eAAKZ,aAAL,CAAmBe,QAAnB,CAA6B;AAC5BC,YAAAA,gBAAgB,EAAE;AADU,WAA7B;AAGA,SAJD,MAIO;AACN,eAAKhB,aAAL,CAAmBiB,MAAnB,CAA2B;AAC1BD,YAAAA,gBAAgB,EAAE,IADQ;AAE1BE,YAAAA,gBAAgB,EAAE,MAAM;AACvB;AACA,kBACC,KAAKjB,oBAAL,IACA,CAAE,KAAKM,gBAAL,CAAuB,CAAvB,EAA2BY,QAA3B,CACD,KAAKlB,oBADJ,CAFH,EAKE;AACD,qBAAKA,oBAAL,CAA0BmB,KAA1B;AACA;AACD;AAZyB,WAA3B;AAcA;AACD;AACD;;AACDC,IAAAA,IAAI,
|
|
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":"AAAA,eAAe,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,QAANC,MAAM,CAAEC,KAAF,EAAU;AACnB,WAAKF,OAAL,GAAeE,KAAf;AACA,WAAKC,sBAAL;AACA;;AACDC,IAAAA,KAAK,GAAG;AACP,WAAKC,gBAAL,CAAuB,CAAvB,EAA2BC,SAA3B,CAAqCC,GAArC,CACC,qCADD;AAGA;;AACDC,IAAAA,oBAAoB,GAAG;AACtB,aAAO,KAAKP,MAAZ;AACA;;AACDQ,IAAAA,gBAAgB,CAAEC,QAAF,EAAYC,IAAZ,EAAmB;AAClC,YAAMF,gBAAN,CAAwBC,QAAxB,EAAkCC,IAAlC;;AAEA,UAAK,KAAKb,aAAL,IAAsB,CAAEa,IAAI,CAACC,SAAlC,EAA8C;AAC7C,YAAKF,QAAL,EAAgB;AACf,eAAKZ,aAAL,CAAmBe,QAAnB,CAA6B;AAC5BC,YAAAA,gBAAgB,EAAE;AADU,WAA7B;AAGA,SAJD,MAIO;AACN,eAAKhB,aAAL,CAAmBiB,MAAnB,CAA2B;AAC1BD,YAAAA,gBAAgB,EAAE,IADQ;AAE1BE,YAAAA,gBAAgB,EAAE,MAAM;AACvB;AACA,kBACC,KAAKjB,oBAAL,IACA,CAAE,KAAKM,gBAAL,CAAuB,CAAvB,EAA2BY,QAA3B,CACD,KAAKlB,oBADJ,CAFH,EAKE;AACD,qBAAKA,oBAAL,CAA0BmB,KAA1B;AACA;AACD;AAZyB,WAA3B;AAcA;AACD;AACD;;AACDC,IAAAA,IAAI,CAAE;AAAEpB,MAAAA;AAAF,QAA2B,EAA7B,EAAkC;AACrC,WAAKE,MAAL,GAAc,IAAd;AACA,WAAKF,oBAAL,GAA4BA,oBAA5B;AAEA,WAAKgB,MAAL,CAAa;AACZK,QAAAA,aAAa,EAAE;AADH,OAAb;AAGA;;AACDC,IAAAA,KAAK,GAAG;AACP,WAAKR,QAAL,CAAe;AACdO,QAAAA,aAAa,EAAE;AADD,OAAf;AAGA;;AACDP,IAAAA,QAAQ,CAAEhB,OAAF,EAAY;AACnB;AACA;AACA;AACA;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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/controls/sidebar-control.js"],"names":["dispatch","SidebarAdapter","getInserterOuterSection","store","customizeWidgetsStore","getInserterId","controlId","getSidebarControl","wp","customize","window","SidebarControl","Control","constructor","subscribers","Set","ready","InserterOuterSection","inserter","id","section","add","sectionInstance","inspector","sidebarAdapter","setting","subscribe","callback","delete","onChangeSectionExpanded","expanded","
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/controls/sidebar-control.js"],"names":["dispatch","SidebarAdapter","getInserterOuterSection","store","customizeWidgetsStore","getInserterId","controlId","getSidebarControl","wp","customize","window","SidebarControl","Control","constructor","args","subscribers","Set","ready","InserterOuterSection","inserter","id","section","add","sectionInstance","inspector","sidebarAdapter","setting","subscribe","callback","delete","onChangeSectionExpanded","expanded","unchanged","setIsInserterOpened","forEach","subscriber"],"mappings":"AAAA;AACA;AACA;AACA,SAASA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AAEA,IAAI,CAACkB,SAAZ,EAAwB;AACvB;AACA,YAAK,CAAED,QAAP,EAAkB;AACjB/B,UAAAA,QAAQ,CAAEI,qBAAF,CAAR,CAAkC6B,mBAAlC,CACC,KADD;AAGA;;AAED,aAAKlB,WAAL,CAAiBmB,OAAjB,CAA4BC,UAAF,IACzBA,UAAU,CAAEJ,QAAF,EAAYjB,IAAZ,CADX;AAGA;AACD;;AA3CoD,GAAtD;AA6CA","sourcesContent":["/**\n * WordPress dependencies\n */\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"]}
|
|
@@ -42,14 +42,10 @@ export default function getSidebarSection() {
|
|
|
42
42
|
const args = { ..._args,
|
|
43
43
|
|
|
44
44
|
completeCallback() {
|
|
45
|
-
var _args$completeCallbac;
|
|
46
|
-
|
|
47
45
|
controls.forEach(control => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
(_control$onChangeSect = control.onChangeSectionExpanded) === null || _control$onChangeSect === void 0 ? void 0 : _control$onChangeSect.call(control, expanded, args);
|
|
46
|
+
control.onChangeSectionExpanded?.(expanded, args);
|
|
51
47
|
});
|
|
52
|
-
|
|
48
|
+
_args.completeCallback?.();
|
|
53
49
|
}
|
|
54
50
|
|
|
55
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/controls/sidebar-section.js"],"names":["__","getInspectorSection","getInspectorSectionId","sidebarId","getSidebarSection","wp","customize","window","reduceMotionMediaQuery","matchMedia","isReducedMotion","matches","addEventListener","event","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","handleTransitionEnd","one"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,qBAAhC;;AAEA,MAAMC,qBAAqB,GAAKC,SAAF,IAC5B,qBAAqBA,SAAW,EADlC;;AAGA,eAAe,SAASC,iBAAT,GAA6B;AAC3C,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA,QAAMC,sBAAsB,GAAGD,MAAM,CAACE,UAAP,CAC9B,kCAD8B,CAA/B;AAGA,MAAIC,eAAe,GAAGF,sBAAsB,CAACG,OAA7C;AACAH,EAAAA,sBAAsB,CAACI,gBAAvB,CAAyC,QAAzC,EAAqDC,KAAF,IAAa;AAC/DH,IAAAA,eAAe,GAAGG,KAAK,CAACF,OAAxB;AACA,GAFD;AAIA,SAAO,MAAMG,cAAN,SAA6BR,SAAS,CAACS,OAAvC,CAA+C;AACrDC,IAAAA,KAAK,GAAG;AACP,YAAMC,gBAAgB,GAAGhB,mBAAmB,EAA5C;AACA,WAAKiB,SAAL,GAAiB,IAAID,gBAAJ,CAChBf,qBAAqB,CAAE,KAAKiB,EAAP,CADL,EAEhB;AACCC,QAAAA,KAAK,EAAEpB,EAAE,CAAE,gBAAF,CADV;AAECqB,QAAAA,aAAa,EAAE,IAFhB;AAGCC,QAAAA,eAAe,EAAE,CAChBtB,EAAE,CAAE,aAAF,CADc,EAEhBA,EAAE,CAAE,SAAF,CAFc,EAGhB,KAAKuB,MAAL,CAAYH,KAHI,EAIfI,IAJe,CAIT,KAJS;AAHlB,OAFgB,CAAjB;AAYAlB,MAAAA,SAAS,CAACmB,OAAV,CAAkBC,GAAlB,CAAuB,KAAKR,SAA5B;AACA,WAAKS,gBAAL,CAAuB,CAAvB,EAA2BC,SAA3B,CAAqCF,GAArC,CACC,oCADD;AAGA;;AACDG,IAAAA,mBAAmB,GAAG;AACrB,aAAO,KAAKX,SAAL,CAAeY,QAAf,EAAP;AACA;;AACDC,IAAAA,gBAAgB,CAAED,QAAF,EAAYE,KAAZ,EAAoB;AACnC,YAAMC,QAAQ,GAAG,KAAKA,QAAL,EAAjB;AACA,YAAMC,IAAI,GAAG,EACZ,GAAGF,KADS;;AAEZG,QAAAA,gBAAgB,GAAG;
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/controls/sidebar-section.js"],"names":["__","getInspectorSection","getInspectorSectionId","sidebarId","getSidebarSection","wp","customize","window","reduceMotionMediaQuery","matchMedia","isReducedMotion","matches","addEventListener","event","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","handleTransitionEnd","one"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,qBAAhC;;AAEA,MAAMC,qBAAqB,GAAKC,SAAF,IAC5B,qBAAqBA,SAAW,EADlC;;AAGA,eAAe,SAASC,iBAAT,GAA6B;AAC3C,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA,QAAMC,sBAAsB,GAAGD,MAAM,CAACE,UAAP,CAC9B,kCAD8B,CAA/B;AAGA,MAAIC,eAAe,GAAGF,sBAAsB,CAACG,OAA7C;AACAH,EAAAA,sBAAsB,CAACI,gBAAvB,CAAyC,QAAzC,EAAqDC,KAAF,IAAa;AAC/DH,IAAAA,eAAe,GAAGG,KAAK,CAACF,OAAxB;AACA,GAFD;AAIA,SAAO,MAAMG,cAAN,SAA6BR,SAAS,CAACS,OAAvC,CAA+C;AACrDC,IAAAA,KAAK,GAAG;AACP,YAAMC,gBAAgB,GAAGhB,mBAAmB,EAA5C;AACA,WAAKiB,SAAL,GAAiB,IAAID,gBAAJ,CAChBf,qBAAqB,CAAE,KAAKiB,EAAP,CADL,EAEhB;AACCC,QAAAA,KAAK,EAAEpB,EAAE,CAAE,gBAAF,CADV;AAECqB,QAAAA,aAAa,EAAE,IAFhB;AAGCC,QAAAA,eAAe,EAAE,CAChBtB,EAAE,CAAE,aAAF,CADc,EAEhBA,EAAE,CAAE,SAAF,CAFc,EAGhB,KAAKuB,MAAL,CAAYH,KAHI,EAIfI,IAJe,CAIT,KAJS;AAHlB,OAFgB,CAAjB;AAYAlB,MA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AAmB;AACnB,SAFD,MAEO;AACN,eAAKhB,gBAAL,CAAsBiB,GAAtB,CACC,eADD,EAECD,mBAFD;AAIA;AACD,OA/BD,MA+BO;AACN,cAAMZ,gBAAN,CAAwBD,QAAxB,EAAkCI,IAAlC;AACA;AACD;;AArEoD,GAAtD;AAuEA","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\tconst reduceMotionMediaQuery = window.matchMedia(\n\t\t'(prefers-reduced-motion: reduce)'\n\t);\n\tlet isReducedMotion = reduceMotionMediaQuery.matches;\n\treduceMotionMediaQuery.addEventListener( 'change', ( event ) => {\n\t\tisReducedMotion = event.matches;\n\t} );\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} 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}\n\n\t\t\t\tconst handleTransitionEnd = () => {\n\t\t\t\t\tthis.contentContainer.removeClass( 'busy' );\n\t\t\t\t\targs.completeCallback();\n\t\t\t\t};\n\n\t\t\t\tif ( isReducedMotion ) {\n\t\t\t\t\thandleTransitionEnd();\n\t\t\t\t} else {\n\t\t\t\t\tthis.contentContainer.one(\n\t\t\t\t\t\t'transitionend',\n\t\t\t\t\t\thandleTransitionEnd\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"]}
|
|
@@ -19,7 +19,7 @@ const withMoveToSidebarToolbarItem = createHigherOrderComponent(BlockEdit => pro
|
|
|
19
19
|
let widgetId = getWidgetIdFromBlock(props);
|
|
20
20
|
const sidebarControls = useSidebarControls();
|
|
21
21
|
const activeSidebarControl = useActiveSidebarControl();
|
|
22
|
-
const hasMultipleSidebars =
|
|
22
|
+
const hasMultipleSidebars = sidebarControls?.length > 1;
|
|
23
23
|
const blockName = props.name;
|
|
24
24
|
const clientId = props.clientId;
|
|
25
25
|
const canInsertBlockInSidebar = useSelect(select => {
|
|
@@ -61,13 +61,14 @@ const withMoveToSidebarToolbarItem = createHigherOrderComponent(BlockEdit => pro
|
|
|
61
61
|
focusWidget(widgetId);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
return createElement(Fragment, null, createElement(BlockEdit, props
|
|
64
|
+
return createElement(Fragment, null, createElement(BlockEdit, { ...props
|
|
65
|
+
}), hasMultipleSidebars && canInsertBlockInSidebar && createElement(BlockControls, null, createElement(MoveToWidgetArea, {
|
|
65
66
|
widgetAreas: sidebarControls.map(sidebarControl => ({
|
|
66
67
|
id: sidebarControl.id,
|
|
67
68
|
name: sidebarControl.params.label,
|
|
68
69
|
description: sidebarControl.params.description
|
|
69
70
|
})),
|
|
70
|
-
currentWidgetAreaId: activeSidebarControl
|
|
71
|
+
currentWidgetAreaId: activeSidebarControl?.id,
|
|
71
72
|
onSelect: moveToSidebar
|
|
72
73
|
})));
|
|
73
74
|
}, 'withMoveToSidebarToolbarItem');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/filters/move-to-sidebar.js"],"names":["BlockControls","store","blockEditorStore","createHigherOrderComponent","useSelect","useDispatch","addFilter","MoveToWidgetArea","getWidgetIdFromBlock","useSidebarControls","useActiveSidebarControl","useFocusControl","blockToWidget","withMoveToSidebarToolbarItem","BlockEdit","props","widgetId","sidebarControls","activeSidebarControl","hasMultipleSidebars","length","blockName","name","clientId","canInsertBlockInSidebar","select","canInsertBlockType","block","getBlock","removeBlock","focusWidget","moveToSidebar","sidebarControlId","newSidebarControl","find","sidebarControl","id","oldSetting","setting","newSetting","filter","sidebarAdapter","addedWidgetIds","setWidgets","getWidgets","reverse","map","params","label","description"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,aADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,gBAAT,EAA2BC,oBAA3B,QAAuD,oBAAvD;AAEA;AACA;AACA;;AACA,SACCC,kBADD,EAECC,uBAFD,QAGO,gCAHP;AAIA,SAASC,eAAT,QAAgC,6BAAhC;AACA,SAASC,aAAT,QAA8B,UAA9B;AAEA,MAAMC,4BAA4B,GAAGV,0BAA0B,CAC5DW,SAAF,IAAmBC,KAAF,IAAa;AAC7B,MAAIC,QAAQ,GAAGR,oBAAoB,CAAEO,KAAF,CAAnC;AACA,QAAME,eAAe,GAAGR,kBAAkB,EAA1C;AACA,QAAMS,oBAAoB,GAAGR,uBAAuB,EAApD;AACA,QAAMS,mBAAmB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/filters/move-to-sidebar.js"],"names":["BlockControls","store","blockEditorStore","createHigherOrderComponent","useSelect","useDispatch","addFilter","MoveToWidgetArea","getWidgetIdFromBlock","useSidebarControls","useActiveSidebarControl","useFocusControl","blockToWidget","withMoveToSidebarToolbarItem","BlockEdit","props","widgetId","sidebarControls","activeSidebarControl","hasMultipleSidebars","length","blockName","name","clientId","canInsertBlockInSidebar","select","canInsertBlockType","block","getBlock","removeBlock","focusWidget","moveToSidebar","sidebarControlId","newSidebarControl","find","sidebarControl","id","oldSetting","setting","newSetting","filter","sidebarAdapter","addedWidgetIds","setWidgets","getWidgets","reverse","map","params","label","description"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,aADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,gBAAT,EAA2BC,oBAA3B,QAAuD,oBAAvD;AAEA;AACA;AACA;;AACA,SACCC,k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dependencies\n */\nimport {\n\tBlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { MoveToWidgetArea, getWidgetIdFromBlock } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseSidebarControls,\n\tuseActiveSidebarControl,\n} from '../components/sidebar-controls';\nimport { useFocusControl } from '../components/focus-control';\nimport { blockToWidget } from '../utils';\n\nconst withMoveToSidebarToolbarItem = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tlet widgetId = getWidgetIdFromBlock( props );\n\t\tconst sidebarControls = useSidebarControls();\n\t\tconst activeSidebarControl = useActiveSidebarControl();\n\t\tconst hasMultipleSidebars = sidebarControls?.length > 1;\n\t\tconst blockName = props.name;\n\t\tconst clientId = props.clientId;\n\t\tconst canInsertBlockInSidebar = useSelect(\n\t\t\t( select ) => {\n\t\t\t\t// Use an empty string to represent the root block list, which\n\t\t\t\t// in the customizer editor represents a sidebar/widget area.\n\t\t\t\treturn select( blockEditorStore ).canInsertBlockType(\n\t\t\t\t\tblockName,\n\t\t\t\t\t''\n\t\t\t\t);\n\t\t\t},\n\t\t\t[ blockName ]\n\t\t);\n\t\tconst block = useSelect(\n\t\t\t( select ) => select( blockEditorStore ).getBlock( clientId ),\n\t\t\t[ clientId ]\n\t\t);\n\t\tconst { removeBlock } = useDispatch( blockEditorStore );\n\t\tconst [ , focusWidget ] = useFocusControl();\n\n\t\tfunction moveToSidebar( sidebarControlId ) {\n\t\t\tconst newSidebarControl = sidebarControls.find(\n\t\t\t\t( sidebarControl ) => sidebarControl.id === sidebarControlId\n\t\t\t);\n\n\t\t\tif ( widgetId ) {\n\t\t\t\t/**\n\t\t\t\t * If there's a widgetId, move it to the other sidebar.\n\t\t\t\t */\n\t\t\t\tconst oldSetting = activeSidebarControl.setting;\n\t\t\t\tconst newSetting = newSidebarControl.setting;\n\n\t\t\t\toldSetting( oldSetting().filter( ( id ) => id !== widgetId ) );\n\t\t\t\tnewSetting( [ ...newSetting(), widgetId ] );\n\t\t\t} else {\n\t\t\t\t/**\n\t\t\t\t * If there isn't a widgetId, it's most likely a inner block.\n\t\t\t\t * First, remove the block in the original sidebar,\n\t\t\t\t * then, create a new widget in the new sidebar and get back its widgetId.\n\t\t\t\t */\n\t\t\t\tconst sidebarAdapter = newSidebarControl.sidebarAdapter;\n\n\t\t\t\tremoveBlock( clientId );\n\t\t\t\tconst addedWidgetIds = sidebarAdapter.setWidgets( [\n\t\t\t\t\t...sidebarAdapter.getWidgets(),\n\t\t\t\t\tblockToWidget( block ),\n\t\t\t\t] );\n\t\t\t\t// The last non-null id is the added widget's id.\n\t\t\t\twidgetId = addedWidgetIds.reverse().find( ( id ) => !! id );\n\t\t\t}\n\n\t\t\t// Move focus to the moved widget and expand the sidebar.\n\t\t\tfocusWidget( widgetId );\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ hasMultipleSidebars && canInsertBlockInSidebar && (\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<MoveToWidgetArea\n\t\t\t\t\t\t\twidgetAreas={ sidebarControls.map(\n\t\t\t\t\t\t\t\t( sidebarControl ) => ( {\n\t\t\t\t\t\t\t\t\tid: sidebarControl.id,\n\t\t\t\t\t\t\t\t\tname: sidebarControl.params.label,\n\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\tsidebarControl.params.description,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tcurrentWidgetAreaId={ activeSidebarControl?.id }\n\t\t\t\t\t\t\tonSelect={ moveToSidebar }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withMoveToSidebarToolbarItem'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/customize-widgets/block-edit',\n\twithMoveToSidebarToolbarItem\n);\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -10,15 +9,15 @@ const {
|
|
|
10
9
|
wp
|
|
11
10
|
} = window;
|
|
12
11
|
const withWideWidgetDisplay = createHigherOrderComponent(BlockEdit => props => {
|
|
13
|
-
var _wp$customize$Widgets
|
|
12
|
+
var _wp$customize$Widgets;
|
|
14
13
|
|
|
15
14
|
const {
|
|
16
15
|
idBase
|
|
17
16
|
} = props.attributes;
|
|
18
|
-
const isWide = (_wp$customize$Widgets =
|
|
19
|
-
return createElement(BlockEdit,
|
|
17
|
+
const isWide = (_wp$customize$Widgets = wp.customize.Widgets.data.availableWidgets.find(widget => widget.id_base === idBase)?.is_wide) !== null && _wp$customize$Widgets !== void 0 ? _wp$customize$Widgets : false;
|
|
18
|
+
return createElement(BlockEdit, { ...props,
|
|
20
19
|
isWide: isWide
|
|
21
|
-
})
|
|
20
|
+
});
|
|
22
21
|
}, 'withWideWidgetDisplay');
|
|
23
22
|
addFilter('editor.BlockEdit', 'core/customize-widgets/wide-widget-display', withWideWidgetDisplay);
|
|
24
23
|
//# sourceMappingURL=wide-widget-display.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/filters/wide-widget-display.js"],"names":["createHigherOrderComponent","addFilter","wp","window","withWideWidgetDisplay","BlockEdit","props","idBase","attributes","isWide","customize","Widgets","data","availableWidgets","find","widget","id_base","is_wide"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/filters/wide-widget-display.js"],"names":["createHigherOrderComponent","addFilter","wp","window","withWideWidgetDisplay","BlockEdit","props","idBase","attributes","isWide","customize","Widgets","data","availableWidgets","find","widget","id_base","is_wide"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,0BAAT,QAA2C,oBAA3C;AACA,SAASC,SAAT,QAA0B,kBAA1B;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAASC,MAAf;AAEA,MAAMC,qBAAqB,GAAGJ,0BAA0B,CACrDK,SAAF,IAAmBC,KAAF,IAAa;AAAA;;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAaD,KAAK,CAACE,UAAzB;AACA,QAAMC,MAAM,4BACXP,EAAE,CAACQ,SAAH,CAAaC,OAAb,CAAqBC,IAArB,CAA0BC,gBAA1B,CAA2CC,IAA3C,CACGC,MAAF,IAAcA,MAAM,CAACC,OAAP,KAAmBT,MADlC,GAEGU,OAHQ,yEAGG,KAHf;AAKA,SAAO,cAAC,SAAD,OAAgBX,KAAhB;AAAwB,IAAA,MAAM,EAAGG;AAAjC,IAAP;AACA,CATsD,EAUvD,uBAVuD,CAAxD;AAaAR,SAAS,CACR,kBADQ,EAER,4CAFQ,EAGRG,qBAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\nconst { wp } = window;\n\nconst withWideWidgetDisplay = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { idBase } = props.attributes;\n\t\tconst isWide =\n\t\t\twp.customize.Widgets.data.availableWidgets.find(\n\t\t\t\t( widget ) => widget.id_base === idBase\n\t\t\t)?.is_wide ?? false;\n\n\t\treturn <BlockEdit { ...props } isWide={ isWide } />;\n\t},\n\t'withWideWidgetDisplay'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/customize-widgets/wide-widget-display',\n\twithWideWidgetDisplay\n);\n"]}
|
|
@@ -6,4 +6,4 @@ export const {
|
|
|
6
6
|
lock,
|
|
7
7
|
unlock
|
|
8
8
|
} = __dangerousOptInToUnstableAPIsOnlyForCoreModules('I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/customize-widgets');
|
|
9
|
-
//# sourceMappingURL=
|
|
9
|
+
//# sourceMappingURL=lock-unlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/lock-unlock.js"],"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAT,QAAiE,yBAAjE;AAEA,OAAO,MAAM;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZF,gDAAgD,CAC/C,8GAD+C,EAE/C,8BAF+C,CAD1C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/customize-widgets'\n\t);\n"]}
|
|
@@ -9,10 +9,7 @@ import { combineReducers } from '@wordpress/data';
|
|
|
9
9
|
* @param {Object} action
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
function blockInserterPanel() {
|
|
13
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
14
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
15
|
-
|
|
12
|
+
function blockInserterPanel(state = false, action) {
|
|
16
13
|
switch (action.type) {
|
|
17
14
|
case 'SET_IS_INSERTER_OPENED':
|
|
18
15
|
return action.value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/store/reducer.js"],"names":["combineReducers","blockInserterPanel","state","action","type","value"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,kBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/store/reducer.js"],"names":["combineReducers","blockInserterPanel","state","action","type","value"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,kBAAT,CAA6BC,KAAK,GAAG,KAArC,EAA4CC,MAA5C,EAAqD;AACpD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,wBAAL;AACC,aAAOD,MAAM,CAACE,KAAd;AAFF;;AAIA,SAAOH,KAAP;AACA;;AAED,eAAeF,eAAe,CAAE;AAC/BC,EAAAA;AAD+B,CAAF,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer tracking whether the inserter is open.\n *\n * @param {boolean|Object} state\n * @param {Object} action\n */\nfunction blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tblockInserterPanel,\n} );\n"]}
|
package/build-module/utils.js
CHANGED
|
@@ -31,8 +31,7 @@ export function settingIdToWidgetId(settingId) {
|
|
|
31
31
|
* @return {Object} The transformed widget.
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
-
export function blockToWidget(block) {
|
|
35
|
-
let existingWidget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
34
|
+
export function blockToWidget(block, existingWidget = null) {
|
|
36
35
|
let widget;
|
|
37
36
|
const isValidLegacyWidgetBlock = block.name === 'core/legacy-widget' && (block.attributes.id || block.attributes.instance);
|
|
38
37
|
|
|
@@ -52,7 +51,7 @@ export function blockToWidget(block) {
|
|
|
52
51
|
|
|
53
52
|
widget = {
|
|
54
53
|
idBase: block.attributes.idBase,
|
|
55
|
-
instance: { ...
|
|
54
|
+
instance: { ...existingWidget?.instance,
|
|
56
55
|
// Required only for the customizer.
|
|
57
56
|
is_widget_customizer_js_value: true,
|
|
58
57
|
encoded_serialized_instance: encoded,
|
|
@@ -95,13 +94,12 @@ export function blockToWidget(block) {
|
|
|
95
94
|
* @return {WPBlock} The transformed block.
|
|
96
95
|
*/
|
|
97
96
|
|
|
98
|
-
export function widgetToBlock(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
} = _ref;
|
|
97
|
+
export function widgetToBlock({
|
|
98
|
+
id,
|
|
99
|
+
idBase,
|
|
100
|
+
number,
|
|
101
|
+
instance
|
|
102
|
+
}) {
|
|
105
103
|
let block;
|
|
106
104
|
const {
|
|
107
105
|
encoded_serialized_instance: encoded,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/utils.js"],"names":["serialize","parse","createBlock","addWidgetIdToBlock","settingIdToWidgetId","settingId","matches","match","idBase","number","parseInt","blockToWidget","block","existingWidget","widget","isValidLegacyWidgetBlock","name","attributes","id","instance","encoded","hash","raw","rest","is_widget_customizer_js_value","encoded_serialized_instance","instance_hash_key","raw_instance","content","widgetClass","form","rendered","restExistingWidget","widgetToBlock","parsedBlocks","__unstableSkipAutop","length"],"mappings":"AAAA;;AACA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,KAApB,EAA2BC,WAA3B,QAA8C,mBAA9C;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,mBAAT,CAA8BC,SAA9B,EAA0C;AAChD,QAAMC,OAAO,GAAGD,SAAS,CAACE,KAAV,CAAiB,4BAAjB,CAAhB;;AAEA,MAAKD,OAAL,EAAe;AACd,UAAME,MAAM,GAAGF,OAAO,CAAE,CAAF,CAAtB;AACA,UAAMG,MAAM,GAAGC,QAAQ,CAAEJ,OAAO,CAAE,CAAF,CAAT,EAAgB,EAAhB,CAAvB;AAEA,WAAQ,GAAGE,MAAQ,IAAIC,MAAQ,EAA/B;AACA;;AAED,SAAOJ,SAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASM,aAAT,CAAwBC,KAAxB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/utils.js"],"names":["serialize","parse","createBlock","addWidgetIdToBlock","settingIdToWidgetId","settingId","matches","match","idBase","number","parseInt","blockToWidget","block","existingWidget","widget","isValidLegacyWidgetBlock","name","attributes","id","instance","encoded","hash","raw","rest","is_widget_customizer_js_value","encoded_serialized_instance","instance_hash_key","raw_instance","content","widgetClass","form","rendered","restExistingWidget","widgetToBlock","parsedBlocks","__unstableSkipAutop","length"],"mappings":"AAAA;;AACA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,KAApB,EAA2BC,WAA3B,QAA8C,mBAA9C;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,mBAAT,CAA8BC,SAA9B,EAA0C;AAChD,QAAMC,OAAO,GAAGD,SAAS,CAACE,KAAV,CAAiB,4BAAjB,CAAhB;;AAEA,MAAKD,OAAL,EAAe;AACd,UAAME,MAAM,GAAGF,OAAO,CAAE,CAAF,CAAtB;AACA,UAAMG,MAAM,GAAGC,QAAQ,CAAEJ,OAAO,CAAE,CAAF,CAAT,EAAgB,EAAhB,CAAvB;AAEA,WAAQ,GAAGE,MAAQ,IAAIC,MAAQ,EAA/B;AACA;;AAED,SAAOJ,SAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASM,aAAT,CAAwBC,KAAxB,EAA+BC,cAAc,GAAG,IAAhD,EAAuD;AAC7D,MAAIC,MAAJ;AAEA,QAAMC,wBAAwB,GAC7BH,KAAK,CAACI,IAAN,KAAe,oBAAf,KACEJ,KAAK,CAACK,UAAN,CAAiBC,EAAjB,IAAuBN,KAAK,CAACK,UAAN,CAAiBE,QAD1C,CADD;;AAIA,MAAKJ,wBAAL,EAAgC;AAC/B,QAAKH,KAAK,CAACK,UAAN,CAAiBC,EAAtB,EAA2B;AAC1B;AAC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IAAAA,2BAA2B,EAAEL,OADxB;AAELM,IAAAA,iBAAiB,EAAEL,IAFd;AAGLM,IAAAA,YAAY,EAAEL,GAHT;AAIL,OAAGC;AAJE,MAKFJ,QALJ;;AAOA,MAAKX,MAAM,KAAK,OAAhB,EAA0B;AAAA;;AACzB,UAAM0B,YAAY,GAAGjC,KAAK,iBAAEqB,GAAG,CAACM,OAAN,uDAAiB,EAAjB,EAAqB;AAC9CO,MAAAA,mBAAmB,EAAE;AADyB,KAArB,CAA1B;AAGAvB,IAAAA,KAAK,GAAGsB,YAAY,CAACE,MAAb,GACLF,YAAY,CAAE,CAAF,CADP,GAELhC,WAAW,CAAE,gBAAF,EAAoB,EAApB,CAFd;AAGA,GAPD,MAOO,IAAKO,MAAL,EAAc;AACpB;AACAG,IAAAA,KAAK,GAAGV,WAAW,CAAE,oBAAF,EAAwB;AAC1CM,MAAAA,MAD0C;AAE1CW,MAAAA,QAAQ,EAAE;AACTC,QAAAA,OADS;AAETC,QAAAA,IAFS;AAGTC,QAAAA,GAHS;AAIT,WAAGC;AAJM;AAFgC,KAAxB,CAAnB;AASA,GAXM,MAWA;AACN;AACAX,IAAAA,KAAK,GAAGV,WAAW,CAAE,oBAAF,EAAwB;AAC1CgB,MAAAA;AAD0C,KAAxB,CAAnB;AAGA;;AAED,SAAOf,kBAAkB,CAAES,KAAF,EAASM,EAAT,CAAzB;AACA","sourcesContent":["// @ts-check\n/**\n * WordPress dependencies\n */\nimport { serialize, parse, createBlock } from '@wordpress/blocks';\nimport { addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Convert settingId to widgetId.\n *\n * @param {string} settingId The setting id.\n * @return {string} The widget id.\n */\nexport function settingIdToWidgetId( settingId ) {\n\tconst matches = settingId.match( /^widget_(.+)(?:\\[(\\d+)\\])$/ );\n\n\tif ( matches ) {\n\t\tconst idBase = matches[ 1 ];\n\t\tconst number = parseInt( matches[ 2 ], 10 );\n\n\t\treturn `${ idBase }-${ number }`;\n\t}\n\n\treturn settingId;\n}\n\n/**\n * Transform a block to a customizable widget.\n *\n * @param {WPBlock} block The block to be transformed from.\n * @param {Object} existingWidget The widget to be extended from.\n * @return {Object} The transformed widget.\n */\nexport function blockToWidget( block, existingWidget = null ) {\n\tlet widget;\n\n\tconst isValidLegacyWidgetBlock =\n\t\tblock.name === 'core/legacy-widget' &&\n\t\t( block.attributes.id || block.attributes.instance );\n\n\tif ( isValidLegacyWidgetBlock ) {\n\t\tif ( block.attributes.id ) {\n\t\t\t// Widget that does not extend WP_Widget.\n\t\t\twidget = {\n\t\t\t\tid: block.attributes.id,\n\t\t\t};\n\t\t} else {\n\t\t\tconst { encoded, hash, raw, ...rest } = block.attributes.instance;\n\n\t\t\t// Widget that extends WP_Widget.\n\t\t\twidget = {\n\t\t\t\tidBase: block.attributes.idBase,\n\t\t\t\tinstance: {\n\t\t\t\t\t...existingWidget?.instance,\n\t\t\t\t\t// Required only for the customizer.\n\t\t\t\t\tis_widget_customizer_js_value: true,\n\t\t\t\t\tencoded_serialized_instance: encoded,\n\t\t\t\t\tinstance_hash_key: hash,\n\t\t\t\t\traw_instance: raw,\n\t\t\t\t\t...rest,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t} else {\n\t\tconst instance = {\n\t\t\tcontent: serialize( block ),\n\t\t};\n\t\twidget = {\n\t\t\tidBase: 'block',\n\t\t\twidgetClass: 'WP_Widget_Block',\n\t\t\tinstance: {\n\t\t\t\traw_instance: instance,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst { form, rendered, ...restExistingWidget } = existingWidget || {};\n\n\treturn {\n\t\t...restExistingWidget,\n\t\t...widget,\n\t};\n}\n\n/**\n * Transform a widget to a block.\n *\n * @param {Object} widget The widget to be transformed from.\n * @param {string} widget.id The widget id.\n * @param {string} widget.idBase The id base of the widget.\n * @param {number} widget.number The number/index of the widget.\n * @param {Object} widget.instance The instance of the widget.\n * @return {WPBlock} The transformed block.\n */\nexport function widgetToBlock( { id, idBase, number, instance } ) {\n\tlet block;\n\n\tconst {\n\t\tencoded_serialized_instance: encoded,\n\t\tinstance_hash_key: hash,\n\t\traw_instance: raw,\n\t\t...rest\n\t} = instance;\n\n\tif ( idBase === 'block' ) {\n\t\tconst parsedBlocks = parse( raw.content ?? '', {\n\t\t\t__unstableSkipAutop: true,\n\t\t} );\n\t\tblock = parsedBlocks.length\n\t\t\t? parsedBlocks[ 0 ]\n\t\t\t: createBlock( 'core/paragraph', {} );\n\t} else if ( number ) {\n\t\t// Widget that extends WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tidBase,\n\t\t\tinstance: {\n\t\t\t\tencoded,\n\t\t\t\thash,\n\t\t\t\traw,\n\t\t\t\t...rest,\n\t\t\t},\n\t\t} );\n\t} else {\n\t\t// Widget that does not extend WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tid,\n\t\t} );\n\t}\n\n\treturn addWidgetIdToBlock( block, id );\n}\n"]}
|
|
@@ -322,4 +322,29 @@
|
|
|
322
322
|
.customize-widgets-popover *::before,
|
|
323
323
|
.customize-widgets-popover *::after {
|
|
324
324
|
box-sizing: inherit;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
Fixed bloock toolbar overrides. We can't detect each editor instance
|
|
329
|
+
in the styles of the block editor component so we need to override
|
|
330
|
+
the fixed styles here because the breakpoint css does not fire in the
|
|
331
|
+
customizer's left panel.
|
|
332
|
+
*/
|
|
333
|
+
.block-editor-block-contextual-toolbar.is-fixed {
|
|
334
|
+
position: sticky;
|
|
335
|
+
top: 0;
|
|
336
|
+
right: 0;
|
|
337
|
+
z-index: 6;
|
|
338
|
+
width: calc(100% + 2 * 12px);
|
|
339
|
+
overflow-y: hidden;
|
|
340
|
+
border: none;
|
|
341
|
+
border-bottom: 1px solid #e0e0e0;
|
|
342
|
+
border-radius: 0;
|
|
343
|
+
}
|
|
344
|
+
.block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar .components-toolbar-group,
|
|
345
|
+
.block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar .components-toolbar {
|
|
346
|
+
border-left-color: #e0e0e0;
|
|
347
|
+
}
|
|
348
|
+
.block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
|
|
349
|
+
margin-right: -12px;
|
|
325
350
|
}
|
package/build-style/style.css
CHANGED
|
@@ -322,4 +322,29 @@
|
|
|
322
322
|
.customize-widgets-popover *::before,
|
|
323
323
|
.customize-widgets-popover *::after {
|
|
324
324
|
box-sizing: inherit;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
Fixed bloock toolbar overrides. We can't detect each editor instance
|
|
329
|
+
in the styles of the block editor component so we need to override
|
|
330
|
+
the fixed styles here because the breakpoint css does not fire in the
|
|
331
|
+
customizer's left panel.
|
|
332
|
+
*/
|
|
333
|
+
.block-editor-block-contextual-toolbar.is-fixed {
|
|
334
|
+
position: sticky;
|
|
335
|
+
top: 0;
|
|
336
|
+
left: 0;
|
|
337
|
+
z-index: 6;
|
|
338
|
+
width: calc(100% + 2 * 12px);
|
|
339
|
+
overflow-y: hidden;
|
|
340
|
+
border: none;
|
|
341
|
+
border-bottom: 1px solid #e0e0e0;
|
|
342
|
+
border-radius: 0;
|
|
343
|
+
}
|
|
344
|
+
.block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar .components-toolbar-group,
|
|
345
|
+
.block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar .components-toolbar {
|
|
346
|
+
border-right-color: #e0e0e0;
|
|
347
|
+
}
|
|
348
|
+
.block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
|
|
349
|
+
margin-left: -12px;
|
|
325
350
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/customize-widgets",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.12.1",
|
|
4
4
|
"description": "Widgets blocks in Customizer Module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -24,26 +24,26 @@
|
|
|
24
24
|
"react-native": "src/index",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.16.0",
|
|
27
|
-
"@wordpress/block-editor": "^12.
|
|
28
|
-
"@wordpress/block-library": "^8.
|
|
29
|
-
"@wordpress/blocks": "^12.
|
|
30
|
-
"@wordpress/components": "^25.
|
|
31
|
-
"@wordpress/compose": "^6.
|
|
32
|
-
"@wordpress/core-data": "^6.
|
|
33
|
-
"@wordpress/data": "^9.
|
|
34
|
-
"@wordpress/dom": "^3.
|
|
35
|
-
"@wordpress/element": "^5.
|
|
36
|
-
"@wordpress/hooks": "^3.
|
|
37
|
-
"@wordpress/i18n": "^4.
|
|
38
|
-
"@wordpress/icons": "^9.
|
|
39
|
-
"@wordpress/interface": "^5.
|
|
40
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
41
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
42
|
-
"@wordpress/keycodes": "^3.
|
|
43
|
-
"@wordpress/media-utils": "^4.
|
|
44
|
-
"@wordpress/preferences": "^3.
|
|
45
|
-
"@wordpress/private-apis": "^0.
|
|
46
|
-
"@wordpress/widgets": "^3.
|
|
27
|
+
"@wordpress/block-editor": "^12.3.1",
|
|
28
|
+
"@wordpress/block-library": "^8.12.1",
|
|
29
|
+
"@wordpress/blocks": "^12.12.1",
|
|
30
|
+
"@wordpress/components": "^25.1.1",
|
|
31
|
+
"@wordpress/compose": "^6.12.1",
|
|
32
|
+
"@wordpress/core-data": "^6.12.1",
|
|
33
|
+
"@wordpress/data": "^9.5.1",
|
|
34
|
+
"@wordpress/dom": "^3.35.1",
|
|
35
|
+
"@wordpress/element": "^5.12.1",
|
|
36
|
+
"@wordpress/hooks": "^3.35.1",
|
|
37
|
+
"@wordpress/i18n": "^4.35.1",
|
|
38
|
+
"@wordpress/icons": "^9.26.1",
|
|
39
|
+
"@wordpress/interface": "^5.12.1",
|
|
40
|
+
"@wordpress/is-shallow-equal": "^4.35.1",
|
|
41
|
+
"@wordpress/keyboard-shortcuts": "^4.12.1",
|
|
42
|
+
"@wordpress/keycodes": "^3.35.1",
|
|
43
|
+
"@wordpress/media-utils": "^4.26.1",
|
|
44
|
+
"@wordpress/preferences": "^3.12.1",
|
|
45
|
+
"@wordpress/private-apis": "^0.17.1",
|
|
46
|
+
"@wordpress/widgets": "^3.12.1",
|
|
47
47
|
"classnames": "^2.3.1",
|
|
48
48
|
"fast-deep-equal": "^3.1.3"
|
|
49
49
|
},
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "ce5639111c30763dbdf07f40eeb136ea6030ecf1"
|
|
58
58
|
}
|
|
@@ -127,7 +127,7 @@ function KeyboardShortcutsRegister() {
|
|
|
127
127
|
} );
|
|
128
128
|
|
|
129
129
|
registerShortcut( {
|
|
130
|
-
name:
|
|
130
|
+
name: 'core/customize-widgets/transform-heading-to-paragraph',
|
|
131
131
|
category: 'block-library',
|
|
132
132
|
description: __( 'Transform heading to paragraph.' ),
|
|
133
133
|
keyCombination: {
|
|
@@ -9,7 +9,7 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
|
9
9
|
import useSidebarBlockEditor from './use-sidebar-block-editor';
|
|
10
10
|
import useBlocksFocusControl from '../focus-control/use-blocks-focus-control';
|
|
11
11
|
|
|
12
|
-
import { unlock } from '../../
|
|
12
|
+
import { unlock } from '../../lock-unlock';
|
|
13
13
|
|
|
14
14
|
const { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );
|
|
15
15
|
|