@wordpress/edit-widgets 5.1.0 → 5.3.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE.md +1 -1
  3. package/build/components/error-boundary/index.js +24 -22
  4. package/build/components/error-boundary/index.js.map +1 -1
  5. package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
  6. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  7. package/build/components/layout/index.js +2 -5
  8. package/build/components/layout/index.js.map +1 -1
  9. package/build/components/layout/unsaved-changes-warning.js +1 -1
  10. package/build/components/layout/unsaved-changes-warning.js.map +1 -1
  11. package/build/components/widget-areas-block-editor-provider/index.js +7 -1
  12. package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
  13. package/build/experiments.js +19 -0
  14. package/build/experiments.js.map +1 -0
  15. package/build/index.js +24 -25
  16. package/build/index.js.map +1 -1
  17. package/build-module/components/error-boundary/index.js +24 -22
  18. package/build-module/components/error-boundary/index.js.map +1 -1
  19. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
  20. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  21. package/build-module/components/layout/index.js +2 -5
  22. package/build-module/components/layout/index.js.map +1 -1
  23. package/build-module/components/layout/unsaved-changes-warning.js +1 -1
  24. package/build-module/components/layout/unsaved-changes-warning.js.map +1 -1
  25. package/build-module/components/widget-areas-block-editor-provider/index.js +6 -2
  26. package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
  27. package/build-module/experiments.js +9 -0
  28. package/build-module/experiments.js.map +1 -0
  29. package/build-module/index.js +19 -24
  30. package/build-module/index.js.map +1 -1
  31. package/build-style/style-rtl.css +7 -0
  32. package/build-style/style.css +7 -0
  33. package/package.json +27 -26
  34. package/src/components/error-boundary/index.js +23 -25
  35. package/src/components/keyboard-shortcut-help-modal/index.js +0 -1
  36. package/src/components/layout/index.js +2 -2
  37. package/src/components/layout/unsaved-changes-warning.js +1 -1
  38. package/src/components/sidebar/style.scss +8 -0
  39. package/src/components/widget-areas-block-editor-provider/index.js +6 -3
  40. package/src/experiments.js +10 -0
  41. package/src/index.js +21 -24
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/components/layout/index.js"],"names":["__","sprintf","Popover","useDispatch","PluginArea","store","noticesStore","ErrorBoundary","WidgetAreasBlockEditorProvider","Sidebar","Interface","UnsavedChangesWarning","WelcomeGuide","Layout","blockEditorSettings","onError","createErrorNotice","onPluginAreaError","name"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,OAAT,QAAwB,uBAAxB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,8BAAP,MAA2C,uCAA3C;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,SAAP,MAAsB,aAAtB;AACA,OAAOC,qBAAP,MAAkC,2BAAlC;AACA,OAAOC,YAAP,MAAyB,kBAAzB;;AAEA,SAASC,MAAT,OAAoD;AAAA,MAAnC;AAAEC,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,GAAmC;AACnD,QAAM;AAAEC,IAAAA;AAAF,MAAwBb,WAAW,CAAEG,YAAF,CAAzC;;AAEA,WAASW,iBAAT,CAA4BC,IAA5B,EAAmC;AAClCF,IAAAA,iBAAiB,CAChBf,OAAO;AACN;AACAD,IAAAA,EAAE,CACD,kEADC,CAFI,EAKNkB,IALM,CADS,CAAjB;AASA;;AAED,SACC,cAAC,aAAD;AAAe,IAAA,OAAO,EAAGH;AAAzB,KACC,cAAC,8BAAD;AACC,IAAA,mBAAmB,EAAGD;AADvB,KAGC,cAAC,SAAD;AAAW,IAAA,mBAAmB,EAAGA;AAAjC,IAHD,EAIC,cAAC,OAAD,OAJD,EAKC,cAAC,OAAD,CAAS,IAAT,OALD,EAMC,cAAC,UAAD;AAAY,IAAA,OAAO,EAAGG;AAAtB,IAND,EAOC,cAAC,qBAAD,OAPD,EAQC,cAAC,YAAD,OARD,CADD,CADD;AAcA;;AAED,eAAeJ,MAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Popover } from '@wordpress/components';\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, onError } ) {\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 onError={ onError }>\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<Popover.Slot />\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"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/components/layout/index.js"],"names":["__","sprintf","Popover","useDispatch","PluginArea","store","noticesStore","ErrorBoundary","WidgetAreasBlockEditorProvider","Sidebar","Interface","UnsavedChangesWarning","WelcomeGuide","Layout","blockEditorSettings","createErrorNotice","onPluginAreaError","name"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,OAAT,QAAwB,uBAAxB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,8BAAP,MAA2C,uCAA3C;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,SAAP,MAAsB,aAAtB;AACA,OAAOC,qBAAP,MAAkC,2BAAlC;AACA,OAAOC,YAAP,MAAyB,kBAAzB;;AAEA,SAASC,MAAT,OAA2C;AAAA,MAA1B;AAAEC,IAAAA;AAAF,GAA0B;AAC1C,QAAM;AAAEC,IAAAA;AAAF,MAAwBZ,WAAW,CAAEG,YAAF,CAAzC;;AAEA,WAASU,iBAAT,CAA4BC,IAA5B,EAAmC;AAClCF,IAAAA,iBAAiB,CAChBd,OAAO;AACN;AACAD,IAAAA,EAAE,CACD,kEADC,CAFI,EAKNiB,IALM,CADS,CAAjB;AASA;;AAED,SACC,cAAC,aAAD,QACC,cAAC,8BAAD;AACC,IAAA,mBAAmB,EAAGH;AADvB,KAGC,cAAC,SAAD;AAAW,IAAA,mBAAmB,EAAGA;AAAjC,IAHD,EAIC,cAAC,OAAD,OAJD,EAKC,cAAC,OAAD,CAAS,IAAT,OALD,EAMC,cAAC,UAAD;AAAY,IAAA,OAAO,EAAGE;AAAtB,IAND,EAOC,cAAC,qBAAD,OAPD,EAQC,cAAC,YAAD,OARD,CADD,CADD;AAcA;;AAED,eAAeH,MAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Popover } from '@wordpress/components';\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<Popover.Slot />\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"]}
@@ -32,7 +32,7 @@ export default function UnsavedChangesWarning() {
32
32
  *
33
33
  * @param {Event} event `beforeunload` event.
34
34
  *
35
- * @return {?string} Warning prompt message, if unsaved changes exist.
35
+ * @return {string | undefined} Warning prompt message, if unsaved changes exist.
36
36
  */
37
37
  const warnIfUnsavedChanges = event => {
38
38
  if (isDirty) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/components/layout/unsaved-changes-warning.js"],"names":["__","useEffect","useSelect","store","editWidgetsStore","UnsavedChangesWarning","isDirty","select","getEditedWidgetAreas","editedWidgetAreas","length","warnIfUnsavedChanges","event","returnValue","window","addEventListener","removeEventListener"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,qBAAT,GAAiC;AAC/C,QAAMC,OAAO,GAAGJ,SAAS,CAAIK,MAAF,IAAc;AACxC,UAAM;AAAEC,MAAAA;AAAF,QAA2BD,MAAM,CAAEH,gBAAF,CAAvC;AACA,UAAMK,iBAAiB,GAAGD,oBAAoB,EAA9C;AAEA,WAAO,CAAAC,iBAAiB,SAAjB,IAAAA,iBAAiB,WAAjB,YAAAA,iBAAiB,CAAEC,MAAnB,IAA4B,CAAnC;AACA,GALwB,EAKtB,EALsB,CAAzB;AAOAT,EAAAA,SAAS,CAAE,MAAM;AAChB;AACF;AACA;AACA;AACA;AACA;AACA;AACE,UAAMU,oBAAoB,GAAKC,KAAF,IAAa;AACzC,UAAKN,OAAL,EAAe;AACdM,QAAAA,KAAK,CAACC,WAAN,GAAoBb,EAAE,CACrB,8DADqB,CAAtB;AAGA,eAAOY,KAAK,CAACC,WAAb;AACA;AACD,KAPD;;AASAC,IAAAA,MAAM,CAACC,gBAAP,CAAyB,cAAzB,EAAyCJ,oBAAzC;AAEA,WAAO,MAAM;AACZG,MAAAA,MAAM,CAACE,mBAAP,CAA4B,cAA5B,EAA4CL,oBAA5C;AACA,KAFD;AAGA,GAtBQ,EAsBN,CAAEL,OAAF,CAtBM,CAAT;AAwBA,SAAO,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\n/**\n * Warns the user if there are unsaved changes before leaving the editor.\n *\n * This is a duplicate of the component implemented in the editor package.\n * Duplicated here as edit-widgets doesn't depend on editor.\n *\n * @return {WPComponent} The component.\n */\nexport default function UnsavedChangesWarning() {\n\tconst isDirty = useSelect( ( select ) => {\n\t\tconst { getEditedWidgetAreas } = select( editWidgetsStore );\n\t\tconst editedWidgetAreas = getEditedWidgetAreas();\n\n\t\treturn editedWidgetAreas?.length > 0;\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * Warns the user if there are unsaved changes before leaving the editor.\n\t\t *\n\t\t * @param {Event} event `beforeunload` event.\n\t\t *\n\t\t * @return {?string} Warning prompt message, if unsaved changes exist.\n\t\t */\n\t\tconst warnIfUnsavedChanges = ( event ) => {\n\t\t\tif ( isDirty ) {\n\t\t\t\tevent.returnValue = __(\n\t\t\t\t\t'You have unsaved changes. If you proceed, they will be lost.'\n\t\t\t\t);\n\t\t\t\treturn event.returnValue;\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener( 'beforeunload', warnIfUnsavedChanges );\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener( 'beforeunload', warnIfUnsavedChanges );\n\t\t};\n\t}, [ isDirty ] );\n\n\treturn null;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/components/layout/unsaved-changes-warning.js"],"names":["__","useEffect","useSelect","store","editWidgetsStore","UnsavedChangesWarning","isDirty","select","getEditedWidgetAreas","editedWidgetAreas","length","warnIfUnsavedChanges","event","returnValue","window","addEventListener","removeEventListener"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,qBAAT,GAAiC;AAC/C,QAAMC,OAAO,GAAGJ,SAAS,CAAIK,MAAF,IAAc;AACxC,UAAM;AAAEC,MAAAA;AAAF,QAA2BD,MAAM,CAAEH,gBAAF,CAAvC;AACA,UAAMK,iBAAiB,GAAGD,oBAAoB,EAA9C;AAEA,WAAO,CAAAC,iBAAiB,SAAjB,IAAAA,iBAAiB,WAAjB,YAAAA,iBAAiB,CAAEC,MAAnB,IAA4B,CAAnC;AACA,GALwB,EAKtB,EALsB,CAAzB;AAOAT,EAAAA,SAAS,CAAE,MAAM;AAChB;AACF;AACA;AACA;AACA;AACA;AACA;AACE,UAAMU,oBAAoB,GAAKC,KAAF,IAAa;AACzC,UAAKN,OAAL,EAAe;AACdM,QAAAA,KAAK,CAACC,WAAN,GAAoBb,EAAE,CACrB,8DADqB,CAAtB;AAGA,eAAOY,KAAK,CAACC,WAAb;AACA;AACD,KAPD;;AASAC,IAAAA,MAAM,CAACC,gBAAP,CAAyB,cAAzB,EAAyCJ,oBAAzC;AAEA,WAAO,MAAM;AACZG,MAAAA,MAAM,CAACE,mBAAP,CAA4B,cAA5B,EAA4CL,oBAA5C;AACA,KAFD;AAGA,GAtBQ,EAsBN,CAAEL,OAAF,CAtBM,CAAT;AAwBA,SAAO,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\n/**\n * Warns the user if there are unsaved changes before leaving the editor.\n *\n * This is a duplicate of the component implemented in the editor package.\n * Duplicated here as edit-widgets doesn't depend on editor.\n *\n * @return {WPComponent} The component.\n */\nexport default function UnsavedChangesWarning() {\n\tconst isDirty = useSelect( ( select ) => {\n\t\tconst { getEditedWidgetAreas } = select( editWidgetsStore );\n\t\tconst editedWidgetAreas = getEditedWidgetAreas();\n\n\t\treturn editedWidgetAreas?.length > 0;\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * Warns the user if there are unsaved changes before leaving the editor.\n\t\t *\n\t\t * @param {Event} event `beforeunload` event.\n\t\t *\n\t\t * @return {string | undefined} Warning prompt message, if unsaved changes exist.\n\t\t */\n\t\tconst warnIfUnsavedChanges = ( event ) => {\n\t\t\tif ( isDirty ) {\n\t\t\t\tevent.returnValue = __(\n\t\t\t\t\t'You have unsaved changes. If you proceed, they will be lost.'\n\t\t\t\t);\n\t\t\t\treturn event.returnValue;\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener( 'beforeunload', warnIfUnsavedChanges );\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener( 'beforeunload', warnIfUnsavedChanges );\n\t\t};\n\t}, [ isDirty ] );\n\n\treturn null;\n}\n"]}
@@ -9,7 +9,7 @@ import { uploadMedia } from '@wordpress/media-utils';
9
9
  import { useDispatch, useSelect } from '@wordpress/data';
10
10
  import { useEntityBlockEditor, store as coreStore, useResourcePermissions } from '@wordpress/core-data';
11
11
  import { useMemo } from '@wordpress/element';
12
- import { BlockEditorProvider, BlockEditorKeyboardShortcuts, CopyHandler } from '@wordpress/block-editor';
12
+ import { BlockEditorKeyboardShortcuts, CopyHandler, experiments as blockEditorExperiments } from '@wordpress/block-editor';
13
13
  import { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';
14
14
  import { ShortcutProvider } from '@wordpress/keyboard-shortcuts';
15
15
  import { store as preferencesStore } from '@wordpress/preferences';
@@ -22,6 +22,10 @@ import { buildWidgetAreasPostId, KIND, POST_TYPE } from '../../store/utils';
22
22
  import useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';
23
23
  import { store as editWidgetsStore } from '../../store';
24
24
  import { ALLOW_REUSABLE_BLOCKS } from '../../constants';
25
+ import { unlock } from '../../experiments';
26
+ const {
27
+ ExperimentalBlockEditorProvider
28
+ } = unlock(blockEditorExperiments);
25
29
  export default function WidgetAreasBlockEditorProvider(_ref) {
26
30
  let {
27
31
  blockEditorSettings,
@@ -78,7 +82,7 @@ export default function WidgetAreasBlockEditorProvider(_ref) {
78
82
  const [blocks, onInput, onChange] = useEntityBlockEditor(KIND, POST_TYPE, {
79
83
  id: buildWidgetAreasPostId()
80
84
  });
81
- return createElement(ShortcutProvider, null, createElement(BlockEditorKeyboardShortcuts.Register, null), createElement(KeyboardShortcuts.Register, null), createElement(SlotFillProvider, null, createElement(BlockEditorProvider, _extends({
85
+ return createElement(ShortcutProvider, null, createElement(BlockEditorKeyboardShortcuts.Register, null), createElement(KeyboardShortcuts.Register, null), createElement(SlotFillProvider, null, createElement(ExperimentalBlockEditorProvider, _extends({
82
86
  value: blocks,
83
87
  onInput: onInput,
84
88
  onChange: onChange,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-provider/index.js"],"names":["SlotFillProvider","uploadMedia","useDispatch","useSelect","useEntityBlockEditor","store","coreStore","useResourcePermissions","useMemo","BlockEditorProvider","BlockEditorKeyboardShortcuts","CopyHandler","ReusableBlocksMenuItems","ShortcutProvider","preferencesStore","KeyboardShortcuts","buildWidgetAreasPostId","KIND","POST_TYPE","useLastSelectedWidgetArea","editWidgetsStore","ALLOW_REUSABLE_BLOCKS","WidgetAreasBlockEditorProvider","blockEditorSettings","children","props","mediaPermissions","reusableBlocks","isFixedToolbarActive","keepCaretInsideBlock","select","widgetAreas","getWidgetAreas","widgets","getWidgets","getEntityRecords","get","setIsInserterOpened","settings","mediaUploadBlockEditor","canCreate","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalReusableBlocks","hasFixedToolbar","mediaUpload","templateLock","__experimentalSetIsInserterOpened","widgetAreaId","blocks","onInput","onChange","id"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,gBAAT,QAAiC,uBAAjC;AACA,SAASC,WAAT,QAA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AAAA,EAAE,EAAEvC,sBAAsB;AAA5B,GAHyD,CAA1D;AAMA,SACC,cAAC,gBAAD,QACC,cAAC,4BAAD,CAA8B,QAA9B,OADD,EAEC,cAAC,iBAAD,CAAmB,QAAnB,OAFD,EAGC,cAAC,gBAAD,QACC,cAAC,mBAAD;AACC,IAAA,KAAK,EAAGoC,MADT;AAEC,IAAA,OAAO,EAAGC,OAFX;AAGC,IAAA,QAAQ,EAAGC,QAHZ;AAIC,IAAA,QAAQ,EAAGhB,QAJZ;AAKC,IAAA,cAAc,EAAG;AALlB,KAMMb,KANN,GAQC,cAAC,WAAD,QAAeD,QAAf,CARD,EASC,cAAC,uBAAD;AAAyB,IAAA,YAAY,EAAG2B;AAAxC,IATD,CADD,CAHD,CADD;AAmBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider } from '@wordpress/components';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tuseEntityBlockEditor,\n\tstore as coreStore,\n\tuseResourcePermissions,\n} from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tBlockEditorProvider,\n\tBlockEditorKeyboardShortcuts,\n\tCopyHandler,\n} from '@wordpress/block-editor';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport { buildWidgetAreasPostId, KIND, POST_TYPE } from '../../store/utils';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\nimport { ALLOW_REUSABLE_BLOCKS } from '../../constants';\n\nexport default function WidgetAreasBlockEditorProvider( {\n\tblockEditorSettings,\n\tchildren,\n\t...props\n} ) {\n\tconst mediaPermissions = useResourcePermissions( 'media' );\n\tconst { reusableBlocks, isFixedToolbarActive, keepCaretInsideBlock } =\n\t\tuseSelect(\n\t\t\t( select ) => ( {\n\t\t\t\twidgetAreas: select( editWidgetsStore ).getWidgetAreas(),\n\t\t\t\twidgets: select( editWidgetsStore ).getWidgets(),\n\t\t\t\treusableBlocks: ALLOW_REUSABLE_BLOCKS\n\t\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t'wp_block'\n\t\t\t\t\t )\n\t\t\t\t\t: [],\n\t\t\t\tisFixedToolbarActive: !! select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-widgets',\n\t\t\t\t\t'fixedToolbar'\n\t\t\t\t),\n\t\t\t\tkeepCaretInsideBlock: !! select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-widgets',\n\t\t\t\t\t'keepCaretInsideBlock'\n\t\t\t\t),\n\t\t\t} ),\n\t\t\t[]\n\t\t);\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( mediaPermissions.canCreate ) {\n\t\t\tmediaUploadBlockEditor = ( { onError, ...argumentsObject } ) => {\n\t\t\t\tuploadMedia( {\n\t\t\t\t\twpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,\n\t\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t\t...argumentsObject,\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...blockEditorSettings,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\thasFixedToolbar: isFixedToolbarActive,\n\t\t\tkeepCaretInsideBlock,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\ttemplateLock: 'all',\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t};\n\t}, [\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tmediaPermissions.canCreate,\n\t\treusableBlocks,\n\t\tsetIsInserterOpened,\n\t] );\n\n\tconst widgetAreaId = useLastSelectedWidgetArea();\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\tKIND,\n\t\tPOST_TYPE,\n\t\t{ id: buildWidgetAreasPostId() }\n\t);\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t<KeyboardShortcuts.Register />\n\t\t\t<SlotFillProvider>\n\t\t\t\t<BlockEditorProvider\n\t\t\t\t\tvalue={ blocks }\n\t\t\t\t\tonInput={ onInput }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<CopyHandler>{ children }</CopyHandler>\n\t\t\t\t\t<ReusableBlocksMenuItems rootClientId={ widgetAreaId } />\n\t\t\t\t</BlockEditorProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-provider/index.js"],"names":["SlotFillProvider","uploadMedia","useDispatch","useSelect","useEntityBlockEditor","store","coreStore","useResourcePermissions","useMemo","BlockEditorKeyboardShortcuts","CopyHandler","experiments","blockEditorExperiments","ReusableBlocksMenuItems","ShortcutProvider","preferencesStore","KeyboardShortcuts","buildWidgetAreasPostId","KIND","POST_TYPE","useLastSelectedWidgetArea","editWidgetsStore","ALLOW_REUSABLE_BLOCKS","unlock","ExperimentalBlockEditorProvider","WidgetAreasBlockEditorProvider","blockEditorSettings","children","props","mediaPermissions","reusableBlocks","isFixedToolbarActive","keepCaretInsideBlock","select","widgetAreas","getWidgetAreas","widgets","getWidgets","getEntityRecords","get","setIsInserterOpened","settings","mediaUploadBlockEditor","canCreate","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalReusableBlocks","hasFixedToolbar","mediaUpload","templateLock","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EAGFC,oBAHE,EAIFH,gBAAgB,CAACc,SAJf,EAKFb,cALE,EAMFU,mBANE,CApBqB,CAAxB;AA6BA,QAAMc,YAAY,GAAGlC,yBAAyB,EAA9C;AAEA,QAAM,CAAEmC,MAAF,EAAUC,OAAV,EAAmBC,QAAnB,IAAgCrD,oBAAoB,CACzDc,IADyD,EAEzDC,SAFyD,EAGzD;AAAEuC,IAAAA,EAAE,EAAEzC,sBAAsB;AAA5B,GAHyD,CAA1D;AAMA,SACC,cAAC,gBAAD,QACC,cAAC,4BAAD,CAA8B,QAA9B,OADD,EAEC,cAAC,iBAAD,CAAmB,QAAnB,OAFD,EAGC,cAAC,gBAAD,QACC,cAAC,+BAAD;AACC,IAAA,KAAK,EAAGsC,MADT;AAEC,IAAA,OAAO,EAAGC,OAFX;AAGC,IAAA,QAAQ,EAAGC,QAHZ;AAIC,IAAA,QAAQ,EAAGhB,QAJZ;AAKC,IAAA,cAAc,EAAG;AALlB,KAMMb,KANN,GAQC,cAAC,WAAD,QAAeD,QAAf,CARD,EASC,cAAC,uBAAD;AAAyB,IAAA,YAAY,EAAG2B;AAAxC,IATD,CADD,CAHD,CADD;AAmBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider } from '@wordpress/components';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tuseEntityBlockEditor,\n\tstore as coreStore,\n\tuseResourcePermissions,\n} from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tBlockEditorKeyboardShortcuts,\n\tCopyHandler,\n\texperiments as blockEditorExperiments,\n} from '@wordpress/block-editor';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport { buildWidgetAreasPostId, KIND, POST_TYPE } from '../../store/utils';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\nimport { ALLOW_REUSABLE_BLOCKS } from '../../constants';\nimport { unlock } from '../../experiments';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorExperiments );\n\nexport default function WidgetAreasBlockEditorProvider( {\n\tblockEditorSettings,\n\tchildren,\n\t...props\n} ) {\n\tconst mediaPermissions = useResourcePermissions( 'media' );\n\tconst { reusableBlocks, isFixedToolbarActive, keepCaretInsideBlock } =\n\t\tuseSelect(\n\t\t\t( select ) => ( {\n\t\t\t\twidgetAreas: select( editWidgetsStore ).getWidgetAreas(),\n\t\t\t\twidgets: select( editWidgetsStore ).getWidgets(),\n\t\t\t\treusableBlocks: ALLOW_REUSABLE_BLOCKS\n\t\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t'wp_block'\n\t\t\t\t\t )\n\t\t\t\t\t: [],\n\t\t\t\tisFixedToolbarActive: !! select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-widgets',\n\t\t\t\t\t'fixedToolbar'\n\t\t\t\t),\n\t\t\t\tkeepCaretInsideBlock: !! select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-widgets',\n\t\t\t\t\t'keepCaretInsideBlock'\n\t\t\t\t),\n\t\t\t} ),\n\t\t\t[]\n\t\t);\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( mediaPermissions.canCreate ) {\n\t\t\tmediaUploadBlockEditor = ( { onError, ...argumentsObject } ) => {\n\t\t\t\tuploadMedia( {\n\t\t\t\t\twpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,\n\t\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t\t...argumentsObject,\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...blockEditorSettings,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\thasFixedToolbar: isFixedToolbarActive,\n\t\t\tkeepCaretInsideBlock,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\ttemplateLock: 'all',\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t};\n\t}, [\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tmediaPermissions.canCreate,\n\t\treusableBlocks,\n\t\tsetIsInserterOpened,\n\t] );\n\n\tconst widgetAreaId = useLastSelectedWidgetArea();\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\tKIND,\n\t\tPOST_TYPE,\n\t\t{ id: buildWidgetAreasPostId() }\n\t);\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t<KeyboardShortcuts.Register />\n\t\t\t<SlotFillProvider>\n\t\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\t\tvalue={ blocks }\n\t\t\t\t\tonInput={ onInput }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<CopyHandler>{ children }</CopyHandler>\n\t\t\t\t\t<ReusableBlocksMenuItems rootClientId={ widgetAreaId } />\n\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n"]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/experiments';
5
+ export const {
6
+ lock,
7
+ unlock
8
+ } = __dangerousOptInToUnstableAPIsOnlyForCoreModules('I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/edit-widgets');
9
+ //# sourceMappingURL=experiments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/experiments.js"],"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAT,QAAiE,wBAAjE;AAEA,OAAO,MAAM;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZF,gDAAgD,CAC/C,8GAD+C,EAE/C,yBAF+C,CAD1C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/experiments';\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/edit-widgets'\n\t);\n"]}
@@ -6,7 +6,8 @@ import { createElement } from "@wordpress/element";
6
6
  import { registerBlockType, unstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase
7
7
  setFreeformContentHandlerName, store as blocksStore } from '@wordpress/blocks';
8
8
  import { dispatch } from '@wordpress/data';
9
- import { render, unmountComponentAtNode } from '@wordpress/element';
9
+ import deprecated from '@wordpress/deprecated';
10
+ import { createRoot } from '@wordpress/element';
10
11
  import { registerCoreBlocks, __experimentalGetCoreBlocks, __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';
11
12
  import { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';
12
13
  import { registerLegacyWidgetBlock, registerLegacyWidgetVariations, registerWidgetGroupBlock } from '@wordpress/widgets';
@@ -21,23 +22,6 @@ import * as widgetArea from './blocks/widget-area';
21
22
  import Layout from './components/layout';
22
23
  import { ALLOW_REUSABLE_BLOCKS, ENABLE_EXPERIMENTAL_FSE_BLOCKS } from './constants';
23
24
  const disabledBlocks = ['core/more', 'core/freeform', 'core/template-part', ...(ALLOW_REUSABLE_BLOCKS ? [] : ['core/block'])];
24
- /**
25
- * Reinitializes the editor after the user chooses to reboot the editor after
26
- * an unhandled error occurs, replacing previously mounted editor element using
27
- * an initial state from prior to the crash.
28
- *
29
- * @param {Element} target DOM node in which editor is rendered.
30
- * @param {?Object} settings Editor settings object.
31
- */
32
-
33
- export function reinitializeEditor(target, settings) {
34
- unmountComponentAtNode(target);
35
- const reboot = reinitializeEditor.bind(null, target, settings);
36
- render(createElement(Layout, {
37
- blockEditorSettings: settings,
38
- onError: reboot
39
- }), target);
40
- }
41
25
  /**
42
26
  * Initializes the block editor in the widgets screen.
43
27
  *
@@ -45,9 +29,9 @@ export function reinitializeEditor(target, settings) {
45
29
  * @param {Object} settings Block editor settings.
46
30
  */
47
31
 
48
- export function initialize(id, settings) {
32
+ export function initializeEditor(id, settings) {
49
33
  const target = document.getElementById(id);
50
- const reboot = reinitializeEditor.bind(null, target, settings);
34
+ const root = createRoot(target);
51
35
 
52
36
  const coreBlocks = __experimentalGetCoreBlocks().filter(block => {
53
37
  return !(disabledBlocks.includes(block.name) || block.name.startsWith('core/post') || block.name.startsWith('core/query') || block.name.startsWith('core/site') || block.name.startsWith('core/navigation'));
@@ -82,10 +66,21 @@ export function initialize(id, settings) {
82
66
 
83
67
 
84
68
  setFreeformContentHandlerName('core/html');
85
- render(createElement(Layout, {
86
- blockEditorSettings: settings,
87
- onError: reboot
88
- }), target);
69
+ root.render(createElement(Layout, {
70
+ blockEditorSettings: settings
71
+ }));
72
+ return root;
73
+ }
74
+ /**
75
+ * Compatibility export under the old `initialize` name.
76
+ */
77
+
78
+ export const initialize = initializeEditor;
79
+ export function reinitializeEditor() {
80
+ deprecated('wp.editWidgets.reinitializeEditor', {
81
+ since: '6.2',
82
+ version: '6.3'
83
+ });
89
84
  }
90
85
  /**
91
86
  * Function to register an individual block.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/index.js"],"names":["registerBlockType","unstable__bootstrapServerSideBlockDefinitions","setFreeformContentHandlerName","store","blocksStore","dispatch","render","unmountComponentAtNode","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","registerLegacyWidgetBlock","registerLegacyWidgetVariations","registerWidgetGroupBlock","preferencesStore","widgetArea","Layout","ALLOW_REUSABLE_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","disabledBlocks","reinitializeEditor","target","settings","reboot","bind","initialize","id","document","getElementById","coreBlocks","filter","block","includes","name","startsWith","setDefaults","fixedToolbar","welcomeGuide","showBlockBreadcrumbs","themeStyles","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","registerBlock","search","searchOptions","metadata"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,iBADD,EAECC,6CAFD,EAEgD;AAC/CC,6BAHD,EAICC,KAAK,IAAIC,WAJV,QAKO,mBALP;AAMA,SAASC,QAAT,QAAyB,iBAAzB;AACA,SAASC,MAAT,EAAiBC,sBAAjB,QAA+C,oBAA/C;AACA,SACCC,kBADD,EAECC,2BAFD,EAGCC,4CAHD,QAIO,0BAJP;AAKA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,sBAA3E;AACA,SACCC,yBADD,EAECC,8BAFD,EAGCC,wBAHD,QAIO,oBAJP;AAKA,SAASZ,KAAK,IAAIa,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,OAAO,SAAP;AACA,OAAO,WAAP;AACA,OAAO,KAAKC,UAAZ,MAA4B,sBAA5B;AAEA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,SACCC,qBADD,EAECC,8BAFD,QAGO,aAHP;AAKA,MAAMC,cAAc,GAAG,CACtB,WADsB,EAEtB,eAFsB,EAGtB,oBAHsB,EAItB,IAAKF,qBAAqB,GAAG,EAAH,GAAQ,CAAE,YAAF,CAAlC,CAJsB,CAAvB;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,kBAAT,CAA6BC,MAA7B,EAAqCC,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CAAxB;;AACAlC,EAAAA,kBAAkB,CAAEuB,UAAF,CAAlB;AACAlB,EAAAA,yBAAyB;;AACzB,MAAK8B,OAAO,CAACC,GAAR,CAAYC,mBAAjB,EAAuC;AACtCnC,IAAAA,4CAA4C,CAAE;AAC7CoC,MAAAA,eAAe,EAAE1B;AAD4B,KAAF,CAA5C;AAGA;;AACDN,EAAAA,8BAA8B,CAAEU,QAAF,CAA9B;AACAuB,EAAAA,aAAa,CAAE9B,UAAF,CAAb;AACAF,EAAAA,wBAAwB;;AAExBS,EAAAA,QAAQ,CAACb,kCAAT,GAA8C,CAAEqC,MAAF,EAAUC,aAAV,KAC7CrC,oBAAoB,CAAEoC,MAAF,EAAUC,aAAV,EAAyBzB,QAAzB,CADrB,CAhC0C,CAmC1C;AACA;AACA;AACA;;;AACAtB,EAAAA,6BAA6B,CAAE,WAAF,CAA7B;AACAI,EAAAA,MAAM,CACL,cAAC,MAAD;AAAQ,IAAA,mBAAmB,EAAGkB,QAA9B;AAAyC,IAAA,OAAO,EAAGC;AAAnD,IADK,EAELF,MAFK,CAAN;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMwB,aAAa,GAAKd,KAAF,IAAa;AAClC,MAAK,CAAEA,KAAP,EAAe;AACd;AACA;;AACD,QAAM;AAAEiB,IAAAA,QAAF;AAAY1B,IAAAA,QAAZ;AAAsBW,IAAAA;AAAtB,MAA+BF,KAArC;;AACA,MAAKiB,QAAL,EAAgB;AACfjD,IAAAA,6CAA6C,CAAE;AAAE,OAAEkC,IAAF,GAAUe;AAAZ,KAAF,CAA7C;AACA;;AACDlD,EAAAA,iBAAiB,CAAEmC,IAAF,EAAQX,QAAR,CAAjB;AACA,CATD","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 { render, unmountComponentAtNode } 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';\n\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\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\trender(\n\t\t<Layout blockEditorSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\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 initialize( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\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 ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( process.env.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\trender(\n\t\t<Layout blockEditorSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\n/**\n * Function to register an individual block.\n *\n * @param {Object} block The block to be registered.\n *\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"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/index.js"],"names":["registerBlockType","unstable__bootstrapServerSideBlockDefinitions","setFreeformContentHandlerName","store","blocksStore","dispatch","deprecated","createRoot","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","registerLegacyWidgetBlock","registerLegacyWidgetVariations","registerWidgetGroupBlock","preferencesStore","widgetArea","Layout","ALLOW_REUSABLE_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","disabledBlocks","initializeEditor","id","settings","target","document","getElementById","root","coreBlocks","filter","block","includes","name","startsWith","setDefaults","fixedToolbar","welcomeGuide","showBlockBreadcrumbs","themeStyles","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","registerBlock","search","searchOptions","render","initialize","reinitializeEditor","since","version","metadata"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,iBADD,EAECC,6CAFD,EAEgD;AAC/CC,6BAHD,EAICC,KAAK,IAAIC,WAJV,QAKO,mBALP;AAMA,SAASC,QAAT,QAAyB,iBAAzB;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SACCC,kBADD,EAECC,2BAFD,EAGCC,4CAHD,QAIO,0BAJP;AAKA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,sBAA3E;AACA,SACCC,yBADD,EAECC,8BAFD,EAGCC,wBAHD,QAIO,oBAJP;AAKA,SAASZ,KAAK,IAAIa,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,OAAO,SAAP;AACA,OAAO,WAAP;AACA,OAAO,KAAKC,UAAZ,MAA4B,sBAA5B;AAEA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,SACCC,qBADD,EAECC,8BAFD,QAGO,aAHP;AAKA,MAAMC,cAAc,GAAG,CACtB,WADsB,EAEtB,eAFsB,EAGtB,oBAHsB,EAItB,IAAKF,qBAAqB,GAAG,EAAH,GAAQ,CAAE,YAAF,CAAlC,CAJsB,CAAvB;AAOA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,gBAAT,CAA2BC,EAA3B,EAA+BC,QAA/B,EAA0C;AAChD,QAAMC,MAAM,GAAGC,QAAQ,CAACC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jCgD,CAoChD;AACA;AACA;AACA;;;AACAtB,EAAAA,6BAA6B,CAAE,WAAF,CAA7B;AAEA0B,EAAAA,IAAI,CAACoB,MAAL,CAAa,cAAC,MAAD;AAAQ,IAAA,mBAAmB,EAAGxB;AAA9B,IAAb;AAEA,SAAOI,IAAP;AACA;AAED;AACA;AACA;;AACA,OAAO,MAAMqB,UAAU,GAAG3B,gBAAnB;AAEP,OAAO,SAAS4B,kBAAT,GAA8B;AACpC5C,EAAAA,UAAU,CAAE,mCAAF,EAAuC;AAChD6C,IAAAA,KAAK,EAAE,KADyC;AAEhDC,IAAAA,OAAO,EAAE;AAFuC,GAAvC,CAAV;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMP,aAAa,GAAKd,KAAF,IAAa;AAClC,MAAK,CAAEA,KAAP,EAAe;AACd;AACA;;AACD,QAAM;AAAEsB,IAAAA,QAAF;AAAY7B,IAAAA,QAAZ;AAAsBS,IAAAA;AAAtB,MAA+BF,KAArC;;AACA,MAAKsB,QAAL,EAAgB;AACfpD,IAAAA,6CAA6C,CAAE;AAAE,OAAEgC,IAAF,GAAUoB;AAAZ,KAAF,CAA7C;AACA;;AACDrD,EAAAA,iBAAiB,CAAEiC,IAAF,EAAQT,QAAR,CAAjB;AACA,CATD","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 { 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';\n\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\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 ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( process.env.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( <Layout blockEditorSettings={ settings } /> );\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 *\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"]}
@@ -501,6 +501,9 @@ body.is-fullscreen-mode .interface-interface-skeleton {
501
501
  box-shadow: none;
502
502
  font-weight: 500;
503
503
  }
504
+ .interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active::after {
505
+ content: none;
506
+ }
504
507
  .interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled) {
505
508
  box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
506
509
  }
@@ -776,6 +779,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
776
779
  .components-button.edit-widgets-sidebar__panel-tab:focus:not(:disabled) {
777
780
  position: relative;
778
781
  box-shadow: none;
782
+ outline: none;
779
783
  }
780
784
  .components-button.edit-widgets-sidebar__panel-tab::after {
781
785
  content: "";
@@ -797,6 +801,8 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
797
801
  }
798
802
  .components-button.edit-widgets-sidebar__panel-tab.is-active::after {
799
803
  height: calc(1 * var(--wp-admin-border-width-focus));
804
+ outline: 2px solid transparent;
805
+ outline-offset: -1px;
800
806
  }
801
807
  .components-button.edit-widgets-sidebar__panel-tab::before {
802
808
  content: "";
@@ -818,6 +824,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
818
824
  }
819
825
  .components-button.edit-widgets-sidebar__panel-tab:focus-visible::before {
820
826
  box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
827
+ outline: 2px solid transparent;
821
828
  }
822
829
 
823
830
  .edit-widgets-widget-areas__top-container {
@@ -501,6 +501,9 @@ body.is-fullscreen-mode .interface-interface-skeleton {
501
501
  box-shadow: none;
502
502
  font-weight: 500;
503
503
  }
504
+ .interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active::after {
505
+ content: none;
506
+ }
504
507
  .interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled) {
505
508
  box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
506
509
  }
@@ -776,6 +779,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
776
779
  .components-button.edit-widgets-sidebar__panel-tab:focus:not(:disabled) {
777
780
  position: relative;
778
781
  box-shadow: none;
782
+ outline: none;
779
783
  }
780
784
  .components-button.edit-widgets-sidebar__panel-tab::after {
781
785
  content: "";
@@ -797,6 +801,8 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
797
801
  }
798
802
  .components-button.edit-widgets-sidebar__panel-tab.is-active::after {
799
803
  height: calc(1 * var(--wp-admin-border-width-focus));
804
+ outline: 2px solid transparent;
805
+ outline-offset: -1px;
800
806
  }
801
807
  .components-button.edit-widgets-sidebar__panel-tab::before {
802
808
  content: "";
@@ -818,6 +824,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
818
824
  }
819
825
  .components-button.edit-widgets-sidebar__panel-tab:focus-visible::before {
820
826
  box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
827
+ outline: 2px solid transparent;
821
828
  }
822
829
 
823
830
  .edit-widgets-widget-areas__top-container {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-widgets",
3
- "version": "5.1.0",
3
+ "version": "5.3.0",
4
4
  "description": "Widgets Page module for WordPress..",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,30 +27,31 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/api-fetch": "^6.21.0",
31
- "@wordpress/block-editor": "^11.1.0",
32
- "@wordpress/block-library": "^8.1.0",
33
- "@wordpress/blocks": "^12.1.0",
34
- "@wordpress/components": "^23.1.0",
35
- "@wordpress/compose": "^6.1.0",
36
- "@wordpress/core-data": "^6.1.0",
37
- "@wordpress/data": "^8.1.0",
38
- "@wordpress/deprecated": "^3.24.0",
39
- "@wordpress/dom": "^3.24.0",
40
- "@wordpress/element": "^5.1.0",
41
- "@wordpress/hooks": "^3.24.0",
42
- "@wordpress/i18n": "^4.24.0",
43
- "@wordpress/icons": "^9.15.0",
44
- "@wordpress/interface": "^5.1.0",
45
- "@wordpress/keyboard-shortcuts": "^4.1.0",
46
- "@wordpress/keycodes": "^3.24.0",
47
- "@wordpress/media-utils": "^4.15.0",
48
- "@wordpress/notices": "^3.24.0",
49
- "@wordpress/plugins": "^5.1.0",
50
- "@wordpress/preferences": "^3.1.0",
51
- "@wordpress/reusable-blocks": "^4.1.0",
52
- "@wordpress/url": "^3.25.0",
53
- "@wordpress/widgets": "^3.1.0",
30
+ "@wordpress/api-fetch": "^6.23.0",
31
+ "@wordpress/block-editor": "^11.3.0",
32
+ "@wordpress/block-library": "^8.3.0",
33
+ "@wordpress/blocks": "^12.3.0",
34
+ "@wordpress/components": "^23.3.0",
35
+ "@wordpress/compose": "^6.3.0",
36
+ "@wordpress/core-data": "^6.3.0",
37
+ "@wordpress/data": "^8.3.0",
38
+ "@wordpress/deprecated": "^3.26.0",
39
+ "@wordpress/dom": "^3.26.0",
40
+ "@wordpress/element": "^5.3.0",
41
+ "@wordpress/experiments": "^0.8.0",
42
+ "@wordpress/hooks": "^3.26.0",
43
+ "@wordpress/i18n": "^4.26.0",
44
+ "@wordpress/icons": "^9.17.0",
45
+ "@wordpress/interface": "^5.3.0",
46
+ "@wordpress/keyboard-shortcuts": "^4.3.0",
47
+ "@wordpress/keycodes": "^3.26.0",
48
+ "@wordpress/media-utils": "^4.17.0",
49
+ "@wordpress/notices": "^3.26.0",
50
+ "@wordpress/plugins": "^5.3.0",
51
+ "@wordpress/preferences": "^3.3.0",
52
+ "@wordpress/reusable-blocks": "^4.3.0",
53
+ "@wordpress/url": "^3.27.0",
54
+ "@wordpress/widgets": "^3.3.0",
54
55
  "classnames": "^2.3.1"
55
56
  },
56
57
  "peerDependencies": {
@@ -60,5 +61,5 @@
60
61
  "publishConfig": {
61
62
  "access": "public"
62
63
  },
63
- "gitHead": "200bee7b06b15f6fa655e25b6ab69cbd6b49a357"
64
+ "gitHead": "cab6ebe2b4c5dbacfd753dcae4a2406559c4813c"
64
65
  }
@@ -17,51 +17,49 @@ function CopyButton( { text, children } ) {
17
17
  );
18
18
  }
19
19
 
20
+ function ErrorBoundaryWarning( { message, error } ) {
21
+ const actions = [
22
+ <CopyButton key="copy-error" text={ error.stack }>
23
+ { __( 'Copy Error' ) }
24
+ </CopyButton>,
25
+ ];
26
+
27
+ return (
28
+ <Warning className="edit-widgets-error-boundary" actions={ actions }>
29
+ { message }
30
+ </Warning>
31
+ );
32
+ }
33
+
20
34
  export default class ErrorBoundary extends Component {
21
35
  constructor() {
22
36
  super( ...arguments );
23
37
 
24
- this.reboot = this.reboot.bind( this );
25
-
26
38
  this.state = {
27
39
  error: null,
28
40
  };
29
41
  }
30
42
 
31
43
  componentDidCatch( error ) {
32
- this.setState( { error } );
33
-
34
44
  doAction( 'editor.ErrorBoundary.errorLogged', error );
35
45
  }
36
46
 
37
- reboot() {
38
- this.props.onError();
47
+ static getDerivedStateFromError( error ) {
48
+ return { error };
39
49
  }
40
50
 
41
51
  render() {
42
- const { error } = this.state;
43
- if ( ! error ) {
52
+ if ( ! this.state.error ) {
44
53
  return this.props.children;
45
54
  }
46
55
 
47
56
  return (
48
- <Warning
49
- className="edit-widgets-error-boundary"
50
- actions={ [
51
- <Button
52
- key="recovery"
53
- onClick={ this.reboot }
54
- variant="secondary"
55
- >
56
- { __( 'Attempt Recovery' ) }
57
- </Button>,
58
- <CopyButton key="copy-error" text={ error.stack }>
59
- { __( 'Copy Error' ) }
60
- </CopyButton>,
61
- ] }
62
- >
63
- { __( 'The editor has encountered an unexpected error.' ) }
64
- </Warning>
57
+ <ErrorBoundaryWarning
58
+ message={ __(
59
+ 'The editor has encountered an unexpected error.'
60
+ ) }
61
+ error={ this.state.error }
62
+ />
65
63
  );
66
64
  }
67
65
  }
@@ -101,7 +101,6 @@ export default function KeyboardShortcutHelpModal( {
101
101
  <Modal
102
102
  className="edit-widgets-keyboard-shortcut-help-modal"
103
103
  title={ __( 'Keyboard shortcuts' ) }
104
- closeLabel={ __( 'Close' ) }
105
104
  onRequestClose={ toggleModal }
106
105
  >
107
106
  <ShortcutSection
@@ -17,7 +17,7 @@ import Interface from './interface';
17
17
  import UnsavedChangesWarning from './unsaved-changes-warning';
18
18
  import WelcomeGuide from '../welcome-guide';
19
19
 
20
- function Layout( { blockEditorSettings, onError } ) {
20
+ function Layout( { blockEditorSettings } ) {
21
21
  const { createErrorNotice } = useDispatch( noticesStore );
22
22
 
23
23
  function onPluginAreaError( name ) {
@@ -33,7 +33,7 @@ function Layout( { blockEditorSettings, onError } ) {
33
33
  }
34
34
 
35
35
  return (
36
- <ErrorBoundary onError={ onError }>
36
+ <ErrorBoundary>
37
37
  <WidgetAreasBlockEditorProvider
38
38
  blockEditorSettings={ blockEditorSettings }
39
39
  >
@@ -32,7 +32,7 @@ export default function UnsavedChangesWarning() {
32
32
  *
33
33
  * @param {Event} event `beforeunload` event.
34
34
  *
35
- * @return {?string} Warning prompt message, if unsaved changes exist.
35
+ * @return {string | undefined} Warning prompt message, if unsaved changes exist.
36
36
  */
37
37
  const warnIfUnsavedChanges = ( event ) => {
38
38
  if ( isDirty ) {
@@ -38,6 +38,7 @@
38
38
  &:focus:not(:disabled) {
39
39
  position: relative;
40
40
  box-shadow: none;
41
+ outline: none;
41
42
  }
42
43
 
43
44
  // Tab indicator
@@ -62,6 +63,10 @@
62
63
  // Active.
63
64
  &.is-active::after {
64
65
  height: calc(1 * var(--wp-admin-border-width-focus));
66
+
67
+ // Windows high contrast mode.
68
+ outline: 2px solid transparent;
69
+ outline-offset: -1px;
65
70
  }
66
71
 
67
72
  // Focus.
@@ -85,6 +90,9 @@
85
90
 
86
91
  &:focus-visible::before {
87
92
  box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
93
+
94
+ // Windows high contrast mode.
95
+ outline: 2px solid transparent;
88
96
  }
89
97
  }
90
98
 
@@ -11,9 +11,9 @@ import {
11
11
  } from '@wordpress/core-data';
12
12
  import { useMemo } from '@wordpress/element';
13
13
  import {
14
- BlockEditorProvider,
15
14
  BlockEditorKeyboardShortcuts,
16
15
  CopyHandler,
16
+ experiments as blockEditorExperiments,
17
17
  } from '@wordpress/block-editor';
18
18
  import { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';
19
19
  import { ShortcutProvider } from '@wordpress/keyboard-shortcuts';
@@ -27,6 +27,9 @@ import { buildWidgetAreasPostId, KIND, POST_TYPE } from '../../store/utils';
27
27
  import useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';
28
28
  import { store as editWidgetsStore } from '../../store';
29
29
  import { ALLOW_REUSABLE_BLOCKS } from '../../constants';
30
+ import { unlock } from '../../experiments';
31
+
32
+ const { ExperimentalBlockEditorProvider } = unlock( blockEditorExperiments );
30
33
 
31
34
  export default function WidgetAreasBlockEditorProvider( {
32
35
  blockEditorSettings,
@@ -100,7 +103,7 @@ export default function WidgetAreasBlockEditorProvider( {
100
103
  <BlockEditorKeyboardShortcuts.Register />
101
104
  <KeyboardShortcuts.Register />
102
105
  <SlotFillProvider>
103
- <BlockEditorProvider
106
+ <ExperimentalBlockEditorProvider
104
107
  value={ blocks }
105
108
  onInput={ onInput }
106
109
  onChange={ onChange }
@@ -110,7 +113,7 @@ export default function WidgetAreasBlockEditorProvider( {
110
113
  >
111
114
  <CopyHandler>{ children }</CopyHandler>
112
115
  <ReusableBlocksMenuItems rootClientId={ widgetAreaId } />
113
- </BlockEditorProvider>
116
+ </ExperimentalBlockEditorProvider>
114
117
  </SlotFillProvider>
115
118
  </ShortcutProvider>
116
119
  );
@@ -0,0 +1,10 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/experiments';
5
+
6
+ export const { lock, unlock } =
7
+ __dangerousOptInToUnstableAPIsOnlyForCoreModules(
8
+ 'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',
9
+ '@wordpress/edit-widgets'
10
+ );