@wordpress/edit-widgets 6.9.0 → 6.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/blocks/widget-area/edit/index.js.map +1 -1
- package/build/components/header/document-tools/index.js +1 -1
- package/build/components/header/document-tools/index.js.map +1 -1
- package/build/components/layout/index.js +15 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/interface.js +3 -12
- package/build/components/layout/interface.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +0 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/index.js +7 -1
- package/build/index.js.map +1 -1
- package/build/store/actions.js +2 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js.map +1 -1
- package/build-module/blocks/widget-area/edit/index.js.map +1 -1
- package/build-module/components/header/document-tools/index.js +2 -4
- package/build-module/components/header/document-tools/index.js.map +1 -1
- package/build-module/components/header/index.js +1 -3
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -2
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -3
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/layout/index.js +16 -10
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/interface.js +4 -14
- package/build-module/components/layout/interface.js.map +1 -1
- package/build-module/components/more-menu/index.js +1 -3
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/notices/index.js +1 -3
- package/build-module/components/notices/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +2 -3
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +1 -2
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +1 -3
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/widget-areas.js +1 -2
- package/build-module/components/sidebar/widget-areas.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +1 -3
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-content/index.js +1 -2
- package/build-module/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-provider/index.js +1 -2
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build-module/filters/move-to-widget-area.js +1 -3
- package/build-module/filters/move-to-widget-area.js.map +1 -1
- package/build-module/index.js +7 -1
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +2 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js.map +1 -1
- package/build-style/style-rtl.css +1 -35
- package/build-style/style.css +1 -35
- package/package.json +31 -29
- package/src/components/header/document-tools/index.js +1 -1
- package/src/components/layout/index.js +17 -8
- package/src/components/layout/interface.js +0 -15
- package/src/components/secondary-sidebar/inserter-sidebar.js +1 -1
- package/src/components/sidebar/index.js +0 -1
- package/src/index.js +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_data","_coreData","_components","_innerBlocks","_interopRequireDefault","_store","_useIsDraggingWithin","_jsxRuntime","WidgetAreaEdit","clientId","className","attributes","id","name","isOpen","useSelect","select","editWidgetsStore","getIsWidgetAreaOpen","setIsWidgetAreaOpen","useDispatch","wrapper","useRef","setOpen","useCallback","openState","isDragging","useIsDragging","isDraggingWithin","useIsDraggingWithin","openedWhileDragging","setOpenedWhileDragging","useState","useEffect","jsx","Panel","ref","children","PanelBody","title","opened","onToggle","scrollAfterOpen","__unstableDisclosureContent","visible","EntityProvider","kind","type","default","elementRef","setIsDragging","ownerDocument","current","handleDragStart","handleDragEnd","addEventListener","removeEventListener"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState, useCallback, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { EntityProvider } from '@wordpress/core-data';\nimport {\n\t__unstableDisclosureContent as DisclosureContent,\n\tPanel,\n\tPanelBody,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreaInnerBlocks from './inner-blocks';\nimport { store as editWidgetsStore } from '../../../store';\nimport useIsDraggingWithin from './use-is-dragging-within';\n\n/** @typedef {import('@wordpress/element').RefObject} RefObject */\n\nexport default function WidgetAreaEdit( {\n\tclientId,\n\tclassName,\n\tattributes: { id, name },\n} ) {\n\tconst isOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen( clientId ),\n\t\t[ clientId ]\n\t);\n\tconst { setIsWidgetAreaOpen } = useDispatch( editWidgetsStore );\n\n\tconst wrapper = useRef();\n\tconst setOpen = useCallback(\n\t\t( openState ) => setIsWidgetAreaOpen( clientId, openState ),\n\t\t[ clientId ]\n\t);\n\tconst isDragging = useIsDragging( wrapper );\n\tconst isDraggingWithin = useIsDraggingWithin( wrapper );\n\n\tconst [ openedWhileDragging, setOpenedWhileDragging ] = useState( false );\n\tuseEffect( () => {\n\t\tif ( ! isDragging ) {\n\t\t\tsetOpenedWhileDragging( false );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isDraggingWithin && ! isOpen ) {\n\t\t\tsetOpen( true );\n\t\t\tsetOpenedWhileDragging( true );\n\t\t} else if ( ! isDraggingWithin && isOpen && openedWhileDragging ) {\n\t\t\tsetOpen( false );\n\t\t}\n\t}, [ isOpen, isDragging, isDraggingWithin, openedWhileDragging ] );\n\n\treturn (\n\t\t<Panel className={ className } ref={ wrapper }>\n\t\t\t<PanelBody\n\t\t\t\ttitle={ name }\n\t\t\t\topened={ isOpen }\n\t\t\t\tonToggle={ () => {\n\t\t\t\t\tsetIsWidgetAreaOpen( clientId, ! isOpen );\n\t\t\t\t} }\n\t\t\t\tscrollAfterOpen={ ! isDragging }\n\t\t\t>\n\t\t\t\t{ ( { opened } ) => (\n\t\t\t\t\t// This is required to ensure LegacyWidget blocks are not\n\t\t\t\t\t// unmounted when the panel is collapsed. Unmounting legacy\n\t\t\t\t\t// widgets may have unintended consequences (e.g. TinyMCE\n\t\t\t\t\t// not being properly reinitialized)\n\t\t\t\t\t<DisclosureContent\n\t\t\t\t\t\tclassName=\"wp-block-widget-area__panel-body-content\"\n\t\t\t\t\t\tvisible={ opened }\n\t\t\t\t\t>\n\t\t\t\t\t\t<EntityProvider\n\t\t\t\t\t\t\tkind=\"root\"\n\t\t\t\t\t\t\ttype=\"postType\"\n\t\t\t\t\t\t\tid={ `widget-area-${ id }` }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<WidgetAreaInnerBlocks id={ id } />\n\t\t\t\t\t\t</EntityProvider>\n\t\t\t\t\t</DisclosureContent>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t</Panel>\n\t);\n}\n\n/**\n * A React hook to determine if dragging is active.\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the entire document.\n */\nconst useIsDragging = ( elementRef ) => {\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart() {\n\t\t\tsetIsDragging( true );\n\t\t}\n\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDragging( false );\n\t\t}\n\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handle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IAEA,IAAKH,gBAAgB,IAAI,CAAEd,MAAM,EAAG;MACnCS,OAAO,CAAE,IAAK,CAAC;MACfQ,sBAAsB,CAAE,IAAK,CAAC;IAC/B,CAAC,MAAM,IAAK,CAAEH,gBAAgB,IAAId,MAAM,IAAIgB,mBAAmB,EAAG;MACjEP,OAAO,CAAE,KAAM,CAAC;IACjB;EACD,CAAC,EAAE,CAAET,MAAM,EAAEY,UAAU,EAAEE,gBAAgB,EAAEE,mBAAmB,CAAG,CAAC;EAElE,oBACC,IAAAvB,WAAA,CAAA2B,GAAA,EAAChC,WAAA,CAAAiC,KAAK;IAACzB,SAAS,EAAGA,SAAW;IAAC0B,GAAG,EAAGf,OAAS;IAAAgB,QAAA,eAC7C,IAAA9B,WAAA,CAAA2B,GAAA,EAAChC,WAAA,CAAAoC,SAAS;MACTC,KAAK,EAAG1B,IAAM;MACd2B,MAAM,EAAG1B,MAAQ;MACjB2B,QAAQ,EAAGA,CAAA,KAAM;QAChBtB,mBAAmB,CAAEV,QAAQ,EAAE,CAAEK,MAAO,CAAC;MAC1C,CAAG;MACH4B,eAAe,EAAG,CAAEhB,UAAY;MAAAW,QAAA,EAE9BA,CAAE;QAAEG;MAAO,CAAC;MAAA;MACb;MACA;MACA;MACA;MACA,IAAAjC,WAAA,CAAA2B,GAAA,EAAChC,WAAA,CAAAyC,2BAAiB;QACjBjC,SAAS,EAAC,0CAA0C;QACpDkC,OAAO,EAAGJ,MAAQ;QAAAH,QAAA,eAElB,IAAA9B,WAAA,CAAA2B,GAAA,EAACjC,SAAA,CAAA4C,cAAc;UACdC,IAAI,EAAC,MAAM;UACXC,IAAI,EAAC,UAAU;UACfnC,EAAE,
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_coreData","_components","_innerBlocks","_interopRequireDefault","_store","_useIsDraggingWithin","_jsxRuntime","WidgetAreaEdit","clientId","className","attributes","id","name","isOpen","useSelect","select","editWidgetsStore","getIsWidgetAreaOpen","setIsWidgetAreaOpen","useDispatch","wrapper","useRef","setOpen","useCallback","openState","isDragging","useIsDragging","isDraggingWithin","useIsDraggingWithin","openedWhileDragging","setOpenedWhileDragging","useState","useEffect","jsx","Panel","ref","children","PanelBody","title","opened","onToggle","scrollAfterOpen","__unstableDisclosureContent","visible","EntityProvider","kind","type","default","elementRef","setIsDragging","ownerDocument","current","handleDragStart","handleDragEnd","addEventListener","removeEventListener"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState, useCallback, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { EntityProvider } from '@wordpress/core-data';\nimport {\n\t__unstableDisclosureContent as DisclosureContent,\n\tPanel,\n\tPanelBody,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreaInnerBlocks from './inner-blocks';\nimport { store as editWidgetsStore } from '../../../store';\nimport useIsDraggingWithin from './use-is-dragging-within';\n\n/** @typedef {import('@wordpress/element').RefObject} RefObject */\n\nexport default function WidgetAreaEdit( {\n\tclientId,\n\tclassName,\n\tattributes: { id, name },\n} ) {\n\tconst isOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen( clientId ),\n\t\t[ clientId ]\n\t);\n\tconst { setIsWidgetAreaOpen } = useDispatch( editWidgetsStore );\n\n\tconst wrapper = useRef();\n\tconst setOpen = useCallback(\n\t\t( openState ) => setIsWidgetAreaOpen( clientId, openState ),\n\t\t[ clientId ]\n\t);\n\tconst isDragging = useIsDragging( wrapper );\n\tconst isDraggingWithin = useIsDraggingWithin( wrapper );\n\n\tconst [ openedWhileDragging, setOpenedWhileDragging ] = useState( false );\n\tuseEffect( () => {\n\t\tif ( ! isDragging ) {\n\t\t\tsetOpenedWhileDragging( false );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isDraggingWithin && ! isOpen ) {\n\t\t\tsetOpen( true );\n\t\t\tsetOpenedWhileDragging( true );\n\t\t} else if ( ! isDraggingWithin && isOpen && openedWhileDragging ) {\n\t\t\tsetOpen( false );\n\t\t}\n\t}, [ isOpen, isDragging, isDraggingWithin, openedWhileDragging ] );\n\n\treturn (\n\t\t<Panel className={ className } ref={ wrapper }>\n\t\t\t<PanelBody\n\t\t\t\ttitle={ name }\n\t\t\t\topened={ isOpen }\n\t\t\t\tonToggle={ () => {\n\t\t\t\t\tsetIsWidgetAreaOpen( clientId, ! isOpen );\n\t\t\t\t} }\n\t\t\t\tscrollAfterOpen={ ! isDragging }\n\t\t\t>\n\t\t\t\t{ ( { opened } ) => (\n\t\t\t\t\t// This is required to ensure LegacyWidget blocks are not\n\t\t\t\t\t// unmounted when the panel is collapsed. Unmounting legacy\n\t\t\t\t\t// widgets may have unintended consequences (e.g. TinyMCE\n\t\t\t\t\t// not being properly reinitialized)\n\t\t\t\t\t<DisclosureContent\n\t\t\t\t\t\tclassName=\"wp-block-widget-area__panel-body-content\"\n\t\t\t\t\t\tvisible={ opened }\n\t\t\t\t\t>\n\t\t\t\t\t\t<EntityProvider\n\t\t\t\t\t\t\tkind=\"root\"\n\t\t\t\t\t\t\ttype=\"postType\"\n\t\t\t\t\t\t\tid={ `widget-area-${ id }` }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<WidgetAreaInnerBlocks id={ id } />\n\t\t\t\t\t\t</EntityProvider>\n\t\t\t\t\t</DisclosureContent>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t</Panel>\n\t);\n}\n\n/**\n * A React hook to determine if dragging is active.\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the entire document.\n */\nconst useIsDragging = ( elementRef ) => {\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart() {\n\t\t\tsetIsDragging( true );\n\t\t}\n\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDragging( false );\n\t\t}\n\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t};\n\t}, [] );\n\n\treturn isDragging;\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AASA,IAAAI,YAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,oBAAA,GAAAF,sBAAA,CAAAL,OAAA;AAA2D,IAAAQ,WAAA,GAAAR,OAAA;AAjB3D;AACA;AACA;;AAUA;AACA;AACA;;AAKA,kEAEe,SAASS,cAAcA,CAAE;EACvCC,QAAQ;EACRC,SAAS;EACTC,UAAU,EAAE;IAAEC,EAAE;IAAEC;EAAK;AACxB,CAAC,EAAG;EACH,MAAMC,MAAM,GAAG,IAAAC,eAAS,EACrBC,MAAM,IACPA,MAAM,CAAEC,YAAiB,CAAC,CAACC,mBAAmB,CAAET,QAAS,CAAC,EAC3D,CAAEA,QAAQ,CACX,CAAC;EACD,MAAM;IAAEU;EAAoB,CAAC,GAAG,IAAAC,iBAAW,EAAEH,YAAiB,CAAC;EAE/D,MAAMI,OAAO,GAAG,IAAAC,eAAM,EAAC,CAAC;EACxB,MAAMC,OAAO,GAAG,IAAAC,oBAAW,EACxBC,SAAS,IAAMN,mBAAmB,CAAEV,QAAQ,EAAEgB,SAAU,CAAC,EAC3D,CAAEhB,QAAQ,CACX,CAAC;EACD,MAAMiB,UAAU,GAAGC,aAAa,CAAEN,OAAQ,CAAC;EAC3C,MAAMO,gBAAgB,GAAG,IAAAC,4BAAmB,EAAER,OAAQ,CAAC;EAEvD,MAAM,CAAES,mBAAm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AAK;UAAAyB,QAAA,eAE5B,IAAA9B,WAAA,CAAA2B,GAAA,EAAC/B,YAAA,CAAA6C,OAAqB;YAACpC,EAAE,EAAGA;UAAI,CAAE;QAAC,CACpB;MAAC,CACC;IACnB,CACS;EAAC,CACN,CAAC;AAEV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMe,aAAa,GAAKsB,UAAU,IAAM;EACvC,MAAM,CAAEvB,UAAU,EAAEwB,aAAa,CAAE,GAAG,IAAAlB,iBAAQ,EAAE,KAAM,CAAC;EAEvD,IAAAC,kBAAS,EAAE,MAAM;IAChB,MAAM;MAAEkB;IAAc,CAAC,GAAGF,UAAU,CAACG,OAAO;IAE5C,SAASC,eAAeA,CAAA,EAAG;MAC1BH,aAAa,CAAE,IAAK,CAAC;IACtB;IAEA,SAASI,aAAaA,CAAA,EAAG;MACxBJ,aAAa,CAAE,KAAM,CAAC;IACvB;IAEAC,aAAa,CAACI,gBAAgB,CAAE,WAAW,EAAEF,eAAgB,CAAC;IAC9DF,aAAa,CAACI,gBAAgB,CAAE,SAAS,EAAED,aAAc,CAAC;IAE1D,OAAO,MAAM;MACZH,aAAa,CAACK,mBAAmB,CAAE,WAAW,EAAEH,eAAgB,CAAC;MACjEF,aAAa,CAACK,mBAAmB,CAAE,SAAS,EAAEF,aAAc,CAAC;IAC9D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,OAAO5B,UAAU;AAClB,CAAC","ignoreList":[]}
|
|
@@ -69,7 +69,7 @@ function DocumentTools() {
|
|
|
69
69
|
icon: _icons.plus
|
|
70
70
|
/* translators: button label text should, if possible, be under 16
|
|
71
71
|
characters. */,
|
|
72
|
-
label: (0, _i18n._x)('
|
|
72
|
+
label: (0, _i18n._x)('Block Inserter', 'Generic label for block inserter button'),
|
|
73
73
|
size: "compact"
|
|
74
74
|
}), isMediumViewport && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
75
75
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarItem, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_i18n","_components","_blockEditor","_icons","_element","_compose","_undo","_interopRequireDefault","_redo","_store","_lockUnlock","_jsxRuntime","DocumentTools","isMediumViewport","useViewportMatch","isInserterOpen","isListViewOpen","inserterSidebarToggleRef","listViewToggleRef","useSelect","select","isInserterOpened","getInserterSidebarToggleRef","isListViewOpened","getListViewToggleRef","unlock","editWidgetsStore","setIsInserterOpened","setIsListViewOpened","useDispatch","toggleListView","useCallback","toggleInserterSidebar","jsxs","NavigableToolbar","className","__","variant","children","jsx","ToolbarItem","ref","as","Button","isPressed","onMouseDown","event","preventDefault","onClick","icon","plus","label","_x","size","Fragment","UndoButton","RedoButton","listView","_default","exports","default"],"sources":["@wordpress/edit-widgets/src/components/header/document-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { NavigableToolbar } from '@wordpress/block-editor';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport UndoButton from '../undo-redo/undo';\nimport RedoButton from '../undo-redo/redo';\nimport { store as editWidgetsStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nfunction DocumentTools() {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\n\tconst {\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tinserterSidebarToggleRef,\n\t\tlistViewToggleRef,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisInserterOpened,\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tisListViewOpened,\n\t\t\tgetListViewToggleRef,\n\t\t} = unlock( select( editWidgetsStore ) );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst toggleInserterSidebar = useCallback(\n\t\t() => setIsInserterOpened( ! isInserterOpen ),\n\t\t[ setIsInserterOpened, isInserterOpen ]\n\t);\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<ToolbarItem\n\t\t\t\tref={ inserterSidebarToggleRef }\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t} }\n\t\t\t\tonClick={ toggleInserterSidebar }\n\t\t\t\ticon={ plus }\n\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\tlabel={ _x(\n\t\t\t\t\t'
|
|
1
|
+
{"version":3,"names":["_data","require","_i18n","_components","_blockEditor","_icons","_element","_compose","_undo","_interopRequireDefault","_redo","_store","_lockUnlock","_jsxRuntime","DocumentTools","isMediumViewport","useViewportMatch","isInserterOpen","isListViewOpen","inserterSidebarToggleRef","listViewToggleRef","useSelect","select","isInserterOpened","getInserterSidebarToggleRef","isListViewOpened","getListViewToggleRef","unlock","editWidgetsStore","setIsInserterOpened","setIsListViewOpened","useDispatch","toggleListView","useCallback","toggleInserterSidebar","jsxs","NavigableToolbar","className","__","variant","children","jsx","ToolbarItem","ref","as","Button","isPressed","onMouseDown","event","preventDefault","onClick","icon","plus","label","_x","size","Fragment","UndoButton","RedoButton","listView","_default","exports","default"],"sources":["@wordpress/edit-widgets/src/components/header/document-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { NavigableToolbar } from '@wordpress/block-editor';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport UndoButton from '../undo-redo/undo';\nimport RedoButton from '../undo-redo/redo';\nimport { store as editWidgetsStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nfunction DocumentTools() {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\n\tconst {\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tinserterSidebarToggleRef,\n\t\tlistViewToggleRef,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisInserterOpened,\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tisListViewOpened,\n\t\t\tgetListViewToggleRef,\n\t\t} = unlock( select( editWidgetsStore ) );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst toggleInserterSidebar = useCallback(\n\t\t() => setIsInserterOpened( ! isInserterOpen ),\n\t\t[ setIsInserterOpened, isInserterOpen ]\n\t);\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<ToolbarItem\n\t\t\t\tref={ inserterSidebarToggleRef }\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t} }\n\t\t\t\tonClick={ toggleInserterSidebar }\n\t\t\t\ticon={ plus }\n\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\tlabel={ _x(\n\t\t\t\t\t'Block Inserter',\n\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t) }\n\t\t\t\tsize=\"compact\"\n\t\t\t/>\n\t\t\t{ isMediumViewport && (\n\t\t\t\t<>\n\t\t\t\t\t<ToolbarItem as={ UndoButton } />\n\t\t\t\t\t<ToolbarItem as={ RedoButton } />\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\tref={ listViewToggleRef }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA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G,EAAGvB,iBAAmB;QACzBmC,IAAI,EAAC;MAAS,CACd,CAAC;IAAA,CACD,CACF;EAAA,CACgB,CAAC;AAErB;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEchD,aAAa","ignoreList":[]}
|
|
@@ -9,6 +9,7 @@ var _i18n = require("@wordpress/i18n");
|
|
|
9
9
|
var _data = require("@wordpress/data");
|
|
10
10
|
var _plugins = require("@wordpress/plugins");
|
|
11
11
|
var _notices = require("@wordpress/notices");
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
12
13
|
var _errorBoundary = _interopRequireDefault(require("../error-boundary"));
|
|
13
14
|
var _widgetAreasBlockEditorProvider = _interopRequireDefault(require("../widget-areas-block-editor-provider"));
|
|
14
15
|
var _sidebar = _interopRequireDefault(require("../sidebar"));
|
|
@@ -31,17 +32,23 @@ function Layout({
|
|
|
31
32
|
createErrorNotice
|
|
32
33
|
} = (0, _data.useDispatch)(_notices.store);
|
|
33
34
|
function onPluginAreaError(name) {
|
|
34
|
-
createErrorNotice((0, _i18n.sprintf)(
|
|
35
|
+
createErrorNotice((0, _i18n.sprintf)(/* translators: %s: plugin name */
|
|
35
36
|
(0, _i18n.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name));
|
|
36
37
|
}
|
|
38
|
+
const navigateRegionsProps = (0, _components.__unstableUseNavigateRegions)();
|
|
37
39
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_errorBoundary.default, {
|
|
38
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
41
|
+
className: navigateRegionsProps.className,
|
|
42
|
+
...navigateRegionsProps,
|
|
43
|
+
ref: navigateRegionsProps.ref,
|
|
44
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_widgetAreasBlockEditorProvider.default, {
|
|
45
|
+
blockEditorSettings: blockEditorSettings,
|
|
46
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_interface.default, {
|
|
47
|
+
blockEditorSettings: blockEditorSettings
|
|
48
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebar.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_plugins.PluginArea, {
|
|
49
|
+
onError: onPluginAreaError
|
|
50
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_unsavedChangesWarning.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_welcomeGuide.default, {})]
|
|
51
|
+
})
|
|
45
52
|
})
|
|
46
53
|
});
|
|
47
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_data","_plugins","_notices","_errorBoundary","_interopRequireDefault","_widgetAreasBlockEditorProvider","_sidebar","_interface","_unsavedChangesWarning","_welcomeGuide","_jsxRuntime","Layout","blockEditorSettings","createErrorNotice","useDispatch","noticesStore","onPluginAreaError","name","sprintf","__","jsx","default","children","jsxs","PluginArea","onError","_default","exports"],"sources":["@wordpress/edit-widgets/src/components/layout/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { PluginArea } from '@wordpress/plugins';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport ErrorBoundary from '../error-boundary';\nimport WidgetAreasBlockEditorProvider from '../widget-areas-block-editor-provider';\nimport Sidebar from '../sidebar';\nimport Interface from './interface';\nimport UnsavedChangesWarning from './unsaved-changes-warning';\nimport WelcomeGuide from '../welcome-guide';\n\nfunction Layout( { blockEditorSettings } ) {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<ErrorBoundary>\n\t\t\t<WidgetAreasBlockEditorProvider\n\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t>\n\t\t\t\t<Interface blockEditorSettings={ blockEditorSettings } />\n\t\t\t\t<Sidebar />\n\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t<WelcomeGuide />\n\t\t\t</WidgetAreasBlockEditorProvider>\n\t\t</ErrorBoundary>\n\t);\n}\n\nexport default Layout;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;
|
|
1
|
+
{"version":3,"names":["_i18n","require","_data","_plugins","_notices","_components","_errorBoundary","_interopRequireDefault","_widgetAreasBlockEditorProvider","_sidebar","_interface","_unsavedChangesWarning","_welcomeGuide","_jsxRuntime","Layout","blockEditorSettings","createErrorNotice","useDispatch","noticesStore","onPluginAreaError","name","sprintf","__","navigateRegionsProps","useNavigateRegions","jsx","default","children","className","ref","jsxs","PluginArea","onError","_default","exports"],"sources":["@wordpress/edit-widgets/src/components/layout/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { PluginArea } from '@wordpress/plugins';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { __unstableUseNavigateRegions as useNavigateRegions } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ErrorBoundary from '../error-boundary';\nimport WidgetAreasBlockEditorProvider from '../widget-areas-block-editor-provider';\nimport Sidebar from '../sidebar';\nimport Interface from './interface';\nimport UnsavedChangesWarning from './unsaved-changes-warning';\nimport WelcomeGuide from '../welcome-guide';\n\nfunction Layout( { blockEditorSettings } ) {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\tconst navigateRegionsProps = useNavigateRegions();\n\n\treturn (\n\t\t<ErrorBoundary>\n\t\t\t<div\n\t\t\t\tclassName={ navigateRegionsProps.className }\n\t\t\t\t{ ...navigateRegionsProps }\n\t\t\t\tref={ navigateRegionsProps.ref }\n\t\t\t>\n\t\t\t\t<WidgetAreasBlockEditorProvider\n\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t>\n\t\t\t\t\t<Interface blockEditorSettings={ blockEditorSettings } />\n\t\t\t\t\t<Sidebar />\n\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t\t<WelcomeGuide />\n\t\t\t\t</WidgetAreasBlockEditorProvider>\n\t\t\t</div>\n\t\t</ErrorBoundary>\n\t);\n}\n\nexport default Layout;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAKA,IAAAK,cAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,+BAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA,IAAAQ,QAAA,GAAAF,sBAAA,CAAAN,OAAA;AACA,IAAAS,UAAA,GAAAH,sBAAA,CAAAN,OAAA;AACA,IAAAU,sBAAA,GAAAJ,sBAAA,CAAAN,OAAA;AACA,IAAAW,aAAA,GAAAL,sBAAA,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AAC,OAAA,CAAAR,OAAA,GAEcZ,MAAM","ignoreList":[]}
|
|
@@ -11,7 +11,6 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
var _data = require("@wordpress/data");
|
|
12
12
|
var _interface = require("@wordpress/interface");
|
|
13
13
|
var _i18n = require("@wordpress/i18n");
|
|
14
|
-
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
15
14
|
var _preferences = require("@wordpress/preferences");
|
|
16
15
|
var _header = _interopRequireDefault(require("../header"));
|
|
17
16
|
var _widgetAreasBlockEditorContent = _interopRequireDefault(require("../widget-areas-block-editor-content"));
|
|
@@ -50,16 +49,12 @@ function Interface({
|
|
|
50
49
|
hasBlockBreadCrumbsEnabled,
|
|
51
50
|
hasSidebarEnabled,
|
|
52
51
|
isInserterOpened,
|
|
53
|
-
isListViewOpened
|
|
54
|
-
previousShortcut,
|
|
55
|
-
nextShortcut
|
|
52
|
+
isListViewOpened
|
|
56
53
|
} = (0, _data.useSelect)(select => ({
|
|
57
54
|
hasSidebarEnabled: !!select(_interface.store).getActiveComplementaryArea(_store.store.name),
|
|
58
55
|
isInserterOpened: !!select(_store.store).isInserterOpened(),
|
|
59
56
|
isListViewOpened: !!select(_store.store).isListViewOpened(),
|
|
60
|
-
hasBlockBreadCrumbsEnabled: !!select(_preferences.store).get('core/edit-widgets', 'showBlockBreadcrumbs')
|
|
61
|
-
previousShortcut: select(_keyboardShortcuts.store).getAllShortcutKeyCombinations('core/edit-widgets/previous-region'),
|
|
62
|
-
nextShortcut: select(_keyboardShortcuts.store).getAllShortcutKeyCombinations('core/edit-widgets/next-region')
|
|
57
|
+
hasBlockBreadCrumbsEnabled: !!select(_preferences.store).get('core/edit-widgets', 'showBlockBreadcrumbs')
|
|
63
58
|
}), []);
|
|
64
59
|
|
|
65
60
|
// Inserter and Sidebars are mutually exclusive
|
|
@@ -96,11 +91,7 @@ function Interface({
|
|
|
96
91
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockBreadcrumb, {
|
|
97
92
|
rootLabelText: (0, _i18n.__)('Widgets')
|
|
98
93
|
})
|
|
99
|
-
})
|
|
100
|
-
shortcuts: {
|
|
101
|
-
previous: previousShortcut,
|
|
102
|
-
next: nextShortcut
|
|
103
|
-
}
|
|
94
|
+
})
|
|
104
95
|
});
|
|
105
96
|
}
|
|
106
97
|
var _default = exports.default = Interface;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_blockEditor","_element","_data","_interface","_i18n","
|
|
1
|
+
{"version":3,"names":["_compose","require","_blockEditor","_element","_data","_interface","_i18n","_preferences","_header","_interopRequireDefault","_widgetAreasBlockEditorContent","_store","_secondarySidebar","_jsxRuntime","interfaceLabels","header","__","body","sidebar","footer","Interface","blockEditorSettings","isMobileViewport","useViewportMatch","isHugeViewport","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","useDispatch","editWidgetsStore","hasBlockBreadCrumbsEnabled","hasSidebarEnabled","isInserterOpened","isListViewOpened","useSelect","select","interfaceStore","getActiveComplementaryArea","name","preferencesStore","get","useEffect","secondarySidebarLabel","hasSecondarySidebar","jsx","InterfaceSkeleton","labels","secondarySidebar","default","ComplementaryArea","Slot","scope","content","Fragment","children","className","BlockBreadcrumb","rootLabelText","_default","exports"],"sources":["@wordpress/edit-widgets/src/components/layout/interface.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockBreadcrumb } from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Header from '../header';\nimport WidgetAreasBlockEditorContent from '../widget-areas-block-editor-content';\nimport { store as editWidgetsStore } from '../../store';\nimport SecondarySidebar from '../secondary-sidebar';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the widgets screen top bar landmark region. */\n\theader: __( 'Widgets top bar' ),\n\t/* translators: accessibility text for the widgets screen content landmark region. */\n\tbody: __( 'Widgets and blocks' ),\n\t/* translators: accessibility text for the widgets screen settings landmark region. */\n\tsidebar: __( 'Widgets settings' ),\n\t/* translators: accessibility text for the widgets screen footer landmark region. */\n\tfooter: __( 'Widgets footer' ),\n};\n\nfunction Interface( { blockEditorSettings } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst {\n\t\thasBlockBreadCrumbsEnabled,\n\t\thasSidebarEnabled,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\thasSidebarEnabled: !! select(\n\t\t\t\tinterfaceStore\n\t\t\t).getActiveComplementaryArea( editWidgetsStore.name ),\n\t\t\tisInserterOpened: !! select( editWidgetsStore ).isInserterOpened(),\n\t\t\tisListViewOpened: !! select( editWidgetsStore ).isListViewOpened(),\n\t\t\thasBlockBreadCrumbsEnabled: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t} ),\n\t\t[]\n\t);\n\n\t// Inserter and Sidebars are mutually exclusive\n\tuseEffect( () => {\n\t\tif ( hasSidebarEnabled && ! isHugeViewport ) {\n\t\t\tsetIsInserterOpened( false );\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}, [ hasSidebarEnabled, isHugeViewport ] );\n\n\tuseEffect( () => {\n\t\tif ( ( isInserterOpened || isListViewOpened ) && ! isHugeViewport ) {\n\t\t\tcloseGeneralSidebar();\n\t\t}\n\t}, [ isInserterOpened, isListViewOpened, isHugeViewport ] );\n\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\n\tconst hasSecondarySidebar = isListViewOpened || isInserterOpened;\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tlabels={ {\n\t\t\t\t...interfaceLabels,\n\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t} }\n\t\t\theader={ <Header /> }\n\t\t\tsecondarySidebar={ hasSecondarySidebar && <SecondarySidebar /> }\n\t\t\tsidebar={ <ComplementaryArea.Slot scope=\"core/edit-widgets\" /> }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t<WidgetAreasBlockEditorContent\n\t\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\thasBlockBreadCrumbsEnabled &&\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<div className=\"edit-widgets-layout__footer\">\n\t\t\t\t\t\t<BlockBreadcrumb rootLabelText={ __( 'Widgets' ) } />\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t}\n\t\t/>\n\t);\n}\n\nexport default Interface;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,OAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,8BAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,iBAAA,GAAAH,sBAAA,CAAAR,OAAA;AAAoD,IAAAY,WAAA,GAAAZ,OAAA;AArBpD;AACA;AACA;;AAaA;AACA;AACA;;AAMA,MAAMa,eAAe,GAAG;E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AD,QAAA,eAC3C,IAAAzC,WAAA,CAAA+B,GAAA,EAAC1C,YAAA,CAAAsD,eAAe;QAACC,aAAa,EAAG,IAAAzC,QAAE,EAAE,SAAU;MAAG,CAAE;IAAC,CACjD;EAEN,CACD,CAAC;AAEJ;AAAC,IAAA0C,QAAA,GAAAC,OAAA,CAAAX,OAAA,GAEc5B,SAAS","ignoreList":[]}
|
|
@@ -51,7 +51,7 @@ function InserterSidebar() {
|
|
|
51
51
|
__next40pxDefaultSize: true,
|
|
52
52
|
icon: _icons.close,
|
|
53
53
|
onClick: closeInserter,
|
|
54
|
-
label: (0, _i18n.__)('Close
|
|
54
|
+
label: (0, _i18n.__)('Close Block Inserter')
|
|
55
55
|
})
|
|
56
56
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
57
57
|
className: "edit-widgets-layout__inserter-panel-content",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_icons","_blockEditor","_compose","_element","_data","_i18n","_useWidgetLibraryInsertionPoint","_interopRequireDefault","_store","_jsxRuntime","InserterSidebar","isMobileViewport","useViewportMatch","rootClientId","insertionIndex","useWidgetLibraryInsertionPoint","setIsInserterOpened","useDispatch","editWidgetsStore","closeInserter","useCallback","TagName","VisuallyHidden","inserterDialogRef","inserterDialogProps","useDialog","onClose","focusOnMount","libraryRef","useRef","jsxs","ref","className","children","jsx","Button","__next40pxDefaultSize","icon","close","onClick","label","__","__experimentalLibrary","showInserterHelpPanel","shouldFocusBlock","__experimentalInsertionIndex"],"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/inserter-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { close } from '@wordpress/icons';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useWidgetLibraryInsertionPoint from '../../hooks/use-widget-library-insertion-point';\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { rootClientId, insertionIndex } = useWidgetLibraryInsertionPoint();\n\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst closeInserter = useCallback( () => {\n\t\treturn setIsInserterOpened( false );\n\t}, [ setIsInserterOpened ] );\n\n\tconst TagName = ! isMobileViewport ? VisuallyHidden : 'div';\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: closeInserter,\n\t\tfocusOnMount: true,\n\t} );\n\n\tconst libraryRef = useRef();\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"edit-widgets-layout__inserter-panel\"\n\t\t>\n\t\t\t<TagName className=\"edit-widgets-layout__inserter-panel-header\">\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tonClick={ closeInserter }\n\t\t\t\t\tlabel={ __( 'Close
|
|
1
|
+
{"version":3,"names":["_components","require","_icons","_blockEditor","_compose","_element","_data","_i18n","_useWidgetLibraryInsertionPoint","_interopRequireDefault","_store","_jsxRuntime","InserterSidebar","isMobileViewport","useViewportMatch","rootClientId","insertionIndex","useWidgetLibraryInsertionPoint","setIsInserterOpened","useDispatch","editWidgetsStore","closeInserter","useCallback","TagName","VisuallyHidden","inserterDialogRef","inserterDialogProps","useDialog","onClose","focusOnMount","libraryRef","useRef","jsxs","ref","className","children","jsx","Button","__next40pxDefaultSize","icon","close","onClick","label","__","__experimentalLibrary","showInserterHelpPanel","shouldFocusBlock","__experimentalInsertionIndex"],"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/inserter-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { close } from '@wordpress/icons';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useWidgetLibraryInsertionPoint from '../../hooks/use-widget-library-insertion-point';\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { rootClientId, insertionIndex } = useWidgetLibraryInsertionPoint();\n\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst closeInserter = useCallback( () => {\n\t\treturn setIsInserterOpened( false );\n\t}, [ setIsInserterOpened ] );\n\n\tconst TagName = ! isMobileViewport ? VisuallyHidden : 'div';\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: closeInserter,\n\t\tfocusOnMount: true,\n\t} );\n\n\tconst libraryRef = useRef();\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"edit-widgets-layout__inserter-panel\"\n\t\t>\n\t\t\t<TagName className=\"edit-widgets-layout__inserter-panel-header\">\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tonClick={ closeInserter }\n\t\t\t\t\tlabel={ __( 'Close Block Inserter' ) }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t\t<div className=\"edit-widgets-layout__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t__experimentalInsertionInd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Q,SAAS,EAAC,qCAAqC;IAAAC,QAAA,gBAE/C,IAAAxB,WAAA,CAAAyB,GAAA,EAACb,OAAO;MAACW,SAAS,EAAC,4CAA4C;MAAAC,QAAA,eAC9D,IAAAxB,WAAA,CAAAyB,GAAA,EAACpC,WAAA,CAAAqC,MAAM;QACNC,qBAAqB;QACrBC,IAAI,EAAGC,YAAO;QACdC,OAAO,EAAGpB,aAAe;QACzBqB,KAAK,EAAG,IAAAC,QAAE,EAAE,sBAAuB;MAAG,CACtC;IAAC,CACM,CAAC,eACV,IAAAhC,WAAA,CAAAyB,GAAA;MAAKF,SAAS,EAAC,6CAA6C;MAAAC,QAAA,eAC3D,IAAAxB,WAAA,CAAAyB,GAAA,EAACjC,YAAA,CAAAyC,qBAAO;QACPC,qBAAqB;QACrBC,gBAAgB,EAAGjC,gBAAkB;QACrCE,YAAY,EAAGA,YAAc;QAC7BgC,4BAA4B,EAAG/B,cAAgB;QAC/CiB,GAAG,EAAGH;MAAY,CAClB;IAAC,CACE,CAAC;EAAA,CACF,CAAC;AAER","ignoreList":[]}
|
|
@@ -69,7 +69,6 @@ function SidebarContent({
|
|
|
69
69
|
// We're intentionally leaving `currentArea` and `isGeneralSidebarOpen`
|
|
70
70
|
// out of the dep array because we want this effect to run based on
|
|
71
71
|
// block selection changes, not sidebar state changes.
|
|
72
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
73
72
|
}, [hasSelectedNonAreaBlock, enableComplementaryArea]);
|
|
74
73
|
const tabsContextValue = (0, _element.useContext)(Tabs.Context);
|
|
75
74
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_interface.ComplementaryArea, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_i18n","_interface","_blockEditor","_icons","_components","_data","_widgetAreas","_interopRequireDefault","_store","_lockUnlock","_jsxRuntime","SIDEBAR_ACTIVE_BY_DEFAULT","Platform","select","web","native","BLOCK_INSPECTOR_IDENTIFIER","WIDGET_AREAS_IDENTIFIER","Tabs","unlock","componentsPrivateApis","SidebarHeader","selectedWidgetAreaBlock","jsxs","TabList","children","jsx","Tab","tabId","attributes","name","__","SidebarContent","hasSelectedNonAreaBlock","currentArea","isGeneralSidebarOpen","enableComplementaryArea","useDispatch","interfaceStore","useEffect","tabsContextValue","useContext","Context","ComplementaryArea","className","header","Provider","value","headerClassName","title","closeLabel","scope","identifier","icon","isRTL","drawerLeft","drawerRight","isActiveByDefault","TabPanel","focusable","default","selectedWidgetAreaId","id","BlockInspector","Sidebar","useSelect","getSelectedBlock","getBlock","getBlockParentsByBlockName","blockEditorStore","getActiveComplementaryArea","selectedBlock","activeArea","editWidgetsStore","currentSelection","widgetAreaBlock","clientId","onTabSelect","useCallback","newSelectedTabId","selectedTabId","onSelect","selectOnMove"],"sources":["@wordpress/edit-widgets/src/components/sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseEffect,\n\tPlatform,\n\tuseContext,\n\tuseCallback,\n} from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\n\n// Widget areas were once called block areas, so use 'edit-widgets/block-areas'\n// for backwards compatibility.\nconst WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction SidebarHeader( { selectedWidgetAreaBlock } ) {\n\treturn (\n\t\t<Tabs.TabList>\n\t\t\t<Tabs.Tab tabId={ WIDGET_AREAS_IDENTIFIER }>\n\t\t\t\t{ selectedWidgetAreaBlock\n\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t: __( 'Widget Areas' ) }\n\t\t\t</Tabs.Tab>\n\t\t\t<Tabs.Tab tabId={ BLOCK_INSPECTOR_IDENTIFIER }>\n\t\t\t\t{ __( 'Block' ) }\n\t\t\t</Tabs.Tab>\n\t\t</Tabs.TabList>\n\t);\n}\n\nfunction SidebarContent( {\n\thasSelectedNonAreaBlock,\n\tcurrentArea,\n\tisGeneralSidebarOpen,\n\tselectedWidgetAreaBlock,\n} ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\thasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === WIDGET_AREAS_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tBLOCK_INSPECTOR_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t! hasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tWIDGET_AREAS_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\t// We're intentionally leaving `currentArea` and `isGeneralSidebarOpen`\n\t\t// out of the dep array because we want this effect to run based on\n\t\t// block selection changes, not sidebar state changes.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader\n\t\t\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\theaderClassName=\"edit-widgets-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\tscope=\"core/edit-widgets\"\n\t\t\tidentifier={ currentArea }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t<WidgetAreas\n\t\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t{ hasSelectedNonAreaBlock ? (\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</ComplementaryArea>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst {\n\t\tcurrentArea,\n\t\thasSelectedNonAreaBlock,\n\t\tisGeneralSidebarOpen,\n\t\tselectedWidgetAreaBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock, getBlock, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\tconst selectedBlock = getSelectedBlock();\n\n\t\tconst activeArea = getActiveComplementaryArea( editWidgetsStore.name );\n\n\t\tlet currentSelection = activeArea;\n\t\tif ( ! currentSelection ) {\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tcurrentSelection = BLOCK_INSPECTOR_IDENTIFIER;\n\t\t\t} else {\n\t\t\t\tcurrentSelection = WIDGET_AREAS_IDENTIFIER;\n\t\t\t}\n\t\t}\n\n\t\tlet widgetAreaBlock;\n\t\tif ( selectedBlock ) {\n\t\t\tif ( selectedBlock.name === 'core/widget-area' ) {\n\t\t\t\twidgetAreaBlock = selectedBlock;\n\t\t\t} else {\n\t\t\t\twidgetAreaBlock = getBlock(\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\tselectedBlock.clientId,\n\t\t\t\t\t\t'core/widget-area'\n\t\t\t\t\t)[ 0 ]\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcurrentArea: currentSelection,\n\t\t\thasSelectedNonAreaBlock: !! (\n\t\t\t\tselectedBlock && selectedBlock.name !== 'core/widget-area'\n\t\t\t),\n\t\t\tisGeneralSidebarOpen: !! activeArea,\n\t\t\tselectedWidgetAreaBlock: widgetAreaBlock,\n\t\t};\n\t}, [] );\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\t// `newSelectedTabId` could technically be falsy if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsy handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea(\n\t\t\t\t\teditWidgetsStore.name,\n\t\t\t\t\tnewSelectedTabId\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// `interfaceStore`), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop. Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={ isGeneralSidebarOpen ? currentArea : null }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\thasSelectedNonAreaBlock={ hasSelectedNonAreaBlock }\n\t\t\t\tcurrentArea={ currentArea }\n\t\t\t\tisGeneralSidebarOpen={ isGeneralSidebarOpen }\n\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAIA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAgBA,IAAAO,YAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AAA2C,IAAAW,WAAA,GAAAX,OAAA;AAvC3C;AACA;AACA;;AAqBA,MAAMY,yBAAyB,GAAGC,iBAAQ,CAACC,MAAM,CAAE;EAClDC,GAAG,EAAE,IAAI;EACTC,MAAM,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BAAgB;MAC7BzC,uBAAuB,EAAE,CAAC,EACzBsC,aAAa,IAAIA,aAAa,CAACzC,IAAI,KAAK,kBAAkB,CAC1D;MACDK,oBAAoB,EAAE,CAAC,CAAEqC,UAAU;MACnClD,uBAAuB,EAAEqD;IAC1B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAM;IAAEvC;EAAwB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,gBAAe,CAAC;;EAEjE;EACA;EACA;EACA;EACA,MAAMuC,WAAW,GAAG,IAAAC,oBAAW,EAC5BC,gBAAgB,IAAM;IACvB,IAAK,CAAC,CAAEA,gBAAgB,EAAG;MAC1B3C,uBAAuB,CACtBqC,YAAgB,CAAC3C,IAAI,EACrBiD,gBACD,CAAC;IACF;EACD,CAAC,EACD,CAAE3C,uBAAuB,CAC1B,CAAC;EAED,oBACC,IAAA1B,WAAA,CAAAgB,GAAA,EAACR;EACA;EACA;EACA;EACA;EACA;EAAA;IACA8D,aAAa,EAAG7C,oBAAoB,GAAGD,WAAW,GAAG,IAAM;IAC3D+C,QAAQ,EAAGJ,WAAa;IACxBK,YAAY,EAAG,KAAO;IAAAzD,QAAA,eAEtB,IAAAf,WAAA,CAAAgB,GAAA,EAACM,cAAc;MACdC,uBAAuB,EAAGA,uBAAyB;MACnDC,WAAW,EAAGA,WAAa;MAC3BC,oBAAoB,EAAGA,oBAAsB;MAC7Cb,uBAAuB,EAAGA;IAAyB,CACnD;EAAC,CACG,CAAC;AAET","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_element","require","_i18n","_interface","_blockEditor","_icons","_components","_data","_widgetAreas","_interopRequireDefault","_store","_lockUnlock","_jsxRuntime","SIDEBAR_ACTIVE_BY_DEFAULT","Platform","select","web","native","BLOCK_INSPECTOR_IDENTIFIER","WIDGET_AREAS_IDENTIFIER","Tabs","unlock","componentsPrivateApis","SidebarHeader","selectedWidgetAreaBlock","jsxs","TabList","children","jsx","Tab","tabId","attributes","name","__","SidebarContent","hasSelectedNonAreaBlock","currentArea","isGeneralSidebarOpen","enableComplementaryArea","useDispatch","interfaceStore","useEffect","tabsContextValue","useContext","Context","ComplementaryArea","className","header","Provider","value","headerClassName","title","closeLabel","scope","identifier","icon","isRTL","drawerLeft","drawerRight","isActiveByDefault","TabPanel","focusable","default","selectedWidgetAreaId","id","BlockInspector","Sidebar","useSelect","getSelectedBlock","getBlock","getBlockParentsByBlockName","blockEditorStore","getActiveComplementaryArea","selectedBlock","activeArea","editWidgetsStore","currentSelection","widgetAreaBlock","clientId","onTabSelect","useCallback","newSelectedTabId","selectedTabId","onSelect","selectOnMove"],"sources":["@wordpress/edit-widgets/src/components/sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseEffect,\n\tPlatform,\n\tuseContext,\n\tuseCallback,\n} from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\n\n// Widget areas were once called block areas, so use 'edit-widgets/block-areas'\n// for backwards compatibility.\nconst WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction SidebarHeader( { selectedWidgetAreaBlock } ) {\n\treturn (\n\t\t<Tabs.TabList>\n\t\t\t<Tabs.Tab tabId={ WIDGET_AREAS_IDENTIFIER }>\n\t\t\t\t{ selectedWidgetAreaBlock\n\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t: __( 'Widget Areas' ) }\n\t\t\t</Tabs.Tab>\n\t\t\t<Tabs.Tab tabId={ BLOCK_INSPECTOR_IDENTIFIER }>\n\t\t\t\t{ __( 'Block' ) }\n\t\t\t</Tabs.Tab>\n\t\t</Tabs.TabList>\n\t);\n}\n\nfunction SidebarContent( {\n\thasSelectedNonAreaBlock,\n\tcurrentArea,\n\tisGeneralSidebarOpen,\n\tselectedWidgetAreaBlock,\n} ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\thasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === WIDGET_AREAS_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tBLOCK_INSPECTOR_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t! hasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tWIDGET_AREAS_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\t// We're intentionally leaving `currentArea` and `isGeneralSidebarOpen`\n\t\t// out of the dep array because we want this effect to run based on\n\t\t// block selection changes, not sidebar state changes.\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader\n\t\t\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\theaderClassName=\"edit-widgets-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\tscope=\"core/edit-widgets\"\n\t\t\tidentifier={ currentArea }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t<WidgetAreas\n\t\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t{ hasSelectedNonAreaBlock ? (\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</ComplementaryArea>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst {\n\t\tcurrentArea,\n\t\thasSelectedNonAreaBlock,\n\t\tisGeneralSidebarOpen,\n\t\tselectedWidgetAreaBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock, getBlock, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\tconst selectedBlock = getSelectedBlock();\n\n\t\tconst activeArea = getActiveComplementaryArea( editWidgetsStore.name );\n\n\t\tlet currentSelection = activeArea;\n\t\tif ( ! currentSelection ) {\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tcurrentSelection = BLOCK_INSPECTOR_IDENTIFIER;\n\t\t\t} else {\n\t\t\t\tcurrentSelection = WIDGET_AREAS_IDENTIFIER;\n\t\t\t}\n\t\t}\n\n\t\tlet widgetAreaBlock;\n\t\tif ( selectedBlock ) {\n\t\t\tif ( selectedBlock.name === 'core/widget-area' ) {\n\t\t\t\twidgetAreaBlock = selectedBlock;\n\t\t\t} else {\n\t\t\t\twidgetAreaBlock = getBlock(\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\tselectedBlock.clientId,\n\t\t\t\t\t\t'core/widget-area'\n\t\t\t\t\t)[ 0 ]\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcurrentArea: currentSelection,\n\t\t\thasSelectedNonAreaBlock: !! (\n\t\t\t\tselectedBlock && selectedBlock.name !== 'core/widget-area'\n\t\t\t),\n\t\t\tisGeneralSidebarOpen: !! activeArea,\n\t\t\tselectedWidgetAreaBlock: widgetAreaBlock,\n\t\t};\n\t}, [] );\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\t// `newSelectedTabId` could technically be falsy if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsy handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea(\n\t\t\t\t\teditWidgetsStore.name,\n\t\t\t\t\tnewSelectedTabId\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// `interfaceStore`), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop. Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={ isGeneralSidebarOpen ? currentArea : null }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\thasSelectedNonAreaBlock={ hasSelectedNonAreaBlock }\n\t\t\t\tcurrentArea={ currentArea }\n\t\t\t\tisGeneralSidebarOpen={ isGeneralSidebarOpen }\n\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAIA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAgBA,IAAAO,YAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AAA2C,IAAAW,WAAA,GAAAX,OAAA;AAvC3C;AACA;AACA;;AAqBA,MAAMY,yBAAyB,GAAGC,iBAAQ,CAACC,MAAM,CAAE;EAClDC,GAAG,EAAE,IAAI;EACTC,MAAM,EAAE;AACT,CAAE,CAAC;AAEH,MAAMC,0BAA0B,GAAG,8BAA8B;;AAEjE;AACA;AACA,MAAMC,uBAAuB,GAAG,0BAA0B;;AAE1D;AACA;AACA;;AAKA,MAAM;EAAEC;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AAuB,EAAEqD;IAC1B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAM;IAAEvC;EAAwB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,gBAAe,CAAC;;EAEjE;EACA;EACA;EACA;EACA,MAAMuC,WAAW,GAAG,IAAAC,oBAAW,EAC5BC,gBAAgB,IAAM;IACvB,IAAK,CAAC,CAAEA,gBAAgB,EAAG;MAC1B3C,uBAAuB,CACtBqC,YAAgB,CAAC3C,IAAI,EACrBiD,gBACD,CAAC;IACF;EACD,CAAC,EACD,CAAE3C,uBAAuB,CAC1B,CAAC;EAED,oBACC,IAAA1B,WAAA,CAAAgB,GAAA,EAACR;EACA;EACA;EACA;EACA;EACA;EAAA;IACA8D,aAAa,EAAG7C,oBAAoB,GAAGD,WAAW,GAAG,IAAM;IAC3D+C,QAAQ,EAAGJ,WAAa;IACxBK,YAAY,EAAG,KAAO;IAAAzD,QAAA,eAEtB,IAAAf,WAAA,CAAAgB,GAAA,EAACM,cAAc;MACdC,uBAAuB,EAAGA,uBAAyB;MACnDC,WAAW,EAAGA,WAAa;MAC3BC,oBAAoB,EAAGA,oBAAsB;MAC7Cb,uBAAuB,EAAGA;IAAyB,CACnD;EAAC,CACG,CAAC;AAET","ignoreList":[]}
|
package/build/index.js
CHANGED
|
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "store", {
|
|
|
16
16
|
var _blocks = require("@wordpress/blocks");
|
|
17
17
|
var _data = require("@wordpress/data");
|
|
18
18
|
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
19
|
+
var _editor = require("@wordpress/editor");
|
|
19
20
|
var _element = require("@wordpress/element");
|
|
20
21
|
var _blockLibrary = require("@wordpress/block-library");
|
|
21
22
|
var _coreData = require("@wordpress/core-data");
|
|
@@ -24,6 +25,7 @@ var _preferences = require("@wordpress/preferences");
|
|
|
24
25
|
var _store = require("./store");
|
|
25
26
|
require("./filters");
|
|
26
27
|
var widgetArea = _interopRequireWildcard(require("./blocks/widget-area"));
|
|
28
|
+
var _lockUnlock = require("./lock-unlock");
|
|
27
29
|
var _layout = _interopRequireDefault(require("./components/layout"));
|
|
28
30
|
var _constants = require("./constants");
|
|
29
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -38,6 +40,9 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
38
40
|
*/
|
|
39
41
|
|
|
40
42
|
const disabledBlocks = ['core/more', 'core/freeform', 'core/template-part', ...(_constants.ALLOW_REUSABLE_BLOCKS ? [] : ['core/block'])];
|
|
43
|
+
const {
|
|
44
|
+
registerCoreBlockBindingsSources
|
|
45
|
+
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
41
46
|
|
|
42
47
|
/**
|
|
43
48
|
* Initializes the block editor in the widgets screen.
|
|
@@ -59,6 +64,7 @@ function initializeEditor(id, settings) {
|
|
|
59
64
|
});
|
|
60
65
|
(0, _data.dispatch)(_blocks.store).reapplyBlockTypeFilters();
|
|
61
66
|
(0, _blockLibrary.registerCoreBlocks)(coreBlocks);
|
|
67
|
+
registerCoreBlockBindingsSources();
|
|
62
68
|
(0, _widgets.registerLegacyWidgetBlock)();
|
|
63
69
|
if (globalThis.IS_GUTENBERG_PLUGIN) {
|
|
64
70
|
(0, _blockLibrary.__experimentalRegisterExperimentalCoreBlocks)({
|
|
@@ -75,7 +81,7 @@ function initializeEditor(id, settings) {
|
|
|
75
81
|
// do this will result in errors in the default block parser.
|
|
76
82
|
// see: https://github.com/WordPress/gutenberg/issues/33097
|
|
77
83
|
(0, _blocks.setFreeformContentHandlerName)('core/html');
|
|
78
|
-
root.render(
|
|
84
|
+
root.render(/*#__PURE__*/(0, _jsxRuntime.jsx)(_element.StrictMode, {
|
|
79
85
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_layout.default, {
|
|
80
86
|
blockEditorSettings: settings
|
|
81
87
|
})
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_data","_deprecated","_interopRequireDefault","_element","_blockLibrary","_coreData","_widgets","_preferences","_store","widgetArea","_interopRequireWildcard","_layout","_constants","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","disabledBlocks","ALLOW_REUSABLE_BLOCKS","initializeEditor","id","settings","target","document","getElementById","root","createRoot","coreBlocks","__experimentalGetCoreBlocks","filter","block","includes","name","startsWith","dispatch","preferencesStore","setDefaults","fixedToolbar","welcomeGuide","showBlockBreadcrumbs","themeStyles","blocksStore","reapplyBlockTypeFilters","registerCoreBlocks","registerLegacyWidgetBlock","globalThis","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","ENABLE_EXPERIMENTAL_FSE_BLOCKS","registerLegacyWidgetVariations","registerBlock","registerWidgetGroupBlock","__experimentalFetchLinkSuggestions","search","searchOptions","fetchLinkSuggestions","setFreeformContentHandlerName","render","jsx","StrictMode","children","blockEditorSettings","initialize","exports","reinitializeEditor","deprecated","since","version","metadata","unstable__bootstrapServerSideBlockDefinitions","registerBlockType"],"sources":["@wordpress/edit-widgets/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tregisterBlockType,\n\tunstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase\n\tsetFreeformContentHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { StrictMode, createRoot } from '@wordpress/element';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterLegacyWidgetVariations,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport './store';\nimport './filters';\nimport * as widgetArea from './blocks/widget-area';\
|
|
1
|
+
{"version":3,"names":["_blocks","require","_data","_deprecated","_interopRequireDefault","_editor","_element","_blockLibrary","_coreData","_widgets","_preferences","_store","widgetArea","_interopRequireWildcard","_lockUnlock","_layout","_constants","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","disabledBlocks","ALLOW_REUSABLE_BLOCKS","registerCoreBlockBindingsSources","unlock","editorPrivateApis","initializeEditor","id","settings","target","document","getElementById","root","createRoot","coreBlocks","__experimentalGetCoreBlocks","filter","block","includes","name","startsWith","dispatch","preferencesStore","setDefaults","fixedToolbar","welcomeGuide","showBlockBreadcrumbs","themeStyles","blocksStore","reapplyBlockTypeFilters","registerCoreBlocks","registerLegacyWidgetBlock","globalThis","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","ENABLE_EXPERIMENTAL_FSE_BLOCKS","registerLegacyWidgetVariations","registerBlock","registerWidgetGroupBlock","__experimentalFetchLinkSuggestions","search","searchOptions","fetchLinkSuggestions","setFreeformContentHandlerName","render","jsx","StrictMode","children","blockEditorSettings","initialize","exports","reinitializeEditor","deprecated","since","version","metadata","unstable__bootstrapServerSideBlockDefinitions","registerBlockType"],"sources":["@wordpress/edit-widgets/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tregisterBlockType,\n\tunstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase\n\tsetFreeformContentHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { StrictMode, createRoot } from '@wordpress/element';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterLegacyWidgetVariations,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport './store';\nimport './filters';\nimport * as widgetArea from './blocks/widget-area';\nimport { unlock } from './lock-unlock';\nimport Layout from './components/layout';\nimport {\n\tALLOW_REUSABLE_BLOCKS,\n\tENABLE_EXPERIMENTAL_FSE_BLOCKS,\n} from './constants';\n\nconst disabledBlocks = [\n\t'core/more',\n\t'core/freeform',\n\t'core/template-part',\n\t...( ALLOW_REUSABLE_BLOCKS ? [] : [ 'core/block' ] ),\n];\n\nconst { registerCoreBlockBindingsSources } = unlock( editorPrivateApis );\n\n/**\n * Initializes the block editor in the widgets screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Block editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {\n\t\treturn ! (\n\t\t\tdisabledBlocks.includes( block.name ) ||\n\t\t\tblock.name.startsWith( 'core/post' ) ||\n\t\t\tblock.name.startsWith( 'core/query' ) ||\n\t\t\tblock.name.startsWith( 'core/site' ) ||\n\t\t\tblock.name.startsWith( 'core/navigation' )\n\t\t);\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-widgets', {\n\t\tfixedToolbar: false,\n\t\twelcomeGuide: true,\n\t\tshowBlockBreadcrumbs: true,\n\t\tthemeStyles: true,\n\t} );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tregisterCoreBlocks( coreBlocks );\n\tregisterCoreBlockBindingsSources();\n\tregisterLegacyWidgetBlock();\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS,\n\t\t} );\n\t}\n\tregisterLegacyWidgetVariations( settings );\n\tregisterBlock( widgetArea );\n\tregisterWidgetGroupBlock();\n\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\n\t// As we are unregistering `core/freeform` to avoid the Classic block, we must\n\t// replace it with something as the default freeform content handler. Failure to\n\t// do this will result in errors in the default block parser.\n\t// see: https://github.com/WordPress/gutenberg/issues/33097\n\tsetFreeformContentHandlerName( 'core/html' );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<Layout blockEditorSettings={ settings } />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\n/**\n * Compatibility export under the old `initialize` name.\n */\nexport const initialize = initializeEditor;\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editWidgets.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\n/**\n * Function to register an individual block.\n *\n * @param {Object} block The block to be registered.\n */\nconst registerBlock = ( block ) => {\n\tif ( ! block ) {\n\t\treturn;\n\t}\n\tconst { metadata, settings, name } = block;\n\tif ( metadata ) {\n\t\tunstable__bootstrapServerSideBlockDefinitions( { [ name ]: metadata } );\n\t}\n\tregisterBlockType( name, settings );\n};\n\nexport { store } from './store';\n"],"mappings":";;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAKA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,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,qDAA6C,EAAE;MAAE,CAAEtC,IAAI,GAAIqC;IAAS,CAAE,CAAC;EACxE;EACA,IAAAE,yBAAiB,EAAEvC,IAAI,EAAEX,QAAS,CAAC;AACpC,CAAC","ignoreList":[]}
|
package/build/store/actions.js
CHANGED
|
@@ -68,7 +68,7 @@ const saveEditedWidgetAreas = () => async ({
|
|
|
68
68
|
type: 'snackbar'
|
|
69
69
|
});
|
|
70
70
|
} catch (e) {
|
|
71
|
-
registry.dispatch(_notices.store).createErrorNotice(
|
|
71
|
+
registry.dispatch(_notices.store).createErrorNotice(/* translators: %s: The error message. */
|
|
72
72
|
(0, _i18n.sprintf)((0, _i18n.__)('There was an error. %s'), e.message), {
|
|
73
73
|
type: 'snackbar'
|
|
74
74
|
});
|
|
@@ -220,7 +220,7 @@ const saveWidgetArea = widgetAreaId => async ({
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
if (failedWidgetNames.length) {
|
|
223
|
-
throw new Error((0, _i18n.sprintf)(
|
|
223
|
+
throw new Error((0, _i18n.sprintf)(/* translators: %s: List of widget names */
|
|
224
224
|
(0, _i18n.__)('Could not save the following widgets: %s.'), failedWidgetNames.join(', ')));
|
|
225
225
|
}
|
|
226
226
|
registry.dispatch(_coreData.store).editEntityRecord(_utils.KIND, _utils.WIDGET_AREA_ENTITY_TYPE, widgetAreaId, {
|