@wordpress/edit-widgets 5.2.0 → 5.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/error-boundary/index.js +24 -22
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/layout/index.js +2 -5
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/unsaved-changes-warning.js +1 -1
- package/build/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build/components/widget-areas-block-editor-provider/index.js +7 -1
- package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build/experiments.js +19 -0
- package/build/experiments.js.map +1 -0
- package/build/index.js +24 -25
- package/build/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +24 -22
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/layout/index.js +2 -5
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/unsaved-changes-warning.js +1 -1
- package/build-module/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-provider/index.js +6 -2
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build-module/experiments.js +9 -0
- package/build-module/experiments.js.map +1 -0
- package/build-module/index.js +19 -24
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +4 -0
- package/build-style/style.css +4 -0
- package/package.json +27 -26
- package/src/components/error-boundary/index.js +23 -25
- package/src/components/keyboard-shortcut-help-modal/index.js +0 -1
- package/src/components/layout/index.js +2 -2
- package/src/components/layout/unsaved-changes-warning.js +1 -1
- package/src/components/sidebar/style.scss +8 -0
- package/src/components/widget-areas-block-editor-provider/index.js +6 -3
- package/src/experiments.js +10 -0
- package/src/index.js +21 -24
package/CHANGELOG.md
CHANGED
|
@@ -32,46 +32,48 @@ function CopyButton(_ref) {
|
|
|
32
32
|
}, children);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
function ErrorBoundaryWarning(_ref2) {
|
|
36
|
+
let {
|
|
37
|
+
message,
|
|
38
|
+
error
|
|
39
|
+
} = _ref2;
|
|
40
|
+
const actions = [(0, _element.createElement)(CopyButton, {
|
|
41
|
+
key: "copy-error",
|
|
42
|
+
text: error.stack
|
|
43
|
+
}, (0, _i18n.__)('Copy Error'))];
|
|
44
|
+
return (0, _element.createElement)(_blockEditor.Warning, {
|
|
45
|
+
className: "edit-widgets-error-boundary",
|
|
46
|
+
actions: actions
|
|
47
|
+
}, message);
|
|
48
|
+
}
|
|
49
|
+
|
|
35
50
|
class ErrorBoundary extends _element.Component {
|
|
36
51
|
constructor() {
|
|
37
52
|
super(...arguments);
|
|
38
|
-
this.reboot = this.reboot.bind(this);
|
|
39
53
|
this.state = {
|
|
40
54
|
error: null
|
|
41
55
|
};
|
|
42
56
|
}
|
|
43
57
|
|
|
44
58
|
componentDidCatch(error) {
|
|
45
|
-
this.setState({
|
|
46
|
-
error
|
|
47
|
-
});
|
|
48
59
|
(0, _hooks.doAction)('editor.ErrorBoundary.errorLogged', error);
|
|
49
60
|
}
|
|
50
61
|
|
|
51
|
-
|
|
52
|
-
|
|
62
|
+
static getDerivedStateFromError(error) {
|
|
63
|
+
return {
|
|
64
|
+
error
|
|
65
|
+
};
|
|
53
66
|
}
|
|
54
67
|
|
|
55
68
|
render() {
|
|
56
|
-
|
|
57
|
-
error
|
|
58
|
-
} = this.state;
|
|
59
|
-
|
|
60
|
-
if (!error) {
|
|
69
|
+
if (!this.state.error) {
|
|
61
70
|
return this.props.children;
|
|
62
71
|
}
|
|
63
72
|
|
|
64
|
-
return (0, _element.createElement)(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
onClick: this.reboot,
|
|
69
|
-
variant: "secondary"
|
|
70
|
-
}, (0, _i18n.__)('Attempt Recovery')), (0, _element.createElement)(CopyButton, {
|
|
71
|
-
key: "copy-error",
|
|
72
|
-
text: error.stack
|
|
73
|
-
}, (0, _i18n.__)('Copy Error'))]
|
|
74
|
-
}, (0, _i18n.__)('The editor has encountered an unexpected error.'));
|
|
73
|
+
return (0, _element.createElement)(ErrorBoundaryWarning, {
|
|
74
|
+
message: (0, _i18n.__)('The editor has encountered an unexpected error.'),
|
|
75
|
+
error: this.state.error
|
|
76
|
+
});
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/error-boundary/index.js"],"names":["CopyButton","text","children","ref","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/error-boundary/index.js"],"names":["CopyButton","text","children","ref","ErrorBoundaryWarning","message","error","actions","stack","ErrorBoundary","Component","constructor","arguments","state","componentDidCatch","getDerivedStateFromError","render","props"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AARA;AACA;AACA;AAQA,SAASA,UAAT,OAA0C;AAAA,MAArB;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAqB;AACzC,QAAMC,GAAG,GAAG,iCAAoBF,IAApB,CAAZ;AACA,SACC,4BAAC,kBAAD;AAAQ,IAAA,OAAO,EAAC,WAAhB;AAA4B,IAAA,GAAG,EAAGE;AAAlC,KACGD,QADH,CADD;AAKA;;AAED,SAASE,oBAAT,QAAoD;AAAA,MAArB;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,GAAqB;AACnD,QAAMC,OAAO,GAAG,CACf,4BAAC,UAAD;AAAY,IAAA,GAAG,EAAC,YAAhB;AAA6B,IAAA,IAAI,EAAGD,KAAK,CAACE;AAA1C,KACG,cAAI,YAAJ,CADH,CADe,CAAhB;AAMA,SACC,4BAAC,oBAAD;AAAS,IAAA,SAAS,EAAC,6BAAnB;AAAiD,IAAA,OAAO,EAAGD;AAA3D,KACGF,OADH,CADD;AAKA;;AAEc,MAAMI,aAAN,SAA4BC,kBAA5B,CAAsC;AACpDC,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AAEA,SAAKC,KAAL,GAAa;AACZP,MAAAA,KAAK,EAAE;AADK,KAAb;AAGA;;AAEDQ,EAAAA,iBAAiB,CAAER,KAAF,EAAU;AAC1B,yBAAU,kCAAV,EAA8CA,KAA9C;AACA;;AAE8B,SAAxBS,wBAAwB,CAAET,KAAF,EAAU;AACxC,WAAO;AAAEA,MAAAA;AAAF,KAAP;AACA;;AAEDU,EAAAA,MAAM,GAAG;AACR,QAAK,CAAE,KAAKH,KAAL,CAAWP,KAAlB,EAA0B;AACzB,aAAO,KAAKW,KAAL,CAAWf,QAAlB;AACA;;AAED,WACC,4BAAC,oBAAD;AACC,MAAA,OAAO,EAAG,cACT,iDADS,CADX;AAIC,MAAA,KAAK,EAAG,KAAKW,KAAL,CAAWP;AAJpB,MADD;AAQA;;AA9BmD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nfunction ErrorBoundaryWarning( { message, error } ) {\n\tconst actions = [\n\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t{ __( 'Copy Error' ) }\n\t\t</CopyButton>,\n\t];\n\n\treturn (\n\t\t<Warning className=\"edit-widgets-error-boundary\" actions={ actions }>\n\t\t\t{ message }\n\t\t</Warning>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error );\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\trender() {\n\t\tif ( ! this.state.error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t\t'The editor has encountered an unexpected error.'\n\t\t\t\t) }\n\t\t\t\terror={ this.state.error }\n\t\t\t/>\n\t\t);\n\t}\n}\n"]}
|
|
@@ -107,7 +107,6 @@ function KeyboardShortcutHelpModal(_ref4) {
|
|
|
107
107
|
return (0, _element.createElement)(_components.Modal, {
|
|
108
108
|
className: "edit-widgets-keyboard-shortcut-help-modal",
|
|
109
109
|
title: (0, _i18n.__)('Keyboard shortcuts'),
|
|
110
|
-
closeLabel: (0, _i18n.__)('Close'),
|
|
111
110
|
onRequestClose: toggleModal
|
|
112
111
|
}, (0, _element.createElement)(ShortcutSection, {
|
|
113
112
|
className: "edit-widgets-keyboard-shortcut-help-modal__main-shortcuts",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/keyboard-shortcut-help-modal/index.js"],"names":["ShortcutList","shortcuts","map","shortcut","index","ShortcutSection","title","className","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","keyboardShortcutsStore","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","bindGlobal","keyCombination","character","description","ariaLabel","textFormattingShortcuts"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AAKA,MAAMA,YAAY,GAAG;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA;AACpB;A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;AACH,sCAAa,sCAAb,EAAqDA,WAArD,EAAkE;AACjEC,IAAAA,UAAU,EAAE;AADqD,GAAlE;;AAIA,MAAK,CAAEF,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,iBAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,KAAK,EAAG,cAAI,oBAAJ,CAFT;AAGC,IAAA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/keyboard-shortcut-help-modal/index.js"],"names":["ShortcutList","shortcuts","map","shortcut","index","ShortcutSection","title","className","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","keyboardShortcutsStore","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","bindGlobal","keyCombination","character","description","ariaLabel","textFormattingShortcuts"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AAKA,MAAMA,YAAY,GAAG;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA;AACpB;AACD;AACA;AACA;;AACC;AACA;AACC,MAAA,SAAS,EAAC,0DADX;AAEC,MAAA,IAAI,EAAC;AAFN,OAIGA,SAAS,CAACC,GAAV,CAAe,CAAEC,QAAF,EAAYC,KAAZ,KAChB;AACC,MAAA,SAAS,EAAC,qDADX;AAEC,MAAA,GAAG,EAAGA;AAFP,OAIG,OAAOD,QAAP,KAAoB,QAApB,GACD,4BAAC,wBAAD;AAAiB,MAAA,IAAI,EAAGA;AAAxB,MADC,GAGD,4BAAC,iBAAD,EAAeA,QAAf,CAPF,CADC,CAJH;AAiBA;;AAvBoB;AAAA,CAArB;;AA0BA,MAAME,eAAe,GAAG;AAAA,MAAE;AAAEC,IAAAA,KAAF;AAASL,IAAAA,SAAT;AAAoBM,IAAAA;AAApB,GAAF;AAAA,SACvB;AACC,IAAA,SAAS,EAAG,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,CADT;AAEC,IAAA,YAAY,EAAC;AAFd,IAdD,EAmBC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,iBAAJ,CADT;AAEC,IAAA,YAAY,EAAC,OAFd;AAGC,IAAA,mBAAmB,EAAG,CACrB;AACCE,MAAAA,cAAc,EAAE;AAAEC,QAAAA,SAAS,EAAE;AAAb,OADjB;AAECC,MAAAA,WAAW,EAAE,cACZ,qDADY,CAFd;;AAKC;AACAC,MAAAA,SAAS,EAAE,cAAI,eAAJ;AANZ,KADqB;AAHvB,IAnBD,EAiCC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,iBAAJ,CADT;AAEC,IAAA,SAAS,EAAGC;AAFb,IAjCD,CADD;AAwCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { textFormattingShortcuts } from './config';\nimport Shortcut from './shortcut';\nimport DynamicShortcut from './dynamic-shortcut';\n\nconst ShortcutList = ( { shortcuts } ) => (\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t<ul\n\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__shortcut-list\"\n\t\trole=\"list\"\n\t>\n\t\t{ shortcuts.map( ( shortcut, index ) => (\n\t\t\t<li\n\t\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__shortcut\"\n\t\t\t\tkey={ index }\n\t\t\t>\n\t\t\t\t{ typeof shortcut === 'string' ? (\n\t\t\t\t\t<DynamicShortcut name={ shortcut } />\n\t\t\t\t) : (\n\t\t\t\t\t<Shortcut { ...shortcut } />\n\t\t\t\t) }\n\t\t\t</li>\n\t\t) ) }\n\t</ul>\n\t/* eslint-enable jsx-a11y/no-redundant-roles */\n);\n\nconst ShortcutSection = ( { title, shortcuts, className } ) => (\n\t<section\n\t\tclassName={ classnames(\n\t\t\t'edit-widgets-keyboard-shortcut-help-modal__section',\n\t\t\tclassName\n\t\t) }\n\t>\n\t\t{ !! title && (\n\t\t\t<h2 className=\"edit-widgets-keyboard-shortcut-help-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t) }\n\t\t<ShortcutList shortcuts={ shortcuts } />\n\t</section>\n);\n\nconst ShortcutCategorySection = ( {\n\ttitle,\n\tcategoryName,\n\tadditionalShortcuts = [],\n} ) => {\n\tconst categoryShortcuts = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( keyboardShortcutsStore ).getCategoryShortcuts(\n\t\t\t\tcategoryName\n\t\t\t);\n\t\t},\n\t\t[ categoryName ]\n\t);\n\n\treturn (\n\t\t<ShortcutSection\n\t\t\ttitle={ title }\n\t\t\tshortcuts={ categoryShortcuts.concat( additionalShortcuts ) }\n\t\t/>\n\t);\n};\n\nexport default function KeyboardShortcutHelpModal( {\n\tisModalActive,\n\ttoggleModal,\n} ) {\n\tuseShortcut( 'core/edit-widgets/keyboard-shortcuts', toggleModal, {\n\t\tbindGlobal: true,\n\t} );\n\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal\"\n\t\t\ttitle={ __( 'Keyboard shortcuts' ) }\n\t\t\tonRequestClose={ toggleModal }\n\t\t>\n\t\t\t<ShortcutSection\n\t\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__main-shortcuts\"\n\t\t\t\tshortcuts={ [ 'core/edit-widgets/keyboard-shortcuts' ] }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Global shortcuts' ) }\n\t\t\t\tcategoryName=\"global\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Selection shortcuts' ) }\n\t\t\t\tcategoryName=\"selection\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Block shortcuts' ) }\n\t\t\t\tcategoryName=\"block\"\n\t\t\t\tadditionalShortcuts={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tkeyCombination: { character: '/' },\n\t\t\t\t\t\tdescription: __(\n\t\t\t\t\t\t\t'Change the block type after adding a new paragraph.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t/* translators: The forward-slash character. e.g. '/'. */\n\t\t\t\t\t\tariaLabel: __( 'Forward-slash' ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t<ShortcutSection\n\t\t\t\ttitle={ __( 'Text formatting' ) }\n\t\t\t\tshortcuts={ textFormattingShortcuts }\n\t\t\t/>\n\t\t</Modal>\n\t);\n}\n"]}
|
|
@@ -40,8 +40,7 @@ var _welcomeGuide = _interopRequireDefault(require("../welcome-guide"));
|
|
|
40
40
|
*/
|
|
41
41
|
function Layout(_ref) {
|
|
42
42
|
let {
|
|
43
|
-
blockEditorSettings
|
|
44
|
-
onError
|
|
43
|
+
blockEditorSettings
|
|
45
44
|
} = _ref;
|
|
46
45
|
const {
|
|
47
46
|
createErrorNotice
|
|
@@ -53,9 +52,7 @@ function Layout(_ref) {
|
|
|
53
52
|
(0, _i18n.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name));
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
return (0, _element.createElement)(_errorBoundary.default, {
|
|
57
|
-
onError: onError
|
|
58
|
-
}, (0, _element.createElement)(_widgetAreasBlockEditorProvider.default, {
|
|
55
|
+
return (0, _element.createElement)(_errorBoundary.default, null, (0, _element.createElement)(_widgetAreasBlockEditorProvider.default, {
|
|
59
56
|
blockEditorSettings: blockEditorSettings
|
|
60
57
|
}, (0, _element.createElement)(_interface.default, {
|
|
61
58
|
blockEditorSettings: blockEditorSettings
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/layout/index.js"],"names":["Layout","blockEditorSettings","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/layout/index.js"],"names":["Layout","blockEditorSettings","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,OAA2C;AAAA,MAA1B;AAAEC,IAAAA;AAAF,GAA0B;AAC1C,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,QACC,4BAAC,uCAAD;AACC,IAAA,mBAAmB,EAAGJ;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,EAAGG;AAAtB,IAND,EAOC,4BAAC,8BAAD,OAPD,EAQC,4BAAC,qBAAD,OARD,CADD,CADD;AAcA;;eAEcJ,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 } ) {\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"]}
|
|
@@ -43,7 +43,7 @@ function UnsavedChangesWarning() {
|
|
|
43
43
|
*
|
|
44
44
|
* @param {Event} event `beforeunload` event.
|
|
45
45
|
*
|
|
46
|
-
* @return {
|
|
46
|
+
* @return {string | undefined} Warning prompt message, if unsaved changes exist.
|
|
47
47
|
*/
|
|
48
48
|
const warnIfUnsavedChanges = event => {
|
|
49
49
|
if (isDirty) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/layout/unsaved-changes-warning.js"],"names":["UnsavedChangesWarning","isDirty","select","getEditedWidgetAreas","editWidgetsStore","editedWidgetAreas","length","warnIfUnsavedChanges","event","returnValue","window","addEventListener","removeEventListener"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,qBAAT,GAAiC;AAC/C,QAAMC,OAAO,GAAG,qBAAaC,MAAF,IAAc;AACxC,UAAM;AAAEC,MAAAA;AAAF,QAA2BD,MAAM,CAAEE,YAAF,CAAvC;AACA,UAAMC,iBAAiB,GAAGF,oBAAoB,EAA9C;AAEA,WAAO,CAAAE,iBAAiB,SAAjB,IAAAA,iBAAiB,WAAjB,YAAAA,iBAAiB,CAAEC,MAAnB,IAA4B,CAAnC;AACA,GALe,EAKb,EALa,CAAhB;AAOA,0BAAW,MAAM;AAChB;AACF;AACA;AACA;AACA;AACA;AACA;AACE,UAAMC,oBAAoB,GAAKC,KAAF,IAAa;AACzC,UAAKP,OAAL,EAAe;AACdO,QAAAA,KAAK,CAACC,WAAN,GAAoB,cACnB,8DADmB,CAApB;AAGA,eAAOD,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,GAtBD,EAsBG,CAAEN,OAAF,CAtBH;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 {
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/layout/unsaved-changes-warning.js"],"names":["UnsavedChangesWarning","isDirty","select","getEditedWidgetAreas","editWidgetsStore","editedWidgetAreas","length","warnIfUnsavedChanges","event","returnValue","window","addEventListener","removeEventListener"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,qBAAT,GAAiC;AAC/C,QAAMC,OAAO,GAAG,qBAAaC,MAAF,IAAc;AACxC,UAAM;AAAEC,MAAAA;AAAF,QAA2BD,MAAM,CAAEE,YAAF,CAAvC;AACA,UAAMC,iBAAiB,GAAGF,oBAAoB,EAA9C;AAEA,WAAO,CAAAE,iBAAiB,SAAjB,IAAAA,iBAAiB,WAAjB,YAAAA,iBAAiB,CAAEC,MAAnB,IAA4B,CAAnC;AACA,GALe,EAKb,EALa,CAAhB;AAOA,0BAAW,MAAM;AAChB;AACF;AACA;AACA;AACA;AACA;AACA;AACE,UAAMC,oBAAoB,GAAKC,KAAF,IAAa;AACzC,UAAKP,OAAL,EAAe;AACdO,QAAAA,KAAK,CAACC,WAAN,GAAoB,cACnB,8DADmB,CAApB;AAGA,eAAOD,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,GAtBD,EAsBG,CAAEN,OAAF,CAtBH;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"]}
|
|
@@ -37,6 +37,8 @@ var _store = require("../../store");
|
|
|
37
37
|
|
|
38
38
|
var _constants = require("../../constants");
|
|
39
39
|
|
|
40
|
+
var _experiments = require("../../experiments");
|
|
41
|
+
|
|
40
42
|
/**
|
|
41
43
|
* WordPress dependencies
|
|
42
44
|
*/
|
|
@@ -44,6 +46,10 @@ var _constants = require("../../constants");
|
|
|
44
46
|
/**
|
|
45
47
|
* Internal dependencies
|
|
46
48
|
*/
|
|
49
|
+
const {
|
|
50
|
+
ExperimentalBlockEditorProvider
|
|
51
|
+
} = (0, _experiments.unlock)(_blockEditor.experiments);
|
|
52
|
+
|
|
47
53
|
function WidgetAreasBlockEditorProvider(_ref) {
|
|
48
54
|
let {
|
|
49
55
|
blockEditorSettings,
|
|
@@ -100,7 +106,7 @@ function WidgetAreasBlockEditorProvider(_ref) {
|
|
|
100
106
|
const [blocks, onInput, onChange] = (0, _coreData.useEntityBlockEditor)(_utils.KIND, _utils.POST_TYPE, {
|
|
101
107
|
id: (0, _utils.buildWidgetAreasPostId)()
|
|
102
108
|
});
|
|
103
|
-
return (0, _element.createElement)(_keyboardShortcuts.ShortcutProvider, null, (0, _element.createElement)(_blockEditor.BlockEditorKeyboardShortcuts.Register, null), (0, _element.createElement)(_keyboardShortcuts2.default.Register, null), (0, _element.createElement)(_components.SlotFillProvider, null, (0, _element.createElement)(
|
|
109
|
+
return (0, _element.createElement)(_keyboardShortcuts.ShortcutProvider, null, (0, _element.createElement)(_blockEditor.BlockEditorKeyboardShortcuts.Register, null), (0, _element.createElement)(_keyboardShortcuts2.default.Register, null), (0, _element.createElement)(_components.SlotFillProvider, null, (0, _element.createElement)(ExperimentalBlockEditorProvider, (0, _extends2.default)({
|
|
104
110
|
value: blocks,
|
|
105
111
|
onInput: onInput,
|
|
106
112
|
onChange: onChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-provider/index.js"],"names":["WidgetAreasBlockEditorProvider","blockEditorSettings","children","props","mediaPermissions","reusableBlocks","isFixedToolbarActive","keepCaretInsideBlock","select","widgetAreas","editWidgetsStore","getWidgetAreas","widgets","getWidgets","ALLOW_REUSABLE_BLOCKS","coreStore","getEntityRecords","preferencesStore","get","setIsInserterOpened","settings","mediaUploadBlockEditor","canCreate","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalReusableBlocks","hasFixedToolbar","mediaUpload","templateLock","__experimentalSetIsInserterOpened","widgetAreaId","blocks","onInput","onChange","KIND","POST_TYPE","id"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AACA;;AACA;;AACA;;AAMA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-provider/index.js"],"names":["ExperimentalBlockEditorProvider","blockEditorExperiments","WidgetAreasBlockEditorProvider","blockEditorSettings","children","props","mediaPermissions","reusableBlocks","isFixedToolbarActive","keepCaretInsideBlock","select","widgetAreas","editWidgetsStore","getWidgetAreas","widgets","getWidgets","ALLOW_REUSABLE_BLOCKS","coreStore","getEntityRecords","preferencesStore","get","setIsInserterOpened","settings","mediaUploadBlockEditor","canCreate","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalReusableBlocks","hasFixedToolbar","mediaUpload","templateLock","__experimentalSetIsInserterOpened","widgetAreaId","blocks","onInput","onChange","KIND","POST_TYPE","id"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AACA;;AACA;;AACA;;AAMA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA7BA;AACA;AACA;;AAmBA;AACA;AACA;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAsC,yBAAQC,wBAAR,CAA5C;;AAEe,SAASC,8BAAT,OAIX;AAAA,MAJoD;AACvDC,IAAAA,mBADuD;AAEvDC,IAAAA,QAFuD;AAGvD,OAAGC;AAHoD,GAIpD;AACH,QAAMC,gBAAgB,GAAG,sCAAwB,OAAxB,CAAzB;AACA,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,oBAAlB;AAAwCC,IAAAA;AAAxC,MACL,qBACGC,MAAF,KAAgB;AACfC,IAAAA,WAAW,EAAED,MAAM,CAAEE,YAAF,CAAN,CAA2BC,cAA3B,EADE;AAEfC,IAAAA,OAAO,EAAEJ,MAAM,CAAEE,YAAF,CAAN,CAA2BG,UAA3B,EAFM;AAGfR,IAAAA,cAAc,EAAES,mCACbN,MA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AAEA,QAAM,CAAEC,MAAF,EAAUC,OAAV,EAAmBC,QAAnB,IAAgC,oCACrCC,WADqC,EAErCC,gBAFqC,EAGrC;AAAEC,IAAAA,EAAE,EAAE;AAAN,GAHqC,CAAtC;AAMA,SACC,4BAAC,mCAAD,QACC,4BAAC,yCAAD,CAA8B,QAA9B,OADD,EAEC,4BAAC,2BAAD,CAAmB,QAAnB,OAFD,EAGC,4BAAC,4BAAD,QACC,4BAAC,+BAAD;AACC,IAAA,KAAK,EAAGL,MADT;AAEC,IAAA,OAAO,EAAGC,OAFX;AAGC,IAAA,QAAQ,EAAGC,QAHZ;AAIC,IAAA,QAAQ,EAAGhB,QAJZ;AAKC,IAAA,cAAc,EAAG;AALlB,KAMMjB,KANN,GAQC,4BAAC,wBAAD,QAAeD,QAAf,CARD,EASC,4BAAC,uCAAD;AAAyB,IAAA,YAAY,EAAG+B;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,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.unlock = exports.lock = void 0;
|
|
7
|
+
|
|
8
|
+
var _experiments = require("@wordpress/experiments");
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* WordPress dependencies
|
|
12
|
+
*/
|
|
13
|
+
const {
|
|
14
|
+
lock,
|
|
15
|
+
unlock
|
|
16
|
+
} = (0, _experiments.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/edit-widgets');
|
|
17
|
+
exports.unlock = unlock;
|
|
18
|
+
exports.lock = lock;
|
|
19
|
+
//# sourceMappingURL=experiments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/experiments.js"],"names":["lock","unlock"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAM;AAAEA,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZ,mEACC,8GADD,EAEC,yBAFD,CADM","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"]}
|
package/build/index.js
CHANGED
|
@@ -5,7 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.initialize =
|
|
8
|
+
exports.initialize = void 0;
|
|
9
|
+
exports.initializeEditor = initializeEditor;
|
|
9
10
|
exports.reinitializeEditor = reinitializeEditor;
|
|
10
11
|
|
|
11
12
|
var _element = require("@wordpress/element");
|
|
@@ -14,6 +15,8 @@ var _blocks = require("@wordpress/blocks");
|
|
|
14
15
|
|
|
15
16
|
var _data = require("@wordpress/data");
|
|
16
17
|
|
|
18
|
+
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
19
|
+
|
|
17
20
|
var _blockLibrary = require("@wordpress/block-library");
|
|
18
21
|
|
|
19
22
|
var _coreData = require("@wordpress/core-data");
|
|
@@ -44,23 +47,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
44
47
|
* Internal dependencies
|
|
45
48
|
*/
|
|
46
49
|
const disabledBlocks = ['core/more', 'core/freeform', 'core/template-part', ...(_constants.ALLOW_REUSABLE_BLOCKS ? [] : ['core/block'])];
|
|
47
|
-
/**
|
|
48
|
-
* Reinitializes the editor after the user chooses to reboot the editor after
|
|
49
|
-
* an unhandled error occurs, replacing previously mounted editor element using
|
|
50
|
-
* an initial state from prior to the crash.
|
|
51
|
-
*
|
|
52
|
-
* @param {Element} target DOM node in which editor is rendered.
|
|
53
|
-
* @param {?Object} settings Editor settings object.
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
function reinitializeEditor(target, settings) {
|
|
57
|
-
(0, _element.unmountComponentAtNode)(target);
|
|
58
|
-
const reboot = reinitializeEditor.bind(null, target, settings);
|
|
59
|
-
(0, _element.render)((0, _element.createElement)(_layout.default, {
|
|
60
|
-
blockEditorSettings: settings,
|
|
61
|
-
onError: reboot
|
|
62
|
-
}), target);
|
|
63
|
-
}
|
|
64
50
|
/**
|
|
65
51
|
* Initializes the block editor in the widgets screen.
|
|
66
52
|
*
|
|
@@ -68,10 +54,9 @@ function reinitializeEditor(target, settings) {
|
|
|
68
54
|
* @param {Object} settings Block editor settings.
|
|
69
55
|
*/
|
|
70
56
|
|
|
71
|
-
|
|
72
|
-
function initialize(id, settings) {
|
|
57
|
+
function initializeEditor(id, settings) {
|
|
73
58
|
const target = document.getElementById(id);
|
|
74
|
-
const
|
|
59
|
+
const root = (0, _element.createRoot)(target);
|
|
75
60
|
const coreBlocks = (0, _blockLibrary.__experimentalGetCoreBlocks)().filter(block => {
|
|
76
61
|
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'));
|
|
77
62
|
});
|
|
@@ -104,10 +89,24 @@ function initialize(id, settings) {
|
|
|
104
89
|
|
|
105
90
|
|
|
106
91
|
(0, _blocks.setFreeformContentHandlerName)('core/html');
|
|
107
|
-
|
|
108
|
-
blockEditorSettings: settings
|
|
109
|
-
|
|
110
|
-
|
|
92
|
+
root.render((0, _element.createElement)(_layout.default, {
|
|
93
|
+
blockEditorSettings: settings
|
|
94
|
+
}));
|
|
95
|
+
return root;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Compatibility export under the old `initialize` name.
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
const initialize = initializeEditor;
|
|
103
|
+
exports.initialize = initialize;
|
|
104
|
+
|
|
105
|
+
function reinitializeEditor() {
|
|
106
|
+
(0, _deprecated.default)('wp.editWidgets.reinitializeEditor', {
|
|
107
|
+
since: '6.2',
|
|
108
|
+
version: '6.3'
|
|
109
|
+
});
|
|
111
110
|
}
|
|
112
111
|
/**
|
|
113
112
|
* Function to register an individual block.
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/index.js"],"names":["disabledBlocks","ALLOW_REUSABLE_BLOCKS","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/index.js"],"names":["disabledBlocks","ALLOW_REUSABLE_BLOCKS","initializeEditor","id","settings","target","document","getElementById","root","coreBlocks","filter","block","includes","name","startsWith","preferencesStore","setDefaults","fixedToolbar","welcomeGuide","showBlockBreadcrumbs","themeStyles","blocksStore","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","ENABLE_EXPERIMENTAL_FSE_BLOCKS","registerBlock","widgetArea","__experimentalFetchLinkSuggestions","search","searchOptions","render","initialize","reinitializeEditor","since","version","metadata"],"mappings":";;;;;;;;;;;AAWA;;AARA;;AAMA;;AACA;;AAEA;;AAKA;;AACA;;AAKA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;;;;;AAjCA;AACA;AACA;;AAuBA;AACA;AACA;AAWA,MAAMA,cAAc,GAAG,CACtB,WADsB,EAEtB,eAFsB,EAGtB,oBAHsB,EAItB,IAAKC,mCAAwB,EAAxB,GAA6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;AACA;AACA;AACA;;;AACA,6CAA+B,WAA/B;AAEAI,EAAAA,IAAI,CAACyB,MAAL,CAAa,4BAAC,eAAD;AAAQ,IAAA,mBAAmB,EAAG7B;AAA9B,IAAb;AAEA,SAAOI,IAAP;AACA;AAED;AACA;AACA;;;AACO,MAAM0B,UAAU,GAAGhC,gBAAnB;;;AAEA,SAASiC,kBAAT,GAA8B;AACpC,2BAAY,mCAAZ,EAAiD;AAChDC,IAAAA,KAAK,EAAE,KADyC;AAEhDC,IAAAA,OAAO,EAAE;AAFuC,GAAjD;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMT,aAAa,GAAKjB,KAAF,IAAa;AAClC,MAAK,CAAEA,KAAP,EAAe;AACd;AACA;;AACD,QAAM;AAAE2B,IAAAA,QAAF;AAAYlC,IAAAA,QAAZ;AAAsBS,IAAAA;AAAtB,MAA+BF,KAArC;;AACA,MAAK2B,QAAL,EAAgB;AACf,+DAA+C;AAAE,OAAEzB,IAAF,GAAUyB;AAAZ,KAA/C;AACA;;AACD,iCAAmBzB,IAAnB,EAAyBT,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 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"]}
|
|
@@ -22,46 +22,48 @@ function CopyButton(_ref) {
|
|
|
22
22
|
}, children);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
function ErrorBoundaryWarning(_ref2) {
|
|
26
|
+
let {
|
|
27
|
+
message,
|
|
28
|
+
error
|
|
29
|
+
} = _ref2;
|
|
30
|
+
const actions = [createElement(CopyButton, {
|
|
31
|
+
key: "copy-error",
|
|
32
|
+
text: error.stack
|
|
33
|
+
}, __('Copy Error'))];
|
|
34
|
+
return createElement(Warning, {
|
|
35
|
+
className: "edit-widgets-error-boundary",
|
|
36
|
+
actions: actions
|
|
37
|
+
}, message);
|
|
38
|
+
}
|
|
39
|
+
|
|
25
40
|
export default class ErrorBoundary extends Component {
|
|
26
41
|
constructor() {
|
|
27
42
|
super(...arguments);
|
|
28
|
-
this.reboot = this.reboot.bind(this);
|
|
29
43
|
this.state = {
|
|
30
44
|
error: null
|
|
31
45
|
};
|
|
32
46
|
}
|
|
33
47
|
|
|
34
48
|
componentDidCatch(error) {
|
|
35
|
-
this.setState({
|
|
36
|
-
error
|
|
37
|
-
});
|
|
38
49
|
doAction('editor.ErrorBoundary.errorLogged', error);
|
|
39
50
|
}
|
|
40
51
|
|
|
41
|
-
|
|
42
|
-
|
|
52
|
+
static getDerivedStateFromError(error) {
|
|
53
|
+
return {
|
|
54
|
+
error
|
|
55
|
+
};
|
|
43
56
|
}
|
|
44
57
|
|
|
45
58
|
render() {
|
|
46
|
-
|
|
47
|
-
error
|
|
48
|
-
} = this.state;
|
|
49
|
-
|
|
50
|
-
if (!error) {
|
|
59
|
+
if (!this.state.error) {
|
|
51
60
|
return this.props.children;
|
|
52
61
|
}
|
|
53
62
|
|
|
54
|
-
return createElement(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
onClick: this.reboot,
|
|
59
|
-
variant: "secondary"
|
|
60
|
-
}, __('Attempt Recovery')), createElement(CopyButton, {
|
|
61
|
-
key: "copy-error",
|
|
62
|
-
text: error.stack
|
|
63
|
-
}, __('Copy Error'))]
|
|
64
|
-
}, __('The editor has encountered an unexpected error.'));
|
|
63
|
+
return createElement(ErrorBoundaryWarning, {
|
|
64
|
+
message: __('The editor has encountered an unexpected error.'),
|
|
65
|
+
error: this.state.error
|
|
66
|
+
});
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/error-boundary/index.js"],"names":["Component","__","Button","Warning","useCopyToClipboard","doAction","CopyButton","text","children","ref","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/error-boundary/index.js"],"names":["Component","__","Button","Warning","useCopyToClipboard","doAction","CopyButton","text","children","ref","ErrorBoundaryWarning","message","error","actions","stack","ErrorBoundary","constructor","arguments","state","componentDidCatch","getDerivedStateFromError","render","props"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,OAAT,QAAwB,yBAAxB;AACA,SAASC,kBAAT,QAAmC,oBA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B,KAAL,CAAWN;AAJpB,MADD;AAQA;;AA9BmD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nfunction ErrorBoundaryWarning( { message, error } ) {\n\tconst actions = [\n\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t{ __( 'Copy Error' ) }\n\t\t</CopyButton>,\n\t];\n\n\treturn (\n\t\t<Warning className=\"edit-widgets-error-boundary\" actions={ actions }>\n\t\t\t{ message }\n\t\t</Warning>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error );\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\trender() {\n\t\tif ( ! this.state.error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t\t'The editor has encountered an unexpected error.'\n\t\t\t\t) }\n\t\t\t\terror={ this.state.error }\n\t\t\t/>\n\t\t);\n\t}\n}\n"]}
|
|
@@ -91,7 +91,6 @@ export default function KeyboardShortcutHelpModal(_ref4) {
|
|
|
91
91
|
return createElement(Modal, {
|
|
92
92
|
className: "edit-widgets-keyboard-shortcut-help-modal",
|
|
93
93
|
title: __('Keyboard shortcuts'),
|
|
94
|
-
closeLabel: __('Close'),
|
|
95
94
|
onRequestClose: toggleModal
|
|
96
95
|
}, createElement(ShortcutSection, {
|
|
97
96
|
className: "edit-widgets-keyboard-shortcut-help-modal__main-shortcuts",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/keyboard-shortcut-help-modal/index.js"],"names":["classnames","Modal","__","useShortcut","store","keyboardShortcutsStore","useSelect","textFormattingShortcuts","Shortcut","DynamicShortcut","ShortcutList","shortcuts","map","shortcut","index","ShortcutSection","title","className","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","bindGlobal","keyCombination","character","description","ariaLabel"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAT,QAAsB,uBAAtB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,WADD,EAECC,KAAK,IAAIC,sBAFV,QAGO,+BAHP;AAIA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,uBAAT,QAAwC,UAAxC;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,eAAP,MAA4B,oBAA5B;;AAEA,MAAMC,YAAY,GAAG;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA;AACpB;AACD;AACA;AACA;;AACC;AACA;AACC,MAAA,SAAS,EAAC,0DADX;AAEC,MAAA,IAAI,EAAC;AAFN,OAIGA,SAAS,CAACC,GAAV,CAAe,CAAEC,QAAF,EAAYC,KAAZ,KAChB;AACC,MAAA,SAAS,EAAC,qDADX;AAEC,MAAA,GAAG,EAAGA;AAFP,OAIG,OAAOD,QAAP,KAAoB,QAApB,GACD,cAAC,eAAD;AAAiB,MAAA,IAAI,EAAGA;AAAxB,MADC,GAGD,cAAC,QAAD,EAAeA,QAAf,CAPF,CADC,CAJH;AAiBA;;AAvBoB;AAAA,CAArB;;AA0BA,MAAME,eAAe,GAAG;AAAA,MAAE;AAAEC,IAAAA,KAAF;AAASL,IAAAA,SAAT;AAAoBM,IAAAA;AAApB,GAAF;AAAA,SACvB;AACC,IAAA,SAAS,EAAGjB,UAAU,CACrB,oDADqB,EAErBiB,SAFqB;AADvB,KAMG,CAAC,CAAED,KAAH,IACD;AAAI,IAAA,SAAS,EAAC;AAAd,KACGA,KADH,CAPF,EAWC,cAAC,YAAD;AAAc,IAAA,SAAS,EAAGL;AAA1B,IAXD,CADuB;AAAA,CAAxB;;AAgBA,MAAMO,uBAAuB,GAAG,SAIzB;AAAA,MAJ2B;AACjCF,IAAAA,KADiC;AAEjCG,IAAAA,YAFiC;AAGjCC,IAAAA,mBAAmB,GAAG;AAHW,GAI3B;AACN,QAAMC,iBAAiB,GAAGf,SAAS,CAChCgB,MAAF,IAAc;AACb,WAAOA,MAAM,CAAEjB,sBAAF,CAAN,CAAiCkB,oBAAjC,CACNJ,YADM,CAAP;AAGA,GALiC,EAMlC,CAAEA,YAAF,CANkC,CAAnC;AASA,SACC,cAAC,eAAD;AACC,IAAA,KAAK,EAAGH,KADT;AAEC,IAAA,SAAS,EAAGK,iBAAiB,CAACG,MAAlB,CAA0BJ,mBAA1B;AAFb,IADD;AAMA,CApBD;;AAsBA,eAAe,SAASK,yBAAT,QAGX;AAAA,MAH+C;AAClDC,IAAAA,aADkD;AAElDC,IAAAA;AAFkD,GAG/C;AACHxB,EAAAA,WAAW,CAAE,sCAAF,EAA0CwB,WAA1C,EAAuD;AACjEC,IAAAA,UAAU,EAAE;AADqD,GAAvD,CAAX;;AAIA,MAAK,CAAEF,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,KAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,KAAK,EAAGxB,EAAE,CAAE,oBAAF,CAFX;AAGC,IAAA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/keyboard-shortcut-help-modal/index.js"],"names":["classnames","Modal","__","useShortcut","store","keyboardShortcutsStore","useSelect","textFormattingShortcuts","Shortcut","DynamicShortcut","ShortcutList","shortcuts","map","shortcut","index","ShortcutSection","title","className","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","bindGlobal","keyCombination","character","description","ariaLabel"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAT,QAAsB,uBAAtB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,WADD,EAECC,KAAK,IAAIC,sBAFV,QAGO,+BAHP;AAIA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,uBAAT,QAAwC,UAAxC;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,eAAP,MAA4B,oBAA5B;;AAEA,MAAMC,YAAY,GAAG;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA;AACpB;AACD;AACA;AACA;;AACC;AACA;AACC,MAAA,SAAS,EAAC,0DADX;AAEC,MAAA,IAAI,EAAC;AAFN,OAIGA,SAAS,CAACC,GAAV,CAAe,CAAEC,QAAF,EAAYC,KAAZ,KAChB;AACC,MAAA,SAAS,EAAC,qDADX;AAEC,MAAA,GAAG,EAAGA;AAFP,OAIG,OAAOD,QAAP,KAAoB,QAApB,GACD,cAAC,eAAD;AAAiB,MAAA,IAAI,EAAGA;AAAxB,MADC,GAGD,cAAC,QAAD,EAAeA,QAAf,CAPF,CADC,CAJH;AAiBA;;AAvBoB;AAAA,CAArB;;AA0BA,MAAME,eAAe,GAAG;AAAA,MAAE;AAAEC,IAAAA,KAAF;AAASL,IAAAA,SAAT;AAAoBM,IAAAA;AAApB,GAAF;AAAA,SACvB;AACC,IAAA,SAAS,EAAGjB,UAAU,CACrB,oDADqB,EAErBiB,SAFqB;AADvB,KAMG,CAAC,CAAED,KAAH,IACD;AA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AEC,IAAA,YAAY,EAAC;AAFd,IAdD,EAmBC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGA,EAAE,CAAE,iBAAF,CADX;AAEC,IAAA,YAAY,EAAC,OAFd;AAGC,IAAA,mBAAmB,EAAG,CACrB;AACC2B,MAAAA,cAAc,EAAE;AAAEC,QAAAA,SAAS,EAAE;AAAb,OADjB;AAECC,MAAAA,WAAW,EAAE7B,EAAE,CACd,qDADc,CAFhB;;AAKC;AACA8B,MAAAA,SAAS,EAAE9B,EAAE,CAAE,eAAF;AANd,KADqB;AAHvB,IAnBD,EAiCC,cAAC,eAAD;AACC,IAAA,KAAK,EAAGA,EAAE,CAAE,iBAAF,CADX;AAEC,IAAA,SAAS,EAAGK;AAFb,IAjCD,CADD;AAwCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { textFormattingShortcuts } from './config';\nimport Shortcut from './shortcut';\nimport DynamicShortcut from './dynamic-shortcut';\n\nconst ShortcutList = ( { shortcuts } ) => (\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t<ul\n\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__shortcut-list\"\n\t\trole=\"list\"\n\t>\n\t\t{ shortcuts.map( ( shortcut, index ) => (\n\t\t\t<li\n\t\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__shortcut\"\n\t\t\t\tkey={ index }\n\t\t\t>\n\t\t\t\t{ typeof shortcut === 'string' ? (\n\t\t\t\t\t<DynamicShortcut name={ shortcut } />\n\t\t\t\t) : (\n\t\t\t\t\t<Shortcut { ...shortcut } />\n\t\t\t\t) }\n\t\t\t</li>\n\t\t) ) }\n\t</ul>\n\t/* eslint-enable jsx-a11y/no-redundant-roles */\n);\n\nconst ShortcutSection = ( { title, shortcuts, className } ) => (\n\t<section\n\t\tclassName={ classnames(\n\t\t\t'edit-widgets-keyboard-shortcut-help-modal__section',\n\t\t\tclassName\n\t\t) }\n\t>\n\t\t{ !! title && (\n\t\t\t<h2 className=\"edit-widgets-keyboard-shortcut-help-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t) }\n\t\t<ShortcutList shortcuts={ shortcuts } />\n\t</section>\n);\n\nconst ShortcutCategorySection = ( {\n\ttitle,\n\tcategoryName,\n\tadditionalShortcuts = [],\n} ) => {\n\tconst categoryShortcuts = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( keyboardShortcutsStore ).getCategoryShortcuts(\n\t\t\t\tcategoryName\n\t\t\t);\n\t\t},\n\t\t[ categoryName ]\n\t);\n\n\treturn (\n\t\t<ShortcutSection\n\t\t\ttitle={ title }\n\t\t\tshortcuts={ categoryShortcuts.concat( additionalShortcuts ) }\n\t\t/>\n\t);\n};\n\nexport default function KeyboardShortcutHelpModal( {\n\tisModalActive,\n\ttoggleModal,\n} ) {\n\tuseShortcut( 'core/edit-widgets/keyboard-shortcuts', toggleModal, {\n\t\tbindGlobal: true,\n\t} );\n\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal\"\n\t\t\ttitle={ __( 'Keyboard shortcuts' ) }\n\t\t\tonRequestClose={ toggleModal }\n\t\t>\n\t\t\t<ShortcutSection\n\t\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__main-shortcuts\"\n\t\t\t\tshortcuts={ [ 'core/edit-widgets/keyboard-shortcuts' ] }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Global shortcuts' ) }\n\t\t\t\tcategoryName=\"global\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Selection shortcuts' ) }\n\t\t\t\tcategoryName=\"selection\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Block shortcuts' ) }\n\t\t\t\tcategoryName=\"block\"\n\t\t\t\tadditionalShortcuts={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tkeyCombination: { character: '/' },\n\t\t\t\t\t\tdescription: __(\n\t\t\t\t\t\t\t'Change the block type after adding a new paragraph.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t/* translators: The forward-slash character. e.g. '/'. */\n\t\t\t\t\t\tariaLabel: __( 'Forward-slash' ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t<ShortcutSection\n\t\t\t\ttitle={ __( 'Text formatting' ) }\n\t\t\t\tshortcuts={ textFormattingShortcuts }\n\t\t\t/>\n\t\t</Modal>\n\t);\n}\n"]}
|
|
@@ -21,8 +21,7 @@ import WelcomeGuide from '../welcome-guide';
|
|
|
21
21
|
|
|
22
22
|
function Layout(_ref) {
|
|
23
23
|
let {
|
|
24
|
-
blockEditorSettings
|
|
25
|
-
onError
|
|
24
|
+
blockEditorSettings
|
|
26
25
|
} = _ref;
|
|
27
26
|
const {
|
|
28
27
|
createErrorNotice
|
|
@@ -34,9 +33,7 @@ function Layout(_ref) {
|
|
|
34
33
|
__('The "%s" plugin has encountered an error and cannot be rendered.'), name));
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
return createElement(ErrorBoundary, {
|
|
38
|
-
onError: onError
|
|
39
|
-
}, createElement(WidgetAreasBlockEditorProvider, {
|
|
36
|
+
return createElement(ErrorBoundary, null, createElement(WidgetAreasBlockEditorProvider, {
|
|
40
37
|
blockEditorSettings: blockEditorSettings
|
|
41
38
|
}, createElement(Interface, {
|
|
42
39
|
blockEditorSettings: blockEditorSettings
|
|
@@ -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","
|
|
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"]}
|