@wordpress/edit-widgets 3.1.22 → 4.0.1-next.f435e9e01b.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 +13 -1
- package/LICENSE.md +1 -1
- package/README.md +8 -2
- package/build/components/layout/index.js +19 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/interface.js +4 -2
- package/build/components/layout/interface.js.map +1 -1
- package/build/components/more-menu/index.js +8 -2
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/more-menu/tools-more-menu-group.js +37 -0
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -0
- package/build/components/secondary-sidebar/inserter-sidebar.js +15 -5
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +7 -5
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build-module/components/layout/index.js +16 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/interface.js +6 -4
- package/build-module/components/layout/interface.js.map +1 -1
- package/build-module/components/more-menu/index.js +7 -2
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/more-menu/tools-more-menu-group.js +27 -0
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -0
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +16 -7
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +7 -5
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +0 -5
- package/build-style/style.css +0 -5
- package/package.json +25 -29
- package/src/components/layout/index.js +18 -1
- package/src/components/layout/interface.js +7 -4
- package/src/components/layout/style.scss +0 -4
- package/src/components/more-menu/index.js +5 -1
- package/src/components/more-menu/tools-more-menu-group.js +21 -0
- package/src/components/secondary-sidebar/inserter-sidebar.js +19 -6
- package/src/components/secondary-sidebar/list-view-sidebar.js +12 -5
- package/src/index.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,11 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 4.0.0-next.0 (2022-02-23)
|
|
6
|
+
|
|
7
|
+
### Breaking Change
|
|
8
|
+
|
|
9
|
+
- The `GUTENBERG_PHASE` environment variable has been renamed to `IS_GUTENBERG_PLUGIN` and is now a boolean ([#38202](https://github.com/WordPress/gutenberg/pull/38202)).
|
|
10
|
+
|
|
11
|
+
### Bug Fix
|
|
12
|
+
|
|
13
|
+
- Removed unused `@wordpress/a11y`, `@wordpress/server-side-render`, `rememo` and `uuid` dependencies ([#38388](https://github.com/WordPress/gutenberg/pull/38388)).
|
|
14
|
+
|
|
15
|
+
## 3.2.0 (2022-01-27)
|
|
16
|
+
|
|
5
17
|
## 3.1.0 (2021-11-07)
|
|
6
18
|
|
|
7
19
|
### Enhancement
|
|
8
20
|
|
|
9
|
-
-
|
|
21
|
+
- Enable persistent List View in the widget editor [#35706](https://github.com/WordPress/gutenberg/pull/35706).
|
|
10
22
|
|
|
11
23
|
## 3.0.0 (2021-07-29)
|
|
12
24
|
|
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -18,8 +18,6 @@ npm install @wordpress/edit-widgets
|
|
|
18
18
|
|
|
19
19
|
_This package assumes that your code will run in an **ES2015+** environment. If you're using an environment that has limited or no support for such language features and APIs, you should include [the polyfill shipped in `@wordpress/babel-preset-default`](https://github.com/WordPress/gutenberg/tree/HEAD/packages/babel-preset-default#polyfill) in your code._
|
|
20
20
|
|
|
21
|
-
<br/><br/><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>
|
|
22
|
-
|
|
23
21
|
## How this works
|
|
24
22
|
|
|
25
23
|
The new Widgets screen in WordPress admin is another block editor, just like the Post editor or the experimental site editor. Hence it will be referred often as the Widgets editor.
|
|
@@ -39,3 +37,11 @@ In order to make the experience as seamless as possible for users, the following
|
|
|
39
37
|
- for every available widget, a variation of the widget block is registered so that the user can see and search by the exact name of what they need
|
|
40
38
|
- all widgets that have a block equivalent (a block that fulfills the same function) can be made not available as a widget block variation via a filter
|
|
41
39
|
- all core widgets that have a block equivalent are not available as a widget block variation
|
|
40
|
+
|
|
41
|
+
## Contributing to this package
|
|
42
|
+
|
|
43
|
+
This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/) and used by [WordPress](https://make.wordpress.org/core/) as well as other software projects.
|
|
44
|
+
|
|
45
|
+
To find out more about contributing to this package or Gutenberg as a whole, please read the project's main [contributor guide](https://github.com/WordPress/gutenberg/tree/HEAD/CONTRIBUTING.md).
|
|
46
|
+
|
|
47
|
+
<br /><br /><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>
|
|
@@ -9,10 +9,16 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
+
var _i18n = require("@wordpress/i18n");
|
|
13
|
+
|
|
12
14
|
var _components = require("@wordpress/components");
|
|
13
15
|
|
|
16
|
+
var _data = require("@wordpress/data");
|
|
17
|
+
|
|
14
18
|
var _plugins = require("@wordpress/plugins");
|
|
15
19
|
|
|
20
|
+
var _notices = require("@wordpress/notices");
|
|
21
|
+
|
|
16
22
|
var _errorBoundary = _interopRequireDefault(require("../error-boundary"));
|
|
17
23
|
|
|
18
24
|
var _widgetAreasBlockEditorProvider = _interopRequireDefault(require("../widget-areas-block-editor-provider"));
|
|
@@ -37,13 +43,25 @@ function Layout(_ref) {
|
|
|
37
43
|
blockEditorSettings,
|
|
38
44
|
onError
|
|
39
45
|
} = _ref;
|
|
46
|
+
const {
|
|
47
|
+
createErrorNotice
|
|
48
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
49
|
+
|
|
50
|
+
function onPluginAreaError(name) {
|
|
51
|
+
createErrorNotice((0, _i18n.sprintf)(
|
|
52
|
+
/* translators: %s: plugin name */
|
|
53
|
+
(0, _i18n.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name));
|
|
54
|
+
}
|
|
55
|
+
|
|
40
56
|
return (0, _element.createElement)(_errorBoundary.default, {
|
|
41
57
|
onError: onError
|
|
42
58
|
}, (0, _element.createElement)(_widgetAreasBlockEditorProvider.default, {
|
|
43
59
|
blockEditorSettings: blockEditorSettings
|
|
44
60
|
}, (0, _element.createElement)(_interface.default, {
|
|
45
61
|
blockEditorSettings: blockEditorSettings
|
|
46
|
-
}), (0, _element.createElement)(_sidebar.default, null), (0, _element.createElement)(_components.Popover.Slot, null), (0, _element.createElement)(_plugins.PluginArea,
|
|
62
|
+
}), (0, _element.createElement)(_sidebar.default, null), (0, _element.createElement)(_components.Popover.Slot, null), (0, _element.createElement)(_plugins.PluginArea, {
|
|
63
|
+
onError: onPluginAreaError
|
|
64
|
+
}), (0, _element.createElement)(_unsavedChangesWarning.default, null), (0, _element.createElement)(_welcomeGuide.default, null)));
|
|
47
65
|
}
|
|
48
66
|
|
|
49
67
|
var _default = Layout;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/layout/index.js"],"names":["Layout","blockEditorSettings","onError"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/layout/index.js"],"names":["Layout","blockEditorSettings","onError","createErrorNotice","noticesStore","onPluginAreaError","name"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAOA;AACA;AACA;AAQA,SAASA,MAAT,OAAoD;AAAA,MAAnC;AAAEC,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,GAAmC;AACnD,QAAM;AAAEC,IAAAA;AAAF,MAAwB,uBAAaC,cAAb,CAA9B;;AAEA,WAASC,iBAAT,CAA4BC,IAA5B,EAAmC;AAClCH,IAAAA,iBAAiB,CAChB;AACC;AACA,kBACC,kEADD,CAFD,EAKCG,IALD,CADgB,CAAjB;AASA;;AAED,SACC,4BAAC,sBAAD;AAAe,IAAA,OAAO,EAAGJ;AAAzB,KACC,4BAAC,uCAAD;AACC,IAAA,mBAAmB,EAAGD;AADvB,KAGC,4BAAC,kBAAD;AAAW,IAAA,mBAAmB,EAAGA;AAAjC,IAHD,EAIC,4BAAC,gBAAD,OAJD,EAKC,4BAAC,mBAAD,CAAS,IAAT,OALD,EAMC,4BAAC,mBAAD;AAAY,IAAA,OAAO,EAAGI;AAAtB,IAND,EAOC,4BAAC,8BAAD,OAPD,EAQC,4BAAC,qBAAD,OARD,CADD,CADD;AAcA;;eAEcL,M","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"]}
|
|
@@ -96,9 +96,11 @@ function Interface(_ref) {
|
|
|
96
96
|
sidebar: hasSidebarEnabled && (0, _element.createElement)(_interface.ComplementaryArea.Slot, {
|
|
97
97
|
scope: "core/edit-widgets"
|
|
98
98
|
}),
|
|
99
|
-
content: (0, _element.createElement)(_widgetAreasBlockEditorContent.default, {
|
|
99
|
+
content: (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_widgetAreasBlockEditorContent.default, {
|
|
100
100
|
blockEditorSettings: blockEditorSettings
|
|
101
|
-
}),
|
|
101
|
+
}), (0, _element.createElement)(_blockEditor.BlockStyles.Slot, {
|
|
102
|
+
scope: "core/block-inspector"
|
|
103
|
+
})),
|
|
102
104
|
footer: hasBlockBreadCrumbsEnabled && !isMobileViewport && (0, _element.createElement)("div", {
|
|
103
105
|
className: "edit-widgets-layout__footer"
|
|
104
106
|
}, (0, _element.createElement)(_blockEditor.BlockBreadcrumb, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/layout/interface.js"],"names":["interfaceLabels","header","body","sidebar","footer","Interface","blockEditorSettings","isMobileViewport","isHugeViewport","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","editWidgetsStore","hasBlockBreadCrumbsEnabled","hasSidebarEnabled","isInserterOpened","isListViewOpened","previousShortcut","nextShortcut","select","interfaceStore","getActiveComplementaryArea","name","isFeatureActive","keyboardShortcutsStore","getAllShortcutKeyCombinations","hasSecondarySidebar","previous","next"],"mappings":";;;;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAaA;AACA;AACA;AAMA,MAAMA,eAAe,GAAG;AACvB;AACAC,EAAAA,MAAM,EAAE,cAAI,iBAAJ,CAFe;;AAGvB;AACAC,EAAAA,IAAI,EAAE,cAAI,oBAAJ,CAJiB;;AAKvB;AACAC,EAAAA,OAAO,EAAE,cAAI,kBAAJ,CANc;;AAOvB;AACAC,EAAAA,MAAM,EAAE,cAAI,gBAAJ;AARe,CAAxB;;AAWA,SAASC,SAAT,OAA8C;AAAA,MAA1B;AAAEC,IAAAA;AAAF,GAA0B;AAC7C,QAAMC,gBAAgB,GAAG,+BAAkB,QAAlB,EAA4B,GAA5B,CAAzB;AACA,QAAMC,cAAc,GAAG,+BAAkB,MAAlB,EAA0B,IAA1B,CAAvB;AACA,QAAM;AACLC,IAAAA,mBADK;AAELC,IAAAA,mBAFK;AAGLC,IAAAA;AAHK,MAIF,uBAAaC,YAAb,CAJJ;AAKA,QAAM;AACLC,IAAAA,0BADK;AAELC,IAAAA,iBAFK;AAGLC,IAAAA,gBAHK;AAILC,IAAAA,gBAJK;AAKLC,IAAAA,gBALK;AAMLC,IAAAA;AANK,MAOF,qBACDC,MAAF,KAAgB;AACfL,IAAAA,iBAAiB,EAAE,CAAC,CAAEK,MAAM,CAC3BC,gBAD2B,CAAN,CAEpBC,0BAFoB,CAEQT,aAAiBU,IAFzB,CADP;AAIfP,IAAAA,gBAAgB,EAAE,CAAC,CAAEI,MAAM,CAAEP,YAAF,CAAN,CAA2BG,gBAA3B,EAJN;AAKfC,IAAAA,gBAAgB,EAAE,CAAC,CAAEG,MAAM,CAAEP,YAAF,CAAN,CAA2BI,gBAA3B,EALN;AAMfH,IAAAA,0BAA0B,EAAEM,MAAM,CACjCC,gBADiC,CAAN,CAE1BG,eAF0B,CAET,mBAFS,EAEY,sBAFZ,CANb;AASfN,IAAAA,gBAAgB,EAAEE,MAAM,CACvBK,wBADuB,CAAN,CAEhBC,6BAFgB,CAGjB,mCAHiB,CATH;AAcfP,IAAAA,YAAY,EAAEC,MAAM,CACnBK,wBADmB,CAAN,CAEZC,6BAFY,CAEmB,+BAFnB;AAdC,GAAhB,CADG,EAmBH,EAnBG,CAPJ,CAR6C,CAqC7C;;AACA,0BAAW,MAAM;AAChB,QAAKX,iBAAiB,IAAI,CAAEN,cAA5B,EAA6C;AAC5CC,MAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACAC,MAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACA;AACD,GALD,EAKG,CAAEI,iBAAF,EAAqBN,cAArB,CALH;AAOA,0BAAW,MAAM;AAChB,QAAK,CAAEO,gBAAgB,IAAIC,gBAAtB,KAA4C,CAAER,cAAnD,EAAoE;AACnEG,MAAAA,mBAAmB;AACnB;AACD,GAJD,EAIG,CAAEI,gBAAF,EAAoBC,gBAApB,EAAsCR,cAAtC,CAJH;AAMA,QAAMkB,mBAAmB,GAAGV,gBAAgB,IAAID,gBAAhD;AAEA,SACC,4BAAC,4BAAD;AACC,IAAA,MAAM,EAAGf,eADV;AAEC,IAAA,MAAM,EAAG,4BAAC,eAAD,OAFV;AAGC,IAAA,gBAAgB,EAAG0B,mBAAmB,IAAI,4BAAC,yBAAD,OAH3C;AAIC,IAAA,OAAO,EACNZ,iBAAiB,IAChB,4BAAC,4BAAD,CAAmB,IAAnB;AAAwB,MAAA,KAAK,EAAC;AAA9B,MANH;AASC,IAAA,OAAO,EACN,4BAAC,sCAAD;AACC,MAAA,mBAAmB,EAAGR;AADvB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/layout/interface.js"],"names":["interfaceLabels","header","body","sidebar","footer","Interface","blockEditorSettings","isMobileViewport","isHugeViewport","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","editWidgetsStore","hasBlockBreadCrumbsEnabled","hasSidebarEnabled","isInserterOpened","isListViewOpened","previousShortcut","nextShortcut","select","interfaceStore","getActiveComplementaryArea","name","isFeatureActive","keyboardShortcutsStore","getAllShortcutKeyCombinations","hasSecondarySidebar","previous","next"],"mappings":";;;;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAaA;AACA;AACA;AAMA,MAAMA,eAAe,GAAG;AACvB;AACAC,EAAAA,MAAM,EAAE,cAAI,iBAAJ,CAFe;;AAGvB;AACAC,EAAAA,IAAI,EAAE,cAAI,oBAAJ,CAJiB;;AAKvB;AACAC,EAAAA,OAAO,EAAE,cAAI,kBAAJ,CANc;;AAOvB;AACAC,EAAAA,MAAM,EAAE,cAAI,gBAAJ;AARe,CAAxB;;AAWA,SAASC,SAAT,OAA8C;AAAA,MAA1B;AAAEC,IAAAA;AAAF,GAA0B;AAC7C,QAAMC,gBAAgB,GAAG,+BAAkB,QAAlB,EAA4B,GAA5B,CAAzB;AACA,QAAMC,cAAc,GAAG,+BAAkB,MAAlB,EAA0B,IAA1B,CAAvB;AACA,QAAM;AACLC,IAAAA,mBADK;AAELC,IAAAA,mBAFK;AAGLC,IAAAA;AAHK,MAIF,uBAAaC,YAAb,CAJJ;AAKA,QAAM;AACLC,IAAAA,0BADK;AAELC,IAAAA,iBAFK;AAGLC,IAAAA,gBAHK;AAILC,IAAAA,gBAJK;AAKLC,IAAAA,gBALK;AAMLC,IAAAA;AANK,MAOF,qBACDC,MAAF,KAAgB;AACfL,IAAAA,iBAAiB,EAAE,CAAC,CAAEK,MAAM,CAC3BC,gBAD2B,CAAN,CAEpBC,0BAFoB,CAEQT,aAAiBU,IAFzB,CADP;AAIfP,IAAAA,gBAAgB,EAAE,CAAC,CAAEI,MAAM,CAAEP,YAAF,CAAN,CAA2BG,gBAA3B,EAJN;AAKfC,IAAAA,gBAAgB,EAAE,C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AA,KAAK,EAAC;AAAxB,MAJD,CAVF;AAiBC,IAAA,MAAM,EACLO,0BAA0B,IAC1B,CAAEN,gBADF,IAEC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,4BAAD;AAAiB,MAAA,aAAa,EAAG,cAAI,SAAJ;AAAjC,MADD,CApBH;AAyBC,IAAA,SAAS,EAAG;AACXoB,MAAAA,QAAQ,EAAEV,gBADC;AAEXW,MAAAA,IAAI,EAAEV;AAFK;AAzBb,IADD;AAgCA;;eAEcb,S","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockBreadcrumb, BlockStyles } 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 keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\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 {\n\t\tsetIsInserterOpened,\n\t\tsetIsListViewOpened,\n\t\tcloseGeneralSidebar,\n\t} = useDispatch( editWidgetsStore );\n\tconst {\n\t\thasBlockBreadCrumbsEnabled,\n\t\thasSidebarEnabled,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\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(\n\t\t\t\tinterfaceStore\n\t\t\t).isFeatureActive( 'core/edit-widgets', 'showBlockBreadcrumbs' ),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations(\n\t\t\t\t'core/edit-widgets/previous-region'\n\t\t\t),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-widgets/next-region' ),\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 hasSecondarySidebar = isListViewOpened || isInserterOpened;\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tlabels={ interfaceLabels }\n\t\t\theader={ <Header /> }\n\t\t\tsecondarySidebar={ hasSecondarySidebar && <SecondarySidebar /> }\n\t\t\tsidebar={\n\t\t\t\thasSidebarEnabled && (\n\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t)\n\t\t\t}\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\t<BlockStyles.Slot scope=\"core/block-inspector\" />\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\tshortcuts={ {\n\t\t\t\tprevious: previousShortcut,\n\t\t\t\tnext: nextShortcut,\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nexport default Interface;\n"]}
|
|
@@ -25,6 +25,8 @@ var _compose = require("@wordpress/compose");
|
|
|
25
25
|
|
|
26
26
|
var _keyboardShortcutHelpModal = _interopRequireDefault(require("../keyboard-shortcut-help-modal"));
|
|
27
27
|
|
|
28
|
+
var _toolsMoreMenuGroup = _interopRequireDefault(require("./tools-more-menu-group"));
|
|
29
|
+
|
|
28
30
|
/**
|
|
29
31
|
* WordPress dependencies
|
|
30
32
|
*/
|
|
@@ -39,7 +41,7 @@ function MoreMenu() {
|
|
|
39
41
|
|
|
40
42
|
(0, _keyboardShortcuts.useShortcut)('core/edit-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal);
|
|
41
43
|
const isLargeViewport = (0, _compose.useViewportMatch)('medium');
|
|
42
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_interface.MoreMenuDropdown, null,
|
|
44
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_interface.MoreMenuDropdown, null, onClose => (0, _element.createElement)(_element.Fragment, null, isLargeViewport && (0, _element.createElement)(_components.MenuGroup, {
|
|
43
45
|
label: (0, _i18n._x)('View', 'noun')
|
|
44
46
|
}, (0, _element.createElement)(_interface.MoreMenuFeatureToggle, {
|
|
45
47
|
scope: "core/edit-widgets",
|
|
@@ -69,7 +71,11 @@ function MoreMenu() {
|
|
|
69
71
|
as: "span"
|
|
70
72
|
},
|
|
71
73
|
/* translators: accessibility text */
|
|
72
|
-
(0, _i18n.__)('(opens in a new tab)')))
|
|
74
|
+
(0, _i18n.__)('(opens in a new tab)'))), (0, _element.createElement)(_toolsMoreMenuGroup.default.Slot, {
|
|
75
|
+
fillProps: {
|
|
76
|
+
onClose
|
|
77
|
+
}
|
|
78
|
+
})), (0, _element.createElement)(_components.MenuGroup, {
|
|
73
79
|
label: (0, _i18n.__)('Preferences')
|
|
74
80
|
}, (0, _element.createElement)(_interface.MoreMenuFeatureToggle, {
|
|
75
81
|
scope: "core/edit-widgets",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/more-menu/index.js"],"names":["MoreMenu","isKeyboardShortcutsModalActive","setIsKeyboardShortcutsModalVisible","toggleKeyboardShortcutsModal","isLargeViewport","displayShortcut","access","external"],"mappings":";;;;;;;;;AAIA;;AADA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/more-menu/index.js"],"names":["MoreMenu","isKeyboardShortcutsModalActive","setIsKeyboardShortcutsModalVisible","toggleKeyboardShortcutsModal","isLargeViewport","onClose","displayShortcut","access","external"],"mappings":";;;;;;;;;AAIA;;AADA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAUA;AACA;AACA;AAIe,SAASA,QAAT,GAAoB;AAClC,QAAM,CACLC,8BADK,EAELC,kCAFK,IAGF,uBAAU,KAAV,CAHJ;;AAIA,QAAMC,4BAA4B,GAAG,MACpCD,kCAAkC,CAAE,CAAED,8BAAJ,CADnC;;AAGA,sCACC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A;AAAF;AADb,IA/BD,CAnBD,EAsDC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,aAAJ;AAAnB,KACC,4BAAC,gCAAD;AACC,IAAA,KAAK,EAAC,mBADP;AAEC,IAAA,OAAO,EAAC,sBAFT;AAGC,IAAA,KAAK,EAAG,cACP,kCADO,CAHT;AAMC,IAAA,IAAI,EAAG,cACN,iEADM,CANR;AASC,IAAA,gBAAgB,EAAG,cAClB,4CADkB,CATpB;AAYC,IAAA,kBAAkB,EAAG,cACpB,8CADoB;AAZtB,IADD,EAiBC,4BAAC,gCAAD;AACC,IAAA,KAAK,EAAC,mBADP;AAEC,IAAA,OAAO,EAAC,aAFT;AAGC,IAAA,IAAI,EAAG,cACN,uCADM,CAHR;AAMC,IAAA,KAAK,EAAG,cAAI,kBAAJ;AANT,IAjBD,EAyBGD,eAAe,IAChB,4BAAC,gCAAD;AACC,IAAA,KAAK,EAAC,mBADP;AAEC,IAAA,OAAO,EAAC,sBAFT;AAGC,IAAA,KAAK,EAAG,cAAI,2BAAJ,CAHT;AAIC,IAAA,IAAI,EAAG,cACN,sDADM,CAJR;AAOC,IAAA,gBAAgB,EAAG,cAClB,qCADkB,CAPpB;AAUC,IAAA,kBAAkB,EAAG,cACpB,uCADoB;AAVtB,IA1BF,CAtDD,CAFF,CADD,EAsGC,4BAAC,kCAAD;AACC,IAAA,aAAa,EAAGH,8BADjB;AAEC,IAAA,WAAW,EAAGE;AAFf,IAtGD,CADD;AA6GA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuGroup, MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { external } from '@wordpress/icons';\nimport { MoreMenuDropdown, MoreMenuFeatureToggle } from '@wordpress/interface';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport ToolsMoreMenuGroup from './tools-more-menu-group';\n\nexport default function MoreMenu() {\n\tconst [\n\t\tisKeyboardShortcutsModalActive,\n\t\tsetIsKeyboardShortcutsModalVisible,\n\t] = useState( false );\n\tconst toggleKeyboardShortcutsModal = () =>\n\t\tsetIsKeyboardShortcutsModalVisible( ! isKeyboardShortcutsModalActive );\n\n\tuseShortcut(\n\t\t'core/edit-widgets/keyboard-shortcuts',\n\t\ttoggleKeyboardShortcutsModal\n\t);\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\treturn (\n\t\t<>\n\t\t\t<MoreMenuDropdown>\n\t\t\t\t{ ( onClose ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t\t<MoreMenuFeatureToggle\n\t\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\t\tfeature=\"fixedToolbar\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Top toolbar activated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Top toolbar deactivated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsKeyboardShortcutsModalVisible( true );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MoreMenuFeatureToggle\n\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\tfeature=\"welcomeGuide\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Welcome Guide' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/block-based-widgets-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<ToolsMoreMenuGroup.Slot\n\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Preferences' ) }>\n\t\t\t\t\t\t\t<MoreMenuFeatureToggle\n\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\tfeature=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Aids screen readers by stopping text caret from leaving blocks.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<MoreMenuFeatureToggle\n\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\tfeature=\"themeStyles\"\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Make the editor look like your theme.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Use theme styles' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t\t<MoreMenuFeatureToggle\n\t\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\t\tfeature=\"showBlockBreadcrumbs\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Display block breadcrumbs' ) }\n\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t'Shows block breadcrumbs at the bottom of the editor.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Display block breadcrumbs activated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Display block breadcrumbs deactivated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</MoreMenuDropdown>\n\t\t\t<KeyboardShortcutHelpModal\n\t\t\t\tisModalActive={ isKeyboardShortcutsModalActive }\n\t\t\t\ttoggleModal={ toggleKeyboardShortcutsModal }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _lodash = require("lodash");
|
|
11
|
+
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* External dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* WordPress dependencies
|
|
20
|
+
*/
|
|
21
|
+
const {
|
|
22
|
+
Fill: ToolsMoreMenuGroup,
|
|
23
|
+
Slot
|
|
24
|
+
} = (0, _components.createSlotFill)('EditWidgetsToolsMoreMenuGroup');
|
|
25
|
+
|
|
26
|
+
ToolsMoreMenuGroup.Slot = _ref => {
|
|
27
|
+
let {
|
|
28
|
+
fillProps
|
|
29
|
+
} = _ref;
|
|
30
|
+
return (0, _element.createElement)(Slot, {
|
|
31
|
+
fillProps: fillProps
|
|
32
|
+
}, fills => !(0, _lodash.isEmpty)(fills) && fills);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var _default = ToolsMoreMenuGroup;
|
|
36
|
+
exports.default = _default;
|
|
37
|
+
//# sourceMappingURL=tools-more-menu-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/more-menu/tools-more-menu-group.js"],"names":["Fill","ToolsMoreMenuGroup","Slot","fillProps","fills"],"mappings":";;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAM;AAAEA,EAAAA,IAAI,EAAEC,kBAAR;AAA4BC,EAAAA;AAA5B,IAAqC,gCAC1C,+BAD0C,CAA3C;;AAIAD,kBAAkB,CAACC,IAAnB,GAA0B;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SACzB,4BAAC,IAAD;AAAM,IAAA,SAAS,EAAGA;AAAlB,KACKC,KAAF,IAAa,CAAE,qBAASA,KAAT,CAAF,IAAsBA,KADtC,CADyB;AAAA,CAA1B;;eAMeH,kB","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst { Fill: ToolsMoreMenuGroup, Slot } = createSlotFill(\n\t'EditWidgetsToolsMoreMenuGroup'\n);\n\nToolsMoreMenuGroup.Slot = ( { fillProps } ) => (\n\t<Slot fillProps={ fillProps }>\n\t\t{ ( fills ) => ! isEmpty( fills ) && fills }\n\t</Slot>\n);\n\nexport default ToolsMoreMenuGroup;\n"]}
|
|
@@ -21,6 +21,8 @@ var _compose = require("@wordpress/compose");
|
|
|
21
21
|
|
|
22
22
|
var _data = require("@wordpress/data");
|
|
23
23
|
|
|
24
|
+
var _i18n = require("@wordpress/i18n");
|
|
25
|
+
|
|
24
26
|
var _useWidgetLibraryInsertionPoint = _interopRequireDefault(require("../../hooks/use-widget-library-insertion-point"));
|
|
25
27
|
|
|
26
28
|
var _store = require("../../store");
|
|
@@ -42,27 +44,35 @@ function InserterSidebar() {
|
|
|
42
44
|
setIsInserterOpened
|
|
43
45
|
} = (0, _data.useDispatch)(_store.store);
|
|
44
46
|
const closeInserter = (0, _element.useCallback)(() => {
|
|
45
|
-
return
|
|
47
|
+
return setIsInserterOpened(false);
|
|
46
48
|
}, [setIsInserterOpened]);
|
|
49
|
+
const TagName = !isMobileViewport ? _components.VisuallyHidden : 'div';
|
|
47
50
|
const [inserterDialogRef, inserterDialogProps] = (0, _compose.__experimentalUseDialog)({
|
|
48
|
-
onClose: closeInserter
|
|
51
|
+
onClose: closeInserter,
|
|
52
|
+
focusOnMount: null
|
|
49
53
|
});
|
|
54
|
+
const libraryRef = (0, _element.useRef)();
|
|
55
|
+
(0, _element.useEffect)(() => {
|
|
56
|
+
libraryRef.current.focusSearch();
|
|
57
|
+
}, []);
|
|
50
58
|
return (0, _element.createElement)("div", (0, _extends2.default)({
|
|
51
59
|
ref: inserterDialogRef
|
|
52
60
|
}, inserterDialogProps, {
|
|
53
61
|
className: "edit-widgets-layout__inserter-panel"
|
|
54
|
-
}), (0, _element.createElement)(
|
|
62
|
+
}), (0, _element.createElement)(TagName, {
|
|
55
63
|
className: "edit-widgets-layout__inserter-panel-header"
|
|
56
64
|
}, (0, _element.createElement)(_components.Button, {
|
|
57
65
|
icon: _icons.close,
|
|
58
|
-
onClick: closeInserter
|
|
66
|
+
onClick: closeInserter,
|
|
67
|
+
label: (0, _i18n.__)('Close block inserter')
|
|
59
68
|
})), (0, _element.createElement)("div", {
|
|
60
69
|
className: "edit-widgets-layout__inserter-panel-content"
|
|
61
70
|
}, (0, _element.createElement)(_blockEditor.__experimentalLibrary, {
|
|
62
71
|
showInserterHelpPanel: true,
|
|
63
72
|
shouldFocusBlock: isMobileViewport,
|
|
64
73
|
rootClientId: rootClientId,
|
|
65
|
-
__experimentalInsertionIndex: insertionIndex
|
|
74
|
+
__experimentalInsertionIndex: insertionIndex,
|
|
75
|
+
ref: libraryRef
|
|
66
76
|
})));
|
|
67
77
|
}
|
|
68
78
|
//# sourceMappingURL=inserter-sidebar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/inserter-sidebar.js"],"names":["InserterSidebar","isMobileViewport","rootClientId","insertionIndex","setIsInserterOpened","editWidgetsStore","closeInserter","inserterDialogRef","inserterDialogProps","onClose","close"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/inserter-sidebar.js"],"names":["InserterSidebar","isMobileViewport","rootClientId","insertionIndex","setIsInserterOpened","editWidgetsStore","closeInserter","TagName","VisuallyHidden","inserterDialogRef","inserterDialogProps","onClose","focusOnMount","libraryRef","current","focusSearch","close"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAKA;;AACA;;AAlBA;AACA;AACA;;AAYA;AACA;AACA;AAIe,SAASA,eAAT,GAA2B;AACzC,QAAMC,gBAAgB,GAAG,+BAAkB,QAAlB,EAA4B,GAA5B,CAAzB;AACA,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAAmC,8CAAzC;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAA0B,uBAAaC,YAAb,CAAhC;AAEA,QAAMC,aAAa,GAAG,0BAAa,MAAM;AACxC,WAAOF,mBAAmB,CAAE,KAAF,CAA1B;AACA,GAFqB,EAEnB,CAAEA,mBAAF,CAFmB,CAAtB;AAIA,QAAMG,OAAO,GAAG,CAAEN,gBAAF,GAAqBO,0BAArB,GAAsC,KAAtD;AACA,QAAM,CAAEC,iBAAF,EAAqBC,mBAArB,IAA6C,sCAAW;AAC7DC,IAAAA,OAAO,EAAEL,aADoD;AAE7DM,IAAAA,YAAY,EAAE;AAF+C,GAAX,CAAnD;AAKA,QAAMC,UAAU,GAAG,sBAAnB;AACA,0BAAW,MAAM;AAChBA,IAAAA,UAAU,CAACC,OAAX,CAAmBC,WAAnB;AACA,GAFD,EAEG,EAFH;AAIA,SACC;AACC,IAAA,GAAG,EAAGN;AADP,KAEMC,mBAFN;AAGC,IAAA,SAAS,EAAC;AAHX,MAKC,4BAAC,OAAD;AAAS,IAAA,SAAS,EAAC;AAAnB,KACC,4BAAC,kBAAD;AACC,IAAA,IAAI,EAAGM,YADR;AAEC,IAAA,OAAO,EAAGV,aAFX;AAGC,IAAA,KAAK,EAAG,cAAI,sBAAJ;AAHT,IADD,CALD,EAYC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kCAAD;AACC,IAAA,qBAAqB,MADtB;AAEC,IAAA,gBAAgB,EAAGL,gBAFpB;AAGC,IAAA,YAAY,EAAGC,YAHhB;AAIC,IAAA,4BAA4B,EAAGC,cAJhC;AAKC,IAAA,GAAG,EAAGU;AALP,IADD,CAZD,CADD;AAwBA","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, useEffect, 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: null,\n\t} );\n\n\tconst libraryRef = useRef();\n\tuseEffect( () => {\n\t\tlibraryRef.current.focusSearch();\n\t}, [] );\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\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__experimentalInsertionIndex={ insertionIndex }\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -45,7 +45,8 @@ function ListViewSidebar() {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
const focusOnMountRef = (0, _compose.useFocusOnMount)('firstElement');
|
|
48
|
-
const
|
|
48
|
+
const headerFocusReturnRef = (0, _compose.useFocusReturn)();
|
|
49
|
+
const contentFocusReturnRef = (0, _compose.useFocusReturn)();
|
|
49
50
|
|
|
50
51
|
function closeOnEscape(event) {
|
|
51
52
|
if (event.keyCode === _keycodes.ESCAPE && !event.defaultPrevented) {
|
|
@@ -62,16 +63,17 @@ function ListViewSidebar() {
|
|
|
62
63
|
className: "edit-widgets-editor__list-view-panel",
|
|
63
64
|
onKeyDown: closeOnEscape
|
|
64
65
|
}, (0, _element.createElement)("div", {
|
|
65
|
-
className: "edit-widgets-editor__list-view-panel-header"
|
|
66
|
+
className: "edit-widgets-editor__list-view-panel-header",
|
|
67
|
+
ref: headerFocusReturnRef
|
|
66
68
|
}, (0, _element.createElement)("strong", {
|
|
67
69
|
id: labelId
|
|
68
|
-
}, (0, _i18n.__)('List
|
|
70
|
+
}, (0, _i18n.__)('List View')), (0, _element.createElement)(_components.Button, {
|
|
69
71
|
icon: _icons.closeSmall,
|
|
70
|
-
label: (0, _i18n.__)('Close
|
|
72
|
+
label: (0, _i18n.__)('Close List View Sidebar'),
|
|
71
73
|
onClick: () => setIsListViewOpened(false)
|
|
72
74
|
})), (0, _element.createElement)("div", {
|
|
73
75
|
className: "edit-widgets-editor__list-view-panel-content",
|
|
74
|
-
ref: (0, _compose.useMergeRefs)([
|
|
76
|
+
ref: (0, _compose.useMergeRefs)([contentFocusReturnRef, focusOnMountRef])
|
|
75
77
|
}, (0, _element.createElement)(_blockEditor.__experimentalListView, {
|
|
76
78
|
onSelect: selectEditorBlock,
|
|
77
79
|
showNestedBlocks: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["ListViewSidebar","setIsListViewOpened","editWidgetsStore","clearSelectedBlock","selectBlock","blockEditorStore","selectEditorBlock","clientId","focusOnMountRef","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["ListViewSidebar","setIsListViewOpened","editWidgetsStore","clearSelectedBlock","selectBlock","blockEditorStore","selectEditorBlock","clientId","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","instanceId","labelId","closeSmall"],"mappings":";;;;;;;;;AAGA;;AAIA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AAtBA;AACA;AACA;;AAiBA;AACA;AACA;AAGe,SAASA,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0B,uBAAaC,YAAb,CAAhC;AAEA,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MAAsC,uBAAaC,kBAAb,CAA5C;;AACA,iBAAeC,iBAAf,CAAkCC,QAAlC,EAA6C;AAC5C,UAAMJ,kBAAkB,EAAxB;AACAC,IAAAA,WAAW,CAAEG,QAAF,EAAY,CAAC,CAAb,CAAX;AACA;;AAED,QAAMC,eAAe,GAAG,8BAAiB,cAAjB,CAAxB;AACA,QAAMC,oBAAoB,GAAG,8BAA7B;AACA,QAAMC,qBAAqB,GAAG,8BAA9B;;AACA,WAASC,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,QAAKA,KAAK,CAACC,OAAN,KAAkBC,gBAAlB,IAA4B,CAAEF,KAAK,CAACG,gBAAzC,EAA4D;AAC3DH,MAAAA,KAAK,CAACI,cAAN;AACAf,MAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACA;AACD;;AAED,QAAMgB,UAAU,GAAG,4BAAejB,eAAf,CAAnB;AACA,QAAMkB,OAAO,GAAI,8CAA8CD,UAAY,EAA3E;AAEA,SACC;AACA;AACC,yBAAkBC,OADnB;AAEC,MAAA,SAAS,EAAC,sCAFX;AAGC,MAAA,SAAS,EAAGP;AAHb,OAKC;AACC,MAAA,SAAS,EAAC,6CADX;AAEC,MAAA,GAAG,EAAGF;AAFP,OAIC;AAAQ,MAAA,EAAE,EAAGS;AAAb,OAAyB,cAAI,WAAJ,CAAzB,CAJD,EAKC,4BAAC,kBAAD;AACC,MAAA,IAAI,EAAGC,iBADR;AAEC,MAAA,KAAK,EAAG,cAAI,yBAAJ,CAFT;AAGC,MAAA,OAAO,EAAG,MAAMlB,mBAAmB,CAAE,KAAF;AAHpC,MALD,CALD,EAgBC;AACC,MAAA,SAAS,EAAC,8CADX;AAEC,MAAA,GAAG,EAAG,2BAAc,CACnBS,qBADmB,EAEnBF,eAFmB,CAAd;AAFP,OAOC,4BAAC,mCAAD;AACC,MAAA,QAAQ,EAAGF,iBADZ;AAEC,MAAA,gBAAgB,MAFjB;AAGC,MAAA,uCAAuC,MAHxC;AAIC,MAAA,sBAAsB,MAJvB;AAKC,MAAA,wCAAwC;AALzC,MAPD,CAhBD;AAFD;AAmCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalListView as ListView,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport {\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseInstanceId,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editWidgetsStore );\n\n\tconst { clearSelectedBlock, selectBlock } = useDispatch( blockEditorStore );\n\tasync function selectEditorBlock( clientId ) {\n\t\tawait clearSelectedBlock();\n\t\tselectBlock( clientId, -1 );\n\t}\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst headerFocusReturnRef = useFocusReturn();\n\tconst contentFocusReturnRef = useFocusReturn();\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}\n\n\tconst instanceId = useInstanceId( ListViewSidebar );\n\tconst labelId = `edit-widgets-editor__list-view-panel-label-${ instanceId }`;\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\taria-labelledby={ labelId }\n\t\t\tclassName=\"edit-widgets-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-header\"\n\t\t\t\tref={ headerFocusReturnRef }\n\t\t\t>\n\t\t\t\t<strong id={ labelId }>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close List View Sidebar' ) }\n\t\t\t\t\tonClick={ () => setIsListViewOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tcontentFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t<ListView\n\t\t\t\t\tonSelect={ selectEditorBlock }\n\t\t\t\t\tshowNestedBlocks\n\t\t\t\t\t__experimentalHideContainerBlockActions\n\t\t\t\t\t__experimentalFeatures\n\t\t\t\t\t__experimentalPersistentListViewFeatures\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
package/build/index.js
CHANGED
|
@@ -87,7 +87,7 @@ function initialize(id, settings) {
|
|
|
87
87
|
(0, _blockLibrary.registerCoreBlocks)(coreBlocks);
|
|
88
88
|
(0, _widgets.registerLegacyWidgetBlock)();
|
|
89
89
|
|
|
90
|
-
if (process.env.
|
|
90
|
+
if (process.env.IS_GUTENBERG_PLUGIN) {
|
|
91
91
|
(0, _blockLibrary.__experimentalRegisterExperimentalCoreBlocks)({
|
|
92
92
|
enableFSEBlocks: _constants.ENABLE_EXPERIMENTAL_FSE_BLOCKS
|
|
93
93
|
});
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/index.js"],"names":["disabledBlocks","ALLOW_REUSABLE_BLOCKS","reinitializeEditor","target","settings","reboot","bind","initialize","id","document","getElementById","coreBlocks","filter","block","includes","name","startsWith","interfaceStore","setFeatureDefaults","fixedToolbar","welcomeGuide","showBlockBreadcrumbs","themeStyles","blocksStore","__experimentalReapplyBlockTypeFilters","process","env","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/index.js"],"names":["disabledBlocks","ALLOW_REUSABLE_BLOCKS","reinitializeEditor","target","settings","reboot","bind","initialize","id","document","getElementById","coreBlocks","filter","block","includes","name","startsWith","interfaceStore","setFeatureDefaults","fixedToolbar","welcomeGuide","showBlockBreadcrumbs","themeStyles","blocksStore","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","ENABLE_EXPERIMENTAL_FSE_BLOCKS","registerBlock","widgetArea","__experimentalFetchLinkSuggestions","search","searchOptions","metadata"],"mappings":";;;;;;;;;;AAUA;;AAPA;;AAMA;;AAEA;;AAKA;;AACA;;AAKA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;;;;;AAhCA;AACA;AACA;;AAsBA;AACA;AACA;AAWA,MAAMA,cAAc,GAAG,CACtB,WADsB,EAEtB,eAFsB,EAGtB,oBAHsB,EAItB,IAAKC,mCAAwB,EAAxB,GAA6B,CAAE,YAAF,CAAlC,CAJsB,CAAvB;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,kBAAT,CAA6BC,MAA7B,EAAqCC,QAArC,EAAgD;AACtD,uCAAwBD,MAAxB;AACA,QAAME,MAAM,GAAGH,kBAAkB,CAACI,IAAnB,CAAyB,IAAzB,EAA+BH,MAA/B,EAAuCC,QAAvC,CAAf;AACA,uBACC,4BAAC,eAAD;AAAQ,IAAA,mBAAmB,EAAGA,QAA9B;AAAyC,IAAA,OAAO,EAAGC;AAAnD,IADD,EAECF,MAFD;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,UAAT,CAAqBC,EAArB,EAAyBJ,QAAzB,EAAoC;AAC1C,QAAMD,MAAM,GAAGM,QAAQ,CAACC,cAAT,CAAyBF,EAAzB,CAAf;AACA,QAAMH,MAAM,GAAGH,kBAAkB,CAACI,IAAnB,CAAyB,IAAzB,EAA+BH,MAA/B,EAAuCC,QAAvC,CAAf;AACA,QAAMO,UAAU,GAAG,iDAA8BC,MAA9B,CAAwCC,KAAF,IAAa;AACrE,WAAO,EACNb,cAAc,CAACc,QAAf,CAAyBD,KAAK,CAACE,IAA/B,KACAF,KAAK,CAACE,IAAN,CAAWC,UAAX,CAAuB,WAAvB,CADA,IAEAH,KAAK,CAACE,IAAN,CAAWC,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,iCAAmBpB,IAAnB,EAAyBX,QAAzB;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 interfaceStore } from '@wordpress/interface';\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( interfaceStore ).setFeatureDefaults( '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"]}
|
|
@@ -3,8 +3,11 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
6
7
|
import { Popover } from '@wordpress/components';
|
|
8
|
+
import { useDispatch } from '@wordpress/data';
|
|
7
9
|
import { PluginArea } from '@wordpress/plugins';
|
|
10
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
8
11
|
/**
|
|
9
12
|
* Internal dependencies
|
|
10
13
|
*/
|
|
@@ -21,13 +24,25 @@ function Layout(_ref) {
|
|
|
21
24
|
blockEditorSettings,
|
|
22
25
|
onError
|
|
23
26
|
} = _ref;
|
|
27
|
+
const {
|
|
28
|
+
createErrorNotice
|
|
29
|
+
} = useDispatch(noticesStore);
|
|
30
|
+
|
|
31
|
+
function onPluginAreaError(name) {
|
|
32
|
+
createErrorNotice(sprintf(
|
|
33
|
+
/* translators: %s: plugin name */
|
|
34
|
+
__('The "%s" plugin has encountered an error and cannot be rendered.'), name));
|
|
35
|
+
}
|
|
36
|
+
|
|
24
37
|
return createElement(ErrorBoundary, {
|
|
25
38
|
onError: onError
|
|
26
39
|
}, createElement(WidgetAreasBlockEditorProvider, {
|
|
27
40
|
blockEditorSettings: blockEditorSettings
|
|
28
41
|
}, createElement(Interface, {
|
|
29
42
|
blockEditorSettings: blockEditorSettings
|
|
30
|
-
}), createElement(Sidebar, null), createElement(Popover.Slot, null), createElement(PluginArea,
|
|
43
|
+
}), createElement(Sidebar, null), createElement(Popover.Slot, null), createElement(PluginArea, {
|
|
44
|
+
onError: onPluginAreaError
|
|
45
|
+
}), createElement(UnsavedChangesWarning, null), createElement(WelcomeGuide, null)));
|
|
31
46
|
}
|
|
32
47
|
|
|
33
48
|
export default Layout;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/layout/index.js"],"names":["Popover","PluginArea","ErrorBoundary","WidgetAreasBlockEditorProvider","Sidebar","Interface","UnsavedChangesWarning","WelcomeGuide","Layout","blockEditorSettings","onError"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,uBAAxB;AACA,SAASC,UAAT,QAA2B,oBAA3B;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,SACC,cAAC,aAAD;AAAe,IAAA,OAAO,
|
|
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,10 +1,10 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { useViewportMatch } from '@wordpress/compose';
|
|
7
|
-
import { BlockBreadcrumb } from '@wordpress/block-editor';
|
|
7
|
+
import { BlockBreadcrumb, BlockStyles } from '@wordpress/block-editor';
|
|
8
8
|
import { useEffect } from '@wordpress/element';
|
|
9
9
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
10
10
|
import { InterfaceSkeleton, ComplementaryArea, store as interfaceStore } from '@wordpress/interface';
|
|
@@ -78,9 +78,11 @@ function Interface(_ref) {
|
|
|
78
78
|
sidebar: hasSidebarEnabled && createElement(ComplementaryArea.Slot, {
|
|
79
79
|
scope: "core/edit-widgets"
|
|
80
80
|
}),
|
|
81
|
-
content: createElement(WidgetAreasBlockEditorContent, {
|
|
81
|
+
content: createElement(Fragment, null, createElement(WidgetAreasBlockEditorContent, {
|
|
82
82
|
blockEditorSettings: blockEditorSettings
|
|
83
|
-
}),
|
|
83
|
+
}), createElement(BlockStyles.Slot, {
|
|
84
|
+
scope: "core/block-inspector"
|
|
85
|
+
})),
|
|
84
86
|
footer: hasBlockBreadCrumbsEnabled && !isMobileViewport && createElement("div", {
|
|
85
87
|
className: "edit-widgets-layout__footer"
|
|
86
88
|
}, createElement(BlockBreadcrumb, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/layout/interface.js"],"names":["useViewportMatch","BlockBreadcrumb","useEffect","useDispatch","useSelect","InterfaceSkeleton","ComplementaryArea","store","interfaceStore","__","keyboardShortcutsStore","Header","WidgetAreasBlockEditorContent","editWidgetsStore","SecondarySidebar","interfaceLabels","header","body","sidebar","footer","Interface","blockEditorSettings","isMobileViewport","isHugeViewport","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","hasBlockBreadCrumbsEnabled","hasSidebarEnabled","isInserterOpened","isListViewOpened","previousShortcut","nextShortcut","select","getActiveComplementaryArea","name","isFeatureActive","getAllShortcutKeyCombinations","hasSecondarySidebar","previous","next"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,gBAAT,QAAiC,oBAAjC;AACA,SAASC,eAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/layout/interface.js"],"names":["useViewportMatch","BlockBreadcrumb","BlockStyles","useEffect","useDispatch","useSelect","InterfaceSkeleton","ComplementaryArea","store","interfaceStore","__","keyboardShortcutsStore","Header","WidgetAreasBlockEditorContent","editWidgetsStore","SecondarySidebar","interfaceLabels","header","body","sidebar","footer","Interface","blockEditorSettings","isMobileViewport","isHugeViewport","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","hasBlockBreadCrumbsEnabled","hasSidebarEnabled","isInserterOpened","isListViewOpened","previousShortcut","nextShortcut","select","getActiveComplementaryArea","name","isFeatureActive","getAllShortcutKeyCombinations","hasSecondarySidebar","previous","next"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,gBAAT,QAAiC,oBAAjC;AACA,SAASC,eAAT,EAA0BC,WAA1B,QAA6C,yBAA7C;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SACCC,iBADD,EAECC,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AAO,EACN,8BACC,cAAC,6BAAD;AACC,MAAA,mBAAmB,EAAGP;AADvB,MADD,EAIC,cAAC,WAAD,CAAa,IAAb;AAAkB,MAAA,KAAK,EAAC;AAAxB,MAJD,CAVF;AAiBC,IAAA,MAAM,EACLM,0BAA0B,IAC1B,CAAEL,gBADF,IAEC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,cAAC,eAAD;AAAiB,MAAA,aAAa,EAAGb,EAAE,CAAE,SAAF;AAAnC,MADD,CApBH;AAyBC,IAAA,SAAS,EAAG;AACX8B,MAAAA,QAAQ,EAAER,gBADC;AAEXS,MAAAA,IAAI,EAAER;AAFK;AAzBb,IADD;AAgCA;;AAED,eAAeZ,SAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockBreadcrumb, BlockStyles } 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 keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\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 {\n\t\tsetIsInserterOpened,\n\t\tsetIsListViewOpened,\n\t\tcloseGeneralSidebar,\n\t} = useDispatch( editWidgetsStore );\n\tconst {\n\t\thasBlockBreadCrumbsEnabled,\n\t\thasSidebarEnabled,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\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(\n\t\t\t\tinterfaceStore\n\t\t\t).isFeatureActive( 'core/edit-widgets', 'showBlockBreadcrumbs' ),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations(\n\t\t\t\t'core/edit-widgets/previous-region'\n\t\t\t),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-widgets/next-region' ),\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 hasSecondarySidebar = isListViewOpened || isInserterOpened;\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tlabels={ interfaceLabels }\n\t\t\theader={ <Header /> }\n\t\t\tsecondarySidebar={ hasSecondarySidebar && <SecondarySidebar /> }\n\t\t\tsidebar={\n\t\t\t\thasSidebarEnabled && (\n\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t)\n\t\t\t}\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\t<BlockStyles.Slot scope=\"core/block-inspector\" />\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\tshortcuts={ {\n\t\t\t\tprevious: previousShortcut,\n\t\t\t\tnext: nextShortcut,\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nexport default Interface;\n"]}
|