@wordpress/editor 13.19.2 → 13.20.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 +2 -0
- package/README.md +6 -6
- package/build/components/autocompleters/user.js +5 -4
- package/build/components/autocompleters/user.js.map +1 -1
- package/build/components/deprecated.js +3 -2
- package/build/components/deprecated.js.map +1 -1
- package/build/components/document-outline/index.js +11 -11
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.js +6 -6
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/editor-help/add-blocks.native.js +5 -5
- package/build/components/editor-help/add-blocks.native.js.map +1 -1
- package/build/components/editor-help/customize-blocks.native.js +5 -5
- package/build/components/editor-help/customize-blocks.native.js.map +1 -1
- package/build/components/editor-help/help-detail-navigation-screen.native.js +8 -7
- package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build/components/editor-help/help-get-support-button.native.js +3 -3
- package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build/components/editor-help/help-section-title.native.js +3 -3
- package/build/components/editor-help/help-section-title.native.js.map +1 -1
- package/build/components/editor-help/help-topic-row.native.js +3 -3
- package/build/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build/components/editor-help/icon-move-blocks.native.js +3 -3
- package/build/components/editor-help/icon-move-blocks.native.js.map +1 -1
- package/build/components/editor-help/index.native.js +19 -19
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-help/intro-to-blocks.native.js +15 -15
- package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build/components/editor-help/move-blocks.native.js +9 -9
- package/build/components/editor-help/move-blocks.native.js.map +1 -1
- package/build/components/editor-help/remove-blocks.native.js +4 -4
- package/build/components/editor-help/remove-blocks.native.js.map +1 -1
- package/build/components/editor-help/view-sections.native.js +8 -8
- package/build/components/editor-help/view-sections.native.js.map +1 -1
- package/build/components/editor-history/redo.js +3 -2
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +3 -2
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-notices/index.js +4 -4
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/editor-snackbars/index.js +2 -2
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js +3 -3
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js +4 -4
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/index.js +10 -9
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/error-boundary/index.js +5 -4
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +2 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js +2 -1
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/page-attributes/order.js +5 -4
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/parent.js +3 -2
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-author/check.js +2 -2
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/combobox.js +3 -2
- package/build/components/post-author/combobox.js.map +1 -1
- package/build/components/post-author/index.js +3 -3
- package/build/components/post-author/index.js.map +1 -1
- package/build/components/post-author/select.js +3 -2
- package/build/components/post-author/select.js.map +1 -1
- package/build/components/post-comments/index.js +2 -2
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-excerpt/check.js +2 -2
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/index.js +4 -4
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-featured-image/check.js +3 -3
- package/build/components/post-featured-image/check.js.map +1 -1
- package/build/components/post-featured-image/index.js +15 -14
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-format/check.js +2 -2
- package/build/components/post-format/check.js.map +1 -1
- package/build/components/post-format/index.js +5 -5
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-last-revision/check.js +2 -2
- package/build/components/post-last-revision/check.js.map +1 -1
- package/build/components/post-last-revision/index.js +2 -2
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +14 -13
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-pending-status/index.js +2 -2
- package/build/components/post-pending-status/index.js.map +1 -1
- package/build/components/post-pingbacks/index.js +2 -2
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-preview-button/index.js +8 -7
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +4 -3
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-panel/index.js +13 -12
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +5 -4
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +5 -5
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js +6 -5
- package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +9 -8
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js +15 -14
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js +15 -15
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-saved-state/index.js +5 -4
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/index.js +3 -2
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-slug/check.js +2 -2
- package/build/components/post-slug/check.js.map +1 -1
- package/build/components/post-slug/index.js +3 -2
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-sticky/check.js +12 -14
- package/build/components/post-sticky/check.js.map +1 -1
- package/build/components/post-sticky/index.js +14 -24
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js +35 -43
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-sync-status/index.js +10 -9
- package/build/components/post-sync-status/index.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +4 -3
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +15 -14
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +3 -2
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +6 -6
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-template/index.js +2 -2
- package/build/components/post-template/index.js.map +1 -1
- package/build/components/post-text-editor/index.js +4 -3
- package/build/components/post-text-editor/index.js.map +1 -1
- package/build/components/post-title/index.js +4 -3
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js +4 -3
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-trash/index.js +14 -4
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-type-support-check/index.js +2 -2
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-url/index.js +11 -10
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-visibility/index.js +17 -16
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/provider/index.js +7 -6
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +4 -3
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/with-registry-provider.js +4 -3
- package/build/components/provider/with-registry-provider.js.map +1 -1
- package/build/components/table-of-contents/index.js +5 -4
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/table-of-contents/panel.js +15 -15
- package/build/components/table-of-contents/panel.js.map +1 -1
- package/build/components/template-validation-notice/index.js +2 -2
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/time-to-read/index.js +5 -4
- package/build/components/time-to-read/index.js.map +1 -1
- package/build/components/unsaved-changes-warning/index.js +1 -1
- package/build/components/unsaved-changes-warning/index.js.map +1 -1
- package/build/components/word-count/index.js +2 -2
- package/build/components/word-count/index.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js +3 -2
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/components/autocompleters/user.js +1 -1
- package/build-module/components/deprecated.js +1 -1
- package/build-module/components/document-outline/index.js +1 -1
- package/build-module/components/document-outline/item.js +1 -1
- package/build-module/components/editor-help/add-blocks.native.js +1 -1
- package/build-module/components/editor-help/customize-blocks.native.js +1 -1
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js +1 -1
- package/build-module/components/editor-help/help-get-support-button.native.js +1 -1
- package/build-module/components/editor-help/help-section-title.native.js +1 -1
- package/build-module/components/editor-help/help-topic-row.native.js +1 -1
- package/build-module/components/editor-help/icon-move-blocks.native.js +1 -1
- package/build-module/components/editor-help/index.native.js +1 -1
- package/build-module/components/editor-help/intro-to-blocks.native.js +1 -1
- package/build-module/components/editor-help/move-blocks.native.js +1 -1
- package/build-module/components/editor-help/remove-blocks.native.js +1 -1
- package/build-module/components/editor-help/view-sections.native.js +1 -1
- package/build-module/components/editor-history/redo.js +1 -1
- package/build-module/components/editor-history/undo.js +1 -1
- package/build-module/components/editor-notices/index.js +1 -1
- package/build-module/components/editor-snackbars/index.js +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js +1 -1
- package/build-module/components/entities-saved-states/index.js +1 -1
- package/build-module/components/error-boundary/index.js +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
- package/build-module/components/local-autosave-monitor/index.js +1 -1
- package/build-module/components/page-attributes/order.js +1 -1
- package/build-module/components/page-attributes/parent.js +1 -1
- package/build-module/components/post-author/check.js +1 -1
- package/build-module/components/post-author/combobox.js +1 -1
- package/build-module/components/post-author/index.js +1 -1
- package/build-module/components/post-author/select.js +1 -1
- package/build-module/components/post-comments/index.js +1 -1
- package/build-module/components/post-excerpt/check.js +1 -1
- package/build-module/components/post-excerpt/index.js +1 -1
- package/build-module/components/post-featured-image/check.js +1 -1
- package/build-module/components/post-featured-image/index.js +1 -1
- package/build-module/components/post-format/check.js +1 -1
- package/build-module/components/post-format/index.js +1 -1
- package/build-module/components/post-last-revision/check.js +1 -1
- package/build-module/components/post-last-revision/index.js +1 -1
- package/build-module/components/post-locked-modal/index.js +1 -1
- package/build-module/components/post-pending-status/index.js +1 -1
- package/build-module/components/post-pingbacks/index.js +1 -1
- package/build-module/components/post-preview-button/index.js +1 -1
- package/build-module/components/post-publish-button/index.js +1 -1
- package/build-module/components/post-publish-panel/index.js +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +1 -1
- package/build-module/components/post-publish-panel/maybe-tags-panel.js +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +1 -1
- package/build-module/components/post-publish-panel/postpublish.js +1 -1
- package/build-module/components/post-publish-panel/prepublish.js +1 -1
- package/build-module/components/post-saved-state/index.js +2 -2
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/index.js +1 -1
- package/build-module/components/post-slug/check.js +1 -1
- package/build-module/components/post-slug/index.js +1 -1
- package/build-module/components/post-sticky/check.js +13 -13
- package/build-module/components/post-sticky/check.js.map +1 -1
- package/build-module/components/post-sticky/index.js +13 -21
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +32 -40
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-sync-status/index.js +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +1 -1
- package/build-module/components/post-template/index.js +1 -1
- package/build-module/components/post-text-editor/index.js +1 -1
- package/build-module/components/post-title/index.js +1 -1
- package/build-module/components/post-title/index.native.js +1 -1
- package/build-module/components/post-trash/index.js +15 -5
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js +2 -2
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-url/index.js +1 -1
- package/build-module/components/post-visibility/index.js +1 -1
- package/build-module/components/provider/index.js +1 -1
- package/build-module/components/provider/index.native.js +1 -1
- package/build-module/components/provider/with-registry-provider.js +1 -1
- package/build-module/components/table-of-contents/index.js +1 -1
- package/build-module/components/table-of-contents/panel.js +1 -1
- package/build-module/components/template-validation-notice/index.js +1 -1
- package/build-module/components/time-to-read/index.js +1 -1
- package/build-module/components/unsaved-changes-warning/index.js +1 -1
- package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
- package/build-module/components/word-count/index.js +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js +1 -1
- package/build-style/style-rtl.css +1 -1
- package/build-style/style.css +1 -1
- package/package.json +31 -31
- package/src/components/post-featured-image/README.md +3 -3
- package/src/components/post-saved-state/index.js +1 -1
- package/src/components/post-sticky/check.js +10 -13
- package/src/components/post-sticky/index.js +10 -20
- package/src/components/post-sticky/test/index.js +31 -16
- package/src/components/post-switch-to-draft-button/index.js +20 -35
- package/src/components/post-taxonomies/README.md +2 -2
- package/src/components/post-taxonomies/hierarchical-term-selector.js +1 -1
- package/src/components/post-trash/index.js +34 -11
- package/src/components/post-type-support-check/README.md +1 -1
- package/src/components/post-type-support-check/index.js +2 -2
- package/src/components/unsaved-changes-warning/index.js +1 -1
|
@@ -4,12 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _react = require("react");
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
9
|
var _components = require("@wordpress/components");
|
|
10
10
|
var _data = require("@wordpress/data");
|
|
11
11
|
var _keycodes = require("@wordpress/keycodes");
|
|
12
12
|
var _icons = require("@wordpress/icons");
|
|
13
|
+
var _element = require("@wordpress/element");
|
|
13
14
|
var _store = require("../../store");
|
|
14
15
|
/**
|
|
15
16
|
* WordPress dependencies
|
|
@@ -24,7 +25,7 @@ function EditorHistoryUndo(props, ref) {
|
|
|
24
25
|
const {
|
|
25
26
|
undo
|
|
26
27
|
} = (0, _data.useDispatch)(_store.store);
|
|
27
|
-
return (0,
|
|
28
|
+
return (0, _react.createElement)(_components.Button, {
|
|
28
29
|
...props,
|
|
29
30
|
ref: ref,
|
|
30
31
|
icon: !(0, _i18n.isRTL)() ? _icons.undo : _icons.redo
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_keycodes","_icons","_element","_store","EditorHistoryUndo","props","ref","hasUndo","useSelect","select","editorStore","hasEditorUndo","undo","useDispatch","_react","createElement","Button","icon","isRTL","undoIcon","redoIcon","label","__","shortcut","displayShortcut","primary","onClick","undefined","className","_default","forwardRef","exports","default"],"sources":["@wordpress/editor/src/components/editor-history/undo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction EditorHistoryUndo( props, ref ) {\n\tconst hasUndo = useSelect(\n\t\t( select ) => select( editorStore ).hasEditorUndo(),\n\t\t[]\n\t);\n\tconst { undo } = useDispatch( editorStore );\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\tlabel={ __( 'Undo' ) }\n\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasUndo }\n\t\t\tonClick={ hasUndo ? undo : undefined }\n\t\t\tclassName=\"editor-history__undo\"\n\t\t/>\n\t);\n}\n\nexport default forwardRef( EditorHistoryUndo );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAbA;AACA;AACA;;AAQA;AACA;AACA;;AAGA,SAASO,iBAAiBA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACxC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,YAAY,CAAC,CAACC,aAAa,CAAC,CAAC,EACnD,EACD,CAAC;EACD,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,iBAAW,EAAEH,YAAY,CAAC;EAC3C,OACC,IAAAI,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAAkB,MAAM;IAAA,GACDX,KAAK;IACVC,GAAG,EAAGA,GAAK;IACXW,IAAI,EAAG,CAAE,IAAAC,WAAK,EAAC,CAAC,GAAGC,WAAQ,GAAGC;IAC9B;IACAC,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBC,QAAQ,EAAGC,yBAAe,CAACC,OAAO,CAAE,GAAI;IACxC;IACA;IACA;IAAA;IACA,iBAAgB,CAAElB,OAAS;IAC3BmB,OAAO,EAAGnB,OAAO,GAAGK,IAAI,GAAGe,SAAW;IACtCC,SAAS,EAAC;EAAsB,CAChC,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAEc,IAAAC,mBAAU,EAAE1B,iBAAkB,CAAC;AAAA2B,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.EditorNotices = EditorNotices;
|
|
8
8
|
exports.default = void 0;
|
|
9
|
-
var
|
|
9
|
+
var _react = require("react");
|
|
10
10
|
var _components = require("@wordpress/components");
|
|
11
11
|
var _data = require("@wordpress/data");
|
|
12
12
|
var _compose = require("@wordpress/compose");
|
|
@@ -32,14 +32,14 @@ function EditorNotices({
|
|
|
32
32
|
isDismissible,
|
|
33
33
|
type
|
|
34
34
|
}) => !isDismissible && type === 'default');
|
|
35
|
-
return (0,
|
|
35
|
+
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.NoticeList, {
|
|
36
36
|
notices: nonDismissibleNotices,
|
|
37
37
|
className: "components-editor-notices__pinned"
|
|
38
|
-
}), (0,
|
|
38
|
+
}), (0, _react.createElement)(_components.NoticeList, {
|
|
39
39
|
notices: dismissibleNotices,
|
|
40
40
|
className: "components-editor-notices__dismissible",
|
|
41
41
|
onRemove: onRemove
|
|
42
|
-
}, (0,
|
|
42
|
+
}, (0, _react.createElement)(_templateValidationNotice.default, null)));
|
|
43
43
|
}
|
|
44
44
|
var _default = (0, _compose.compose)([(0, _data.withSelect)(select => ({
|
|
45
45
|
notices: select(_notices.store).getNotices()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_compose","_notices","_templateValidationNotice","_interopRequireDefault","EditorNotices","notices","onRemove","dismissibleNotices","filter","isDismissible","type","nonDismissibleNotices","
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_compose","_notices","_templateValidationNotice","_interopRequireDefault","EditorNotices","notices","onRemove","dismissibleNotices","filter","isDismissible","type","nonDismissibleNotices","_react","createElement","Fragment","NoticeList","className","default","_default","compose","withSelect","select","noticesStore","getNotices","withDispatch","dispatch","removeNotice","exports"],"sources":["@wordpress/editor/src/components/editor-notices/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { NoticeList } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport TemplateValidationNotice from '../template-validation-notice';\n\nexport function EditorNotices( { notices, onRemove } ) {\n\tconst dismissibleNotices = notices.filter(\n\t\t( { isDismissible, type } ) => isDismissible && type === 'default'\n\t);\n\tconst nonDismissibleNotices = notices.filter(\n\t\t( { isDismissible, type } ) => ! isDismissible && type === 'default'\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<NoticeList\n\t\t\t\tnotices={ nonDismissibleNotices }\n\t\t\t\tclassName=\"components-editor-notices__pinned\"\n\t\t\t/>\n\t\t\t<NoticeList\n\t\t\t\tnotices={ dismissibleNotices }\n\t\t\t\tclassName=\"components-editor-notices__dismissible\"\n\t\t\t\tonRemove={ onRemove }\n\t\t\t>\n\t\t\t\t<TemplateValidationNotice />\n\t\t\t</NoticeList>\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => ( {\n\t\tnotices: select( noticesStore ).getNotices(),\n\t} ) ),\n\twithDispatch( ( dispatch ) => ( {\n\t\tonRemove: dispatch( noticesStore ).removeNotice,\n\t} ) ),\n] )( EditorNotices );\n"],"mappings":";;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,G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A"}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = EditorSnackbars;
|
|
7
|
-
var
|
|
7
|
+
var _react = require("react");
|
|
8
8
|
var _components = require("@wordpress/components");
|
|
9
9
|
var _data = require("@wordpress/data");
|
|
10
10
|
var _notices = require("@wordpress/notices");
|
|
@@ -20,7 +20,7 @@ function EditorSnackbars() {
|
|
|
20
20
|
const snackbarNotices = notices.filter(({
|
|
21
21
|
type
|
|
22
22
|
}) => type === 'snackbar');
|
|
23
|
-
return (0,
|
|
23
|
+
return (0, _react.createElement)(_components.SnackbarList, {
|
|
24
24
|
notices: snackbarNotices,
|
|
25
25
|
className: "components-editor-notices__snackbar",
|
|
26
26
|
onRemove: removeNotice
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_notices","EditorSnackbars","notices","useSelect","select","noticesStore","getNotices","removeNotice","useDispatch","snackbarNotices","filter","type","
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_notices","EditorSnackbars","notices","useSelect","select","noticesStore","getNotices","removeNotice","useDispatch","snackbarNotices","filter","type","_react","createElement","SnackbarList","className","onRemove"],"sources":["@wordpress/editor/src/components/editor-snackbars/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SnackbarList } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function EditorSnackbars() {\n\tconst notices = useSelect(\n\t\t( select ) => select( noticesStore ).getNotices(),\n\t\t[]\n\t);\n\tconst { removeNotice } = useDispatch( noticesStore );\n\tconst snackbarNotices = notices.filter(\n\t\t( { type } ) => type === 'snackbar'\n\t);\n\n\treturn (\n\t\t<SnackbarList\n\t\t\tnotices={ snackbarNotices }\n\t\t\tclassName=\"components-editor-notices__snackbar\"\n\t\t\tonRemove={ removeNotice }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKe,SAASG,eAAeA,CAAA,EAAG;EACzC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,cAAa,CAAC,CAACC,UAAU,CAAC,CAAC,EACjD,EACD,CAAC;EACD,MAAM;IAAEC;EAAa,CAAC,GAAG,IAAAC,iBAAW,EAAEH,cAAa,CAAC;EACpD,MAAMI,eAAe,GAAGP,OAAO,CAACQ,MAAM,CACrC,CAAE;IAAEC;EAAK,CAAC,KAAMA,IAAI,KAAK,UAC1B,CAAC;EAED,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAChB,WAAA,CAAAiB,YAAY;IACZZ,OAAO,EAAGO,eAAiB;IAC3BM,SAAS,EAAC,qCAAqC;IAC/CC,QAAQ,EAAGT;EAAc,CACzB,CAAC;AAEJ"}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = EntityRecordItem;
|
|
7
|
-
var
|
|
7
|
+
var _react = require("react");
|
|
8
8
|
var _components = require("@wordpress/components");
|
|
9
9
|
var _i18n = require("@wordpress/i18n");
|
|
10
10
|
var _data = require("@wordpress/data");
|
|
@@ -39,9 +39,9 @@ function EntityRecordItem({
|
|
|
39
39
|
const template = select(_coreData.store).getEditedEntityRecord(kind, name, key);
|
|
40
40
|
return select(_store.store).__experimentalGetTemplateInfo(template).title;
|
|
41
41
|
}, [name, kind, title, key]);
|
|
42
|
-
return (0,
|
|
42
|
+
return (0, _react.createElement)(_components.PanelRow, null, (0, _react.createElement)(_components.CheckboxControl, {
|
|
43
43
|
__nextHasNoMarginBottom: true,
|
|
44
|
-
label: (0,
|
|
44
|
+
label: (0, _react.createElement)("strong", null, (0, _htmlEntities.decodeEntities)(entityRecordTitle) || (0, _i18n.__)('Untitled')),
|
|
45
45
|
checked: checked,
|
|
46
46
|
onChange: onChange
|
|
47
47
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_data","_coreData","_htmlEntities","_store","EntityRecordItem","record","checked","onChange","name","kind","title","key","entityRecordTitle","useSelect","select","template","coreStore","getEditedEntityRecord","editorStore","__experimentalGetTemplateInfo","
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_data","_coreData","_htmlEntities","_store","EntityRecordItem","record","checked","onChange","name","kind","title","key","entityRecordTitle","useSelect","select","template","coreStore","getEditedEntityRecord","editorStore","__experimentalGetTemplateInfo","_react","createElement","PanelRow","CheckboxControl","__nextHasNoMarginBottom","label","decodeEntities","__"],"sources":["@wordpress/editor/src/components/entities-saved-states/entity-record-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CheckboxControl, PanelRow } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function EntityRecordItem( { record, checked, onChange } ) {\n\tconst { name, kind, title, key } = record;\n\n\t// Handle templates that might use default descriptive titles.\n\tconst entityRecordTitle = useSelect(\n\t\t( select ) => {\n\t\t\tif ( 'postType' !== kind || 'wp_template' !== name ) {\n\t\t\t\treturn title;\n\t\t\t}\n\n\t\t\tconst template = select( coreStore ).getEditedEntityRecord(\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\tkey\n\t\t\t);\n\t\t\treturn select( editorStore ).__experimentalGetTemplateInfo(\n\t\t\t\ttemplate\n\t\t\t).title;\n\t\t},\n\t\t[ name, kind, title, key ]\n\t);\n\n\treturn (\n\t\t<PanelRow>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={\n\t\t\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4BAAc,EAAEd,iBAAkB,CAAC,IACpC,IAAAe,QAAE,EAAE,UAAW,CACT,CACR;IACDrB,OAAO,EAAGA,OAAS;IACnBC,QAAQ,EAAGA;EAAU,CACrB,CACQ,CAAC;AAEb"}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = EntityTypeList;
|
|
8
|
-
var
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
var _i18n = require("@wordpress/i18n");
|
|
10
10
|
var _data = require("@wordpress/data");
|
|
11
11
|
var _components = require("@wordpress/components");
|
|
@@ -47,11 +47,11 @@ function EntityTypeList({
|
|
|
47
47
|
}
|
|
48
48
|
// Set description based on type of entity.
|
|
49
49
|
const description = getEntityDescription(name, count);
|
|
50
|
-
return (0,
|
|
50
|
+
return (0, _react.createElement)(_components.PanelBody, {
|
|
51
51
|
title: entityLabel,
|
|
52
52
|
initialOpen: true
|
|
53
|
-
}, description && (0,
|
|
54
|
-
return (0,
|
|
53
|
+
}, description && (0, _react.createElement)(_components.PanelRow, null, description), list.map(record => {
|
|
54
|
+
return (0, _react.createElement)(_entityRecordItem.default, {
|
|
55
55
|
key: record.key || record.property,
|
|
56
56
|
record: record,
|
|
57
57
|
checked: !unselectedEntities.some(elt => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_data","_components","_coreData","_entityRecordItem","_interopRequireDefault","getEntityDescription","entity","count","__","EntityTypeList","list","unselectedEntities","setUnselectedEntities","length","firstRecord","entityConfig","useSelect","select","coreStore","getEntityConfig","kind","name","entityLabel","label","description","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_data","_components","_coreData","_entityRecordItem","_interopRequireDefault","getEntityDescription","entity","count","__","EntityTypeList","list","unselectedEntities","setUnselectedEntities","length","firstRecord","entityConfig","useSelect","select","coreStore","getEntityConfig","kind","name","entityLabel","label","description","_react","createElement","PanelBody","title","initialOpen","PanelRow","map","record","default","key","property","checked","some","elt","onChange","value"],"sources":["@wordpress/editor/src/components/entities-saved-states/entity-type-list.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EntityRecordItem from './entity-record-item';\n\nfunction getEntityDescription( entity, count ) {\n\tswitch ( entity ) {\n\t\tcase 'site':\n\t\t\treturn 1 === count\n\t\t\t\t? __( 'This change will affect your whole site.' )\n\t\t\t\t: __( 'These changes will affect your whole site.' );\n\t\tcase 'wp_template':\n\t\t\treturn __(\n\t\t\t\t'This change will affect pages and posts that use this template.'\n\t\t\t);\n\t\tcase 'page':\n\t\tcase 'post':\n\t\t\treturn __( 'The following content has been modified.' );\n\t}\n}\n\nexport default function EntityTypeList( {\n\tlist,\n\tunselectedEntities,\n\tsetUnselectedEntities,\n} ) {\n\tconst count = list.length;\n\tconst firstRecord = list[ 0 ];\n\tconst entityConfig = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityConfig(\n\t\t\t\tfirstRecord.kind,\n\t\t\t\tfirstRecord.name\n\t\t\t),\n\t\t[ firstRecord.kind, firstRecord.name ]\n\t);\n\tconst { name } = firstRecord;\n\n\tlet entityLabel = entityConfig.label;\n\tif ( name === 'wp_template_part' ) {\n\t\tentityLabel =\n\t\t\t1 === count ? __( 'Template Part' ) : __( 'Template Parts' );\n\t}\n\t// Set description based on type of entity.\n\tconst description = getEntityDescription( name, count );\n\n\treturn (\n\t\t<PanelBody title={ entityLabel } initialOpen={ true }>\n\t\t\t{ description && <PanelRow>{ description }</PanelRow> }\n\t\t\t{ list.map( ( record ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityRecordItem\n\t\t\t\t\t\tkey={ record.key || record.property }\n\t\t\t\t\t\trecord={ record }\n\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t! unselectedEntities.some(\n\t\t\t\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\t\t\t\telt.kind === record.kind &&\n\t\t\t\t\t\t\t\t\telt.name === record.name &&\n\t\t\t\t\t\t\t\t\telt.key === record.key &&\n\t\t\t\t\t\t\t\t\telt.property === record.property\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetUnselectedEntities( record, value )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</PanelBody>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAKA,IAAAI,iBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAXA;AACA;AACA;;AAMA;AACA;AACA;;AAGA,SAASM,oBAAoBA,CAAEC,MAAM,EAAEC,KAAK,EAAG;EAC9C,QAASD,MAAM;IACd,KAAK,MAAM;MACV,OAAO,CAAC,KAAKC,KAAK,GACf,IAAAC,QAAE,EAAE,0CAA2C,CAAC,GAChD,IAAAA,QAAE,EAAE,4CAA6C,CAAC;IACtD,KAAK,aAAa;MACjB,OAAO,IAAAA,QAAE,EACR,iEACD,CAAC;IACF,KAAK,MAAM;IACX,KAAK,MAAM;MACV,OAAO,IAAAA,QAAE,EAAE,0CAA2C,CAAC;EACzD;AACD;AAEe,SAASC,cAAcA,CAAE;EACvCC,IAAI;EACJC,kBAAkB;EAClBC;AACD,CAAC,EAAG;EACH,MAAML,KAAK,GAAGG,IAAI,CAACG,MAAM;EACzB,MAAMC,WAAW,GAAGJ,IAAI,CAAE,CAAC,CAAE;EAC7B,MAAMK,YAAY,GAAG,IAAAC,eAAS,EAC3BC,MAAM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,CAAEoB,MAAM,EAAEQ,KAAM;IACrC,CACD,CAAC;EAEJ,CAAE,CACQ,CAAC;AAEd"}
|
|
@@ -6,10 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.EntitiesSavedStatesExtensible = EntitiesSavedStatesExtensible;
|
|
8
8
|
exports.default = EntitiesSavedStates;
|
|
9
|
-
var
|
|
9
|
+
var _react = require("react");
|
|
10
10
|
var _components = require("@wordpress/components");
|
|
11
11
|
var _i18n = require("@wordpress/i18n");
|
|
12
12
|
var _data = require("@wordpress/data");
|
|
13
|
+
var _element = require("@wordpress/element");
|
|
13
14
|
var _coreData = require("@wordpress/core-data");
|
|
14
15
|
var _blockEditor = require("@wordpress/block-editor");
|
|
15
16
|
var _compose = require("@wordpress/compose");
|
|
@@ -35,7 +36,7 @@ function EntitiesSavedStates({
|
|
|
35
36
|
close
|
|
36
37
|
}) {
|
|
37
38
|
const isDirtyProps = (0, _useIsDirty.useIsDirty)();
|
|
38
|
-
return (0,
|
|
39
|
+
return (0, _react.createElement)(EntitiesSavedStatesExtensible, {
|
|
39
40
|
close: close,
|
|
40
41
|
...isDirtyProps
|
|
41
42
|
});
|
|
@@ -142,14 +143,14 @@ function EntitiesSavedStatesExtensible({
|
|
|
142
143
|
const [saveDialogRef, saveDialogProps] = (0, _compose.__experimentalUseDialog)({
|
|
143
144
|
onClose: () => dismissPanel()
|
|
144
145
|
});
|
|
145
|
-
return (0,
|
|
146
|
+
return (0, _react.createElement)("div", {
|
|
146
147
|
ref: saveDialogRef,
|
|
147
148
|
...saveDialogProps,
|
|
148
149
|
className: "entities-saved-states__panel"
|
|
149
|
-
}, (0,
|
|
150
|
+
}, (0, _react.createElement)(_components.Flex, {
|
|
150
151
|
className: "entities-saved-states__panel-header",
|
|
151
152
|
gap: 2
|
|
152
|
-
}, (0,
|
|
153
|
+
}, (0, _react.createElement)(_components.FlexItem, {
|
|
153
154
|
isBlock: true,
|
|
154
155
|
as: _components.Button,
|
|
155
156
|
ref: saveButtonRef,
|
|
@@ -157,15 +158,15 @@ function EntitiesSavedStatesExtensible({
|
|
|
157
158
|
disabled: !saveEnabled,
|
|
158
159
|
onClick: saveCheckedEntities,
|
|
159
160
|
className: "editor-entities-saved-states__save-button"
|
|
160
|
-
}, saveLabel), (0,
|
|
161
|
+
}, saveLabel), (0, _react.createElement)(_components.FlexItem, {
|
|
161
162
|
isBlock: true,
|
|
162
163
|
as: _components.Button,
|
|
163
164
|
variant: "secondary",
|
|
164
165
|
onClick: dismissPanel
|
|
165
|
-
}, (0, _i18n.__)('Cancel'))), (0,
|
|
166
|
+
}, (0, _i18n.__)('Cancel'))), (0, _react.createElement)("div", {
|
|
166
167
|
className: "entities-saved-states__text-prompt"
|
|
167
|
-
}, (0,
|
|
168
|
-
return (0,
|
|
168
|
+
}, (0, _react.createElement)("strong", null, (0, _i18n.__)('Are you ready to save?')), additionalPrompt, isDirty && (0, _react.createElement)("p", null, (0, _i18n.__)('The following changes have been made to your site, templates, and content.'))), sortedPartitionedSavables.map(list => {
|
|
169
|
+
return (0, _react.createElement)(_entityTypeList.default, {
|
|
169
170
|
key: list[0].name,
|
|
170
171
|
list: list,
|
|
171
172
|
unselectedEntities: unselectedEntities,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_components","_i18n","_data","_coreData","_blockEditor","_compose","_notices","_entityTypeList","_interopRequireDefault","_useIsDirty","PUBLISH_ON_SAVE_ENTITIES","kind","name","identity","values","EntitiesSavedStates","close","isDirtyProps","useIsDirty","createElement","EntitiesSavedStatesExtensible","additionalPrompt","undefined","onSave","saveEnabled","saveEnabledProp","saveLabel","__","dirtyEntityRecords","isDirty","setUnselectedEntities","unselectedEntities","saveButtonRef","useRef","editEntityRecord","saveEditedEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","useDispatch","coreStore","__unstableMarkLastChangeAsPersistent","blockEditorStore","createSuccessNotice","createErrorNotice","removeNotice","noticesStore","partitionedSavables","reduce","acc","record","push","site","siteSavables","wp_template","templateSavables","wp_template_part","templatePartSavables","contentSavables","sortedPartitionedSavables","Object","filter","Array","isArray","saveCheckedEntities","saveNoticeId","entitiesToSave","key","property","some","elt","siteItemsToSave","pendingSavedRecords","forEach","typeToPublish","status","length","Promise","all","then","value","type","id","catch","error","dismissPanel","useCallback","saveDialogRef","saveDialogProps","useDialog","onClose","ref","className","Flex","gap","FlexItem","isBlock","as","Button","variant","disabled","onClick","map","list","default"],"sources":["@wordpress/editor/src/components/entities-saved-states/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Flex, FlexItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __experimentalUseDialog as useDialog } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport EntityTypeList from './entity-type-list';\nimport { useIsDirty } from './hooks/use-is-dirty';\n\nconst PUBLISH_ON_SAVE_ENTITIES = [\n\t{\n\t\tkind: 'postType',\n\t\tname: 'wp_navigation',\n\t},\n];\n\nfunction identity( values ) {\n\treturn values;\n}\n\nexport default function EntitiesSavedStates( { close } ) {\n\tconst isDirtyProps = useIsDirty();\n\treturn (\n\t\t<EntitiesSavedStatesExtensible close={ close } { ...isDirtyProps } />\n\t);\n}\n\nexport function EntitiesSavedStatesExtensible( {\n\tadditionalPrompt = undefined,\n\tclose,\n\tonSave = identity,\n\tsaveEnabled: saveEnabledProp = undefined,\n\tsaveLabel = __( 'Save' ),\n\n\tdirtyEntityRecords,\n\tisDirty,\n\tsetUnselectedEntities,\n\tunselectedEntities,\n} ) {\n\tconst saveButtonRef = useRef();\n\tconst {\n\t\teditEntityRecord,\n\t\tsaveEditedEntityRecord,\n\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t} = useDispatch( coreStore );\n\n\tconst { __unstableMarkLastChangeAsPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst { createSuccessNotice, createErrorNotice, removeNotice } =\n\t\tuseDispatch( noticesStore );\n\n\t// To group entities by type.\n\tconst partitionedSavables = dirtyEntityRecords.reduce( ( acc, record ) => {\n\t\tconst { name } = record;\n\t\tif ( ! acc[ name ] ) {\n\t\t\tacc[ name ] = [];\n\t\t}\n\t\tacc[ name ].push( record );\n\t\treturn acc;\n\t}, {} );\n\n\t// Sort entity groups.\n\tconst {\n\t\tsite: siteSavables,\n\t\twp_template: templateSavables,\n\t\twp_template_part: templatePartSavables,\n\t\t...contentSavables\n\t} = partitionedSavables;\n\tconst sortedPartitionedSavables = [\n\t\tsiteSavables,\n\t\ttemplateSavables,\n\t\ttemplatePartSavables,\n\t\t...Object.values( contentSavables ),\n\t].filter( Array.isArray );\n\n\tconst saveEnabled = saveEnabledProp ?? isDirty;\n\n\tconst saveCheckedEntities = () => {\n\t\tconst saveNoticeId = 'site-editor-save-success';\n\t\tremoveNotice( saveNoticeId );\n\t\tconst entitiesToSave = dirtyEntityRecords.filter(\n\t\t\t( { kind, name, key, property } ) => {\n\t\t\t\treturn ! unselectedEntities.some(\n\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\telt.kind === kind &&\n\t\t\t\t\t\telt.name === name &&\n\t\t\t\t\t\telt.key === key &&\n\t\t\t\t\t\telt.property === property\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\n\t\tclose( entitiesToSave );\n\n\t\tconst siteItemsToSave = [];\n\t\tconst pendingSavedRecords = [];\n\t\tentitiesToSave.forEach( ( { kind, name, key, property } ) => {\n\t\t\tif ( 'root' === kind && 'site' === name ) {\n\t\t\t\tsiteItemsToSave.push( property );\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tPUBLISH_ON_SAVE_ENTITIES.some(\n\t\t\t\t\t\t( typeToPublish ) =>\n\t\t\t\t\t\t\ttypeToPublish.kind === kind &&\n\t\t\t\t\t\t\ttypeToPublish.name === name\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\teditEntityRecord( kind, name, key, { status: 'publish' } );\n\t\t\t\t}\n\n\t\t\t\tpendingSavedRecords.push(\n\t\t\t\t\tsaveEditedEntityRecord( kind, name, key )\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\t\tif ( siteItemsToSave.length ) {\n\t\t\tpendingSavedRecords.push(\n\t\t\t\tsaveSpecifiedEntityEdits(\n\t\t\t\t\t'root',\n\t\t\t\t\t'site',\n\t\t\t\t\tundefined,\n\t\t\t\t\tsiteItemsToSave\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\t__unstableMarkLastChangeAsPersistent();\n\n\t\tPromise.all( pendingSavedRecords )\n\t\t\t.then( ( values ) => {\n\t\t\t\treturn onSave( values );\n\t\t\t} )\n\t\t\t.then( ( values ) => {\n\t\t\t\tif (\n\t\t\t\t\tvalues.some( ( value ) => typeof value === 'undefined' )\n\t\t\t\t) {\n\t\t\t\t\tcreateErrorNotice( __( 'Saving failed.' ) );\n\t\t\t\t} else {\n\t\t\t\t\tcreateSuccessNotice( __( 'Site updated.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: saveNoticeId,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( ( error ) =>\n\t\t\t\tcreateErrorNotice( `${ __( 'Saving failed.' ) } ${ error }` )\n\t\t\t);\n\t};\n\n\t// Explicitly define this with no argument passed. Using `close` on\n\t// its own will use the event object in place of the expected saved entities.\n\tconst dismissPanel = useCallback( () => close(), [ close ] );\n\n\tconst [ saveDialogRef, saveDialogProps ] = useDialog( {\n\t\tonClose: () => dismissPanel(),\n\t} );\n\n\treturn (\n\t\t<div\n\t\t\tref={ saveDialogRef }\n\t\t\t{ ...saveDialogProps }\n\t\t\tclassName=\"entities-saved-states__panel\"\n\t\t>\n\t\t\t<Flex className=\"entities-saved-states__panel-header\" gap={ 2 }>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tref={ saveButtonRef }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tdisabled={ ! saveEnabled }\n\t\t\t\t\tonClick={ saveCheckedEntities }\n\t\t\t\t\tclassName=\"editor-entities-saved-states__save-button\"\n\t\t\t\t>\n\t\t\t\t\t{ saveLabel }\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ dismissPanel }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\n\t\t\t<div className=\"entities-saved-states__text-prompt\">\n\t\t\t\t<strong>{ __( 'Are you ready to save?' ) }</strong>\n\t\t\t\t{ additionalPrompt }\n\t\t\t\t{ isDirty && (\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'The following changes have been made to your site, templates, and content.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t</div>\n\n\t\t\t{ sortedPartitionedSavables.map( ( list ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityTypeList\n\t\t\t\t\t\tkey={ list[ 0 ].name }\n\t\t\t\t\t\tlist={ list }\n\t\t\t\t\t\tunselectedEntities={ unselectedEntities }\n\t\t\t\t\t\tsetUnselectedEntities={ setUnselectedEntities }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAMA,IAAAA,QAAA,GAAAC,OAAA;AAHA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAEA,I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,IAAA7B,QAAA,CAAAqB,aAAA;IAAKwE,SAAS,EAAC;EAAoC,GAClD,IAAA7F,QAAA,CAAAqB,aAAA,kBAAU,IAAAQ,QAAE,EAAE,wBAAyB,CAAW,CAAC,EACjDN,gBAAgB,EAChBQ,OAAO,IACR,IAAA/B,QAAA,CAAAqB,aAAA,aACG,IAAAQ,QAAE,EACH,4EACD,CACE,CAEA,CAAC,EAEJ+B,yBAAyB,CAAC2C,GAAG,CAAIC,IAAI,IAAM;IAC5C,OACC,IAAAxG,QAAA,CAAAqB,aAAA,EAACZ,eAAA,CAAAgG,OAAc;MACdrC,GAAG,EAAGoC,IAAI,CAAE,CAAC,CAAE,CAAC1F,IAAM;MACtB0F,IAAI,EAAGA,IAAM;MACbvE,kBAAkB,EAAGA,kBAAoB;MACzCD,qBAAqB,EAAGA;IAAuB,CAC/C,CAAC;EAEJ,CAAE,CACE,CAAC;AAER"}
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_data","_element","_coreData","_blockEditor","_compose","_notices","_entityTypeList","_interopRequireDefault","_useIsDirty","PUBLISH_ON_SAVE_ENTITIES","kind","name","identity","values","EntitiesSavedStates","close","isDirtyProps","useIsDirty","_react","createElement","EntitiesSavedStatesExtensible","additionalPrompt","undefined","onSave","saveEnabled","saveEnabledProp","saveLabel","__","dirtyEntityRecords","isDirty","setUnselectedEntities","unselectedEntities","saveButtonRef","useRef","editEntityRecord","saveEditedEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","useDispatch","coreStore","__unstableMarkLastChangeAsPersistent","blockEditorStore","createSuccessNotice","createErrorNotice","removeNotice","noticesStore","partitionedSavables","reduce","acc","record","push","site","siteSavables","wp_template","templateSavables","wp_template_part","templatePartSavables","contentSavables","sortedPartitionedSavables","Object","filter","Array","isArray","saveCheckedEntities","saveNoticeId","entitiesToSave","key","property","some","elt","siteItemsToSave","pendingSavedRecords","forEach","typeToPublish","status","length","Promise","all","then","value","type","id","catch","error","dismissPanel","useCallback","saveDialogRef","saveDialogProps","useDialog","onClose","ref","className","Flex","gap","FlexItem","isBlock","as","Button","variant","disabled","onClick","map","list","default"],"sources":["@wordpress/editor/src/components/entities-saved-states/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Flex, FlexItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __experimentalUseDialog as useDialog } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport EntityTypeList from './entity-type-list';\nimport { useIsDirty } from './hooks/use-is-dirty';\n\nconst PUBLISH_ON_SAVE_ENTITIES = [\n\t{\n\t\tkind: 'postType',\n\t\tname: 'wp_navigation',\n\t},\n];\n\nfunction identity( values ) {\n\treturn values;\n}\n\nexport default function EntitiesSavedStates( { close } ) {\n\tconst isDirtyProps = useIsDirty();\n\treturn (\n\t\t<EntitiesSavedStatesExtensible close={ close } { ...isDirtyProps } />\n\t);\n}\n\nexport function EntitiesSavedStatesExtensible( {\n\tadditionalPrompt = undefined,\n\tclose,\n\tonSave = identity,\n\tsaveEnabled: saveEnabledProp = undefined,\n\tsaveLabel = __( 'Save' ),\n\n\tdirtyEntityRecords,\n\tisDirty,\n\tsetUnselectedEntities,\n\tunselectedEntities,\n} ) {\n\tconst saveButtonRef = useRef();\n\tconst {\n\t\teditEntityRecord,\n\t\tsaveEditedEntityRecord,\n\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t} = useDispatch( coreStore );\n\n\tconst { __unstableMarkLastChangeAsPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst { createSuccessNotice, createErrorNotice, removeNotice } =\n\t\tuseDispatch( noticesStore );\n\n\t// To group entities by type.\n\tconst partitionedSavables = dirtyEntityRecords.reduce( ( acc, record ) => {\n\t\tconst { name } = record;\n\t\tif ( ! acc[ name ] ) {\n\t\t\tacc[ name ] = [];\n\t\t}\n\t\tacc[ name ].push( record );\n\t\treturn acc;\n\t}, {} );\n\n\t// Sort entity groups.\n\tconst {\n\t\tsite: siteSavables,\n\t\twp_template: templateSavables,\n\t\twp_template_part: templatePartSavables,\n\t\t...contentSavables\n\t} = partitionedSavables;\n\tconst sortedPartitionedSavables = [\n\t\tsiteSavables,\n\t\ttemplateSavables,\n\t\ttemplatePartSavables,\n\t\t...Object.values( contentSavables ),\n\t].filter( Array.isArray );\n\n\tconst saveEnabled = saveEnabledProp ?? isDirty;\n\n\tconst saveCheckedEntities = () => {\n\t\tconst saveNoticeId = 'site-editor-save-success';\n\t\tremoveNotice( saveNoticeId );\n\t\tconst entitiesToSave = dirtyEntityRecords.filter(\n\t\t\t( { kind, name, key, property } ) => {\n\t\t\t\treturn ! unselectedEntities.some(\n\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\telt.kind === kind &&\n\t\t\t\t\t\telt.name === name &&\n\t\t\t\t\t\telt.key === key &&\n\t\t\t\t\t\telt.property === property\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\n\t\tclose( entitiesToSave );\n\n\t\tconst siteItemsToSave = [];\n\t\tconst pendingSavedRecords = [];\n\t\tentitiesToSave.forEach( ( { kind, name, key, property } ) => {\n\t\t\tif ( 'root' === kind && 'site' === name ) {\n\t\t\t\tsiteItemsToSave.push( property );\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tPUBLISH_ON_SAVE_ENTITIES.some(\n\t\t\t\t\t\t( typeToPublish ) =>\n\t\t\t\t\t\t\ttypeToPublish.kind === kind &&\n\t\t\t\t\t\t\ttypeToPublish.name === name\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\teditEntityRecord( kind, name, key, { status: 'publish' } );\n\t\t\t\t}\n\n\t\t\t\tpendingSavedRecords.push(\n\t\t\t\t\tsaveEditedEntityRecord( kind, name, key )\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\t\tif ( siteItemsToSave.length ) {\n\t\t\tpendingSavedRecords.push(\n\t\t\t\tsaveSpecifiedEntityEdits(\n\t\t\t\t\t'root',\n\t\t\t\t\t'site',\n\t\t\t\t\tundefined,\n\t\t\t\t\tsiteItemsToSave\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\t__unstableMarkLastChangeAsPersistent();\n\n\t\tPromise.all( pendingSavedRecords )\n\t\t\t.then( ( values ) => {\n\t\t\t\treturn onSave( values );\n\t\t\t} )\n\t\t\t.then( ( values ) => {\n\t\t\t\tif (\n\t\t\t\t\tvalues.some( ( value ) => typeof value === 'undefined' )\n\t\t\t\t) {\n\t\t\t\t\tcreateErrorNotice( __( 'Saving failed.' ) );\n\t\t\t\t} else {\n\t\t\t\t\tcreateSuccessNotice( __( 'Site updated.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: saveNoticeId,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( ( error ) =>\n\t\t\t\tcreateErrorNotice( `${ __( 'Saving failed.' ) } ${ error }` )\n\t\t\t);\n\t};\n\n\t// Explicitly define this with no argument passed. Using `close` on\n\t// its own will use the event object in place of the expected saved entities.\n\tconst dismissPanel = useCallback( () => close(), [ close ] );\n\n\tconst [ saveDialogRef, saveDialogProps ] = useDialog( {\n\t\tonClose: () => dismissPanel(),\n\t} );\n\n\treturn (\n\t\t<div\n\t\t\tref={ saveDialogRef }\n\t\t\t{ ...saveDialogProps }\n\t\t\tclassName=\"entities-saved-states__panel\"\n\t\t>\n\t\t\t<Flex className=\"entities-saved-states__panel-header\" gap={ 2 }>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tref={ saveButtonRef }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tdisabled={ ! saveEnabled }\n\t\t\t\t\tonClick={ saveCheckedEntities }\n\t\t\t\t\tclassName=\"editor-entities-saved-states__save-button\"\n\t\t\t\t>\n\t\t\t\t\t{ saveLabel }\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ dismissPanel }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\n\t\t\t<div className=\"entities-saved-states__text-prompt\">\n\t\t\t\t<strong>{ __( 'Are you ready to save?' ) }</strong>\n\t\t\t\t{ additionalPrompt }\n\t\t\t\t{ isDirty && (\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'The following changes have been made to your site, templates, and content.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t</div>\n\n\t\t\t{ sortedPartitionedSavables.map( ( list ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityTypeList\n\t\t\t\t\t\tkey={ list[ 0 ].name }\n\t\t\t\t\t\tlist={ list }\n\t\t\t\t\t\tunselectedEntities={ unselectedEntities }\n\t\t\t\t\t\tsetUnselectedEntities={ setUnselectedEntities }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,eAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AAhBA;AACA;AACA;;AAUA;AAC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CAEA,CAAC,EAEJ+B,yBAAyB,CAAC2C,GAAG,CAAIC,IAAI,IAAM;IAC5C,OACC,IAAApF,MAAA,CAAAC,aAAA,EAACb,eAAA,CAAAiG,OAAc;MACdrC,GAAG,EAAGoC,IAAI,CAAE,CAAC,CAAE,CAAC3F,IAAM;MACtB2F,IAAI,EAAGA,IAAM;MACbvE,kBAAkB,EAAGA,kBAAoB;MACzCD,qBAAqB,EAAGA;IAAuB,CAC/C,CAAC;EAEJ,CAAE,CACE,CAAC;AAER"}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
7
8
|
var _element = require("@wordpress/element");
|
|
8
9
|
var _i18n = require("@wordpress/i18n");
|
|
9
10
|
var _components = require("@wordpress/components");
|
|
@@ -36,7 +37,7 @@ function CopyButton({
|
|
|
36
37
|
children
|
|
37
38
|
}) {
|
|
38
39
|
const ref = (0, _compose.useCopyToClipboard)(text);
|
|
39
|
-
return (0,
|
|
40
|
+
return (0, _react.createElement)(_components.Button, {
|
|
40
41
|
variant: "secondary",
|
|
41
42
|
ref: ref
|
|
42
43
|
}, children);
|
|
@@ -63,14 +64,14 @@ class ErrorBoundary extends _element.Component {
|
|
|
63
64
|
if (!error) {
|
|
64
65
|
return this.props.children;
|
|
65
66
|
}
|
|
66
|
-
const actions = [(0,
|
|
67
|
+
const actions = [(0, _react.createElement)(CopyButton, {
|
|
67
68
|
key: "copy-post",
|
|
68
69
|
text: getContent
|
|
69
|
-
}, (0, _i18n.__)('Copy Post Text')), (0,
|
|
70
|
+
}, (0, _i18n.__)('Copy Post Text')), (0, _react.createElement)(CopyButton, {
|
|
70
71
|
key: "copy-error",
|
|
71
72
|
text: error.stack
|
|
72
73
|
}, (0, _i18n.__)('Copy Error'))];
|
|
73
|
-
return (0,
|
|
74
|
+
return (0, _react.createElement)(_blockEditor.Warning, {
|
|
74
75
|
className: "editor-error-boundary",
|
|
75
76
|
actions: actions
|
|
76
77
|
}, (0, _i18n.__)('The editor has encountered an unexpected error.'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_i18n","_components","_data","_blockEditor","_compose","_hooks","_store","getContent","select","editorStore","getEditedPostContent","error","CopyButton","text","children","ref","useCopyToClipboard","createElement","Button","variant","ErrorBoundary","Component","constructor","arguments","state","componentDidCatch","doAction","getDerivedStateFromError","render","props","actions","key","__","stack","Warning","className","_default","exports","default"],"sources":["@wordpress/editor/src/components/error-boundary/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { select } from '@wordpress/data';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction getContent() {\n\ttry {\n\t\t// While `select` in a component is generally discouraged, it is\n\t\t// used here because it (a) reduces the chance of data loss in the\n\t\t// case of additional errors by performing a direct retrieval and\n\t\t// (b) avoids the performance cost associated with unnecessary\n\t\t// content serialization throughout the lifetime of a non-erroring\n\t\t// application.\n\t\treturn select( editorStore ).getEditedPostContent();\n\t} catch ( error ) {}\n}\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\nclass 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\tconst { error } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\tconst actions = [\n\t\t\t<CopyButton key=\"copy-post\" text={ getContent }>\n\t\t\t\t{ __( 'Copy Post Text' ) }\n\t\t\t</CopyButton>,\n\t\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t\t{ __( 'Copy Error' ) }\n\t\t\t</CopyButton>,\n\t\t];\n\n\t\treturn (\n\t\t\t<Warning className=\"editor-error-boundary\" actions={ actions }>\n\t\t\t\t{ __( 'The editor has encountered an unexpected error.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n}\n\nexport default ErrorBoundary;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_element","require","_i18n","_components","_data","_blockEditor","_compose","_hooks","_store","getContent","select","editorStore","getEditedPostContent","error","CopyButton","text","children","ref","useCopyToClipboard","_react","createElement","Button","variant","ErrorBoundary","Component","constructor","arguments","state","componentDidCatch","doAction","getDerivedStateFromError","render","props","actions","key","__","stack","Warning","className","_default","exports","default"],"sources":["@wordpress/editor/src/components/error-boundary/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { select } from '@wordpress/data';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction getContent() {\n\ttry {\n\t\t// While `select` in a component is generally discouraged, it is\n\t\t// used here because it (a) reduces the chance of data loss in the\n\t\t// case of additional errors by performing a direct retrieval and\n\t\t// (b) avoids the performance cost associated with unnecessary\n\t\t// content serialization throughout the lifetime of a non-erroring\n\t\t// application.\n\t\treturn select( editorStore ).getEditedPostContent();\n\t} catch ( error ) {}\n}\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\nclass 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\tconst { error } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\tconst actions = [\n\t\t\t<CopyButton key=\"copy-post\" text={ getContent }>\n\t\t\t\t{ __( 'Copy Post Text' ) }\n\t\t\t</CopyButton>,\n\t\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t\t{ __( 'Copy Error' ) }\n\t\t\t</CopyButton>,\n\t\t];\n\n\t\treturn (\n\t\t\t<Warning className=\"editor-error-boundary\" actions={ actions }>\n\t\t\t\t{ __( 'The editor has encountered an unexpected error.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n}\n\nexport default ErrorBoundary;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AAdA;AACA;AACA;;AASA;AACA;AACA;;AAGA,SAASQ,UAAUA,CAAA,EAAG;EACrB,IAAI;IACH;IACA;IACA;IACA;IACA;IACA;IACA,OAAO,IAAAC,YAAM,EAAEC,YAAY,CAAC,CAACC,oBAAoB,CAAC,CAAC;EACpD,CAAC,CAAC,OAAQC,KAAK,EAAG,CAAC;AACpB;AAEA,SAASC,UAAUA,CAAE;EAAEC,IAAI;EAAEC;A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AC,IAAAI,QAAA,GAEchB,aAAa;AAAAiB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
7
8
|
var _element = require("@wordpress/element");
|
|
8
9
|
var _data = require("@wordpress/data");
|
|
9
10
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -56,7 +57,7 @@ function EditorKeyboardShortcutsRegister() {
|
|
|
56
57
|
}]
|
|
57
58
|
});
|
|
58
59
|
}, [registerShortcut]);
|
|
59
|
-
return (0,
|
|
60
|
+
return (0, _react.createElement)(_blockEditor.BlockEditorKeyboardShortcuts.Register, null);
|
|
60
61
|
}
|
|
61
62
|
var _default = EditorKeyboardShortcutsRegister;
|
|
62
63
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_data","_i18n","_blockEditor","_keyboardShortcuts","_keycodes","EditorKeyboardShortcutsRegister","registerShortcut","useDispatch","keyboardShortcutsStore","useEffect","name","category","description","__","keyCombination","modifier","character","aliases","isAppleOS","createElement","BlockEditorKeyboardShortcuts","Register","_default","exports","default"],"sources":["@wordpress/editor/src/components/global-keyboard-shortcuts/register-shortcuts.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { BlockEditorKeyboardShortcuts } from '@wordpress/block-editor';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { isAppleOS } from '@wordpress/keycodes';\n\nfunction EditorKeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/save',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Save your changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 's',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/undo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Undo your last changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/redo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Redo your last undo.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t\t// Disable on Apple OS because it conflicts with the browser's\n\t\t\t// history shortcut. It's a fine alias for both Windows and Linux.\n\t\t\t// Since there's no conflict for Ctrl+Shift+Z on both Windows and\n\t\t\t// Linux, we keep it as the default for consistency.\n\t\t\taliases: isAppleOS()\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmodifier: 'primary',\n\t\t\t\t\t\t\tcharacter: 'y',\n\t\t\t\t\t\t},\n\t\t\t\t ],\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\treturn <BlockEditorKeyboardShortcuts.Register />;\n}\n\nexport default EditorKeyboardShortcutsRegister;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_i18n","_blockEditor","_keyboardShortcuts","_keycodes","EditorKeyboardShortcutsRegister","registerShortcut","useDispatch","keyboardShortcutsStore","useEffect","name","category","description","__","keyCombination","modifier","character","aliases","isAppleOS","_react","createElement","BlockEditorKeyboardShortcuts","Register","_default","exports","default"],"sources":["@wordpress/editor/src/components/global-keyboard-shortcuts/register-shortcuts.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { BlockEditorKeyboardShortcuts } from '@wordpress/block-editor';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { isAppleOS } from '@wordpress/keycodes';\n\nfunction EditorKeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/save',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Save your changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 's',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/undo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Undo your last changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/redo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Redo your last undo.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t\t// Disable on Apple OS because it conflicts with the browser's\n\t\t\t// history shortcut. It's a fine alias for both Windows and Linux.\n\t\t\t// Since there's no conflict for Ctrl+Shift+Z on both Windows and\n\t\t\t// Linux, we keep it as the default for consistency.\n\t\t\taliases: isAppleOS()\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmodifier: 'primary',\n\t\t\t\t\t\t\tcharacter: 'y',\n\t\t\t\t\t\t},\n\t\t\t\t ],\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\treturn <BlockEditorKeyboardShortcuts.Register />;\n}\n\nexport default EditorKeyboardShortcutsRegister;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA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,CAACC,QAAQ,MAAE,CAAC;AACjD;AAAC,IAAAC,QAAA,GAEclB,+BAA+B;AAAAmB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _react = require("react");
|
|
8
9
|
var _element = require("@wordpress/element");
|
|
9
10
|
var _compose = require("@wordpress/compose");
|
|
10
11
|
var _data = require("@wordpress/data");
|
|
@@ -175,7 +176,7 @@ function LocalAutosaveMonitor() {
|
|
|
175
176
|
useAutosaveNotice();
|
|
176
177
|
useAutosavePurge();
|
|
177
178
|
const localAutosaveInterval = (0, _data.useSelect)(select => select(_store.store).getEditorSettings().localAutosaveInterval, []);
|
|
178
|
-
return (0,
|
|
179
|
+
return (0, _react.createElement)(_autosaveMonitor.default, {
|
|
179
180
|
interval: localAutosaveInterval,
|
|
180
181
|
autosave: deferredAutosave
|
|
181
182
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_compose","_data","_i18n","_blocks","_notices","_autosaveMonitor","_interopRequireDefault","_localAutosave","_store","requestIdleCallback","window","requestAnimationFrame","hasStorageSupport","hasSessionStorageSupport","undefined","sessionStorage","setItem","removeItem","useAutosaveNotice","postId","isEditedPostNew","hasRemoteAutosave","useSelect","select","editorStore","getCurrentPostId","getEditorSettings","autosave","getEditedPostAttribute","createWarningNotice","removeNotice","useDispatch","noticesStore","editPost","resetEditorBlocks","useEffect","localAutosave","localAutosaveGet","JSON","parse","post_title","title","content","excerpt","edits","hasDifference","Object","keys","some","key","localAutosaveClear","id","__","actions","label","onClick","editsContent","editsWithoutContent","useAutosavePurge","isDirty","isAutosaving","didError","isEditedPostDirty","isAutosavingPost","didPostSaveRequestFail","lastIsDirty","useRef","lastIsAutosaving","current","wasEditedPostNew","usePrevious","prevPostId","LocalAutosaveMonitor","deferredAutosave","useCallback","local","localAutosaveInterval","createElement","default","interval","_default","ifCondition","exports"],"sources":["@wordpress/editor/src/components/local-autosave-monitor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\nimport { ifCondition, usePrevious } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { parse } from '@wordpress/blocks';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport AutosaveMonitor from '../autosave-monitor';\nimport {\n\tlocalAutosaveGet,\n\tlocalAutosaveClear,\n} from '../../store/local-autosave';\nimport { store as editorStore } from '../../store';\n\nconst requestIdleCallback = window.requestIdleCallback\n\t? window.requestIdleCallback\n\t: window.requestAnimationFrame;\n\nlet hasStorageSupport;\n\n/**\n * Function which returns true if the current environment supports browser\n * sessionStorage, or false otherwise. The result of this function is cached and\n * reused in subsequent invocations.\n */\nconst hasSessionStorageSupport = () => {\n\tif ( hasStorageSupport !== undefined ) {\n\t\treturn hasStorageSupport;\n\t}\n\n\ttry {\n\t\t// Private Browsing in Safari 10 and earlier will throw an error when\n\t\t// attempting to set into sessionStorage. The test here is intentional in\n\t\t// causing a thrown error as condition bailing from local autosave.\n\t\twindow.sessionStorage.setItem( '__wpEditorTestSessionStorage', '' );\n\t\twindow.sessionStorage.removeItem( '__wpEditorTestSessionStorage' );\n\t\thasStorageSupport = true;\n\t} catch {\n\t\thasStorageSupport = false;\n\t}\n\n\treturn hasStorageSupport;\n};\n\n/**\n * Custom hook which manages the creation of a notice prompting the user to\n * restore a local autosave, if one exists.\n */\nfunction useAutosaveNotice() {\n\tconst { postId, isEditedPostNew, hasRemoteAutosave } = useSelect(\n\t\t( select ) => ( {\n\t\t\tpostId: select( editorStore ).getCurrentPostId(),\n\t\t\tisEditedPostNew: select( editorStore ).isEditedPostNew(),\n\t\t\thasRemoteAutosave:\n\t\t\t\t!! select( editorStore ).getEditorSettings().autosave,\n\t\t} ),\n\t\t[]\n\t);\n\tconst { getEditedPostAttribute } = useSelect( editorStore );\n\n\tconst { createWarningNotice, removeNotice } = useDispatch( noticesStore );\n\tconst { editPost, resetEditorBlocks } = useDispatch( editorStore );\n\n\tuseEffect( () => {\n\t\tlet localAutosave = localAutosaveGet( postId, isEditedPostNew );\n\t\tif ( ! localAutosave ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tlocalAutosave = JSON.parse( localAutosave );\n\t\t} catch {\n\t\t\t// Not usable if it can't be parsed.\n\t\t\treturn;\n\t\t}\n\n\t\tconst { post_title: title, content, excerpt } = localAutosave;\n\t\tconst edits = { title, content, excerpt };\n\n\t\t{\n\t\t\t// Only display a notice if there is a difference between what has been\n\t\t\t// saved and that which is stored in sessionStorage.\n\t\t\tconst hasDifference = Object.keys( edits ).some( ( key ) => {\n\t\t\t\treturn edits[ key ] !== getEditedPostAttribute( key );\n\t\t\t} );\n\n\t\t\tif ( ! hasDifference ) {\n\t\t\t\t// If there is no difference, it can be safely ejected from storage.\n\t\t\t\tlocalAutosaveClear( postId, isEditedPostNew );\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif ( hasRemoteAutosave ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst id = 'wpEditorAutosaveRestore';\n\n\t\tcreateWarningNotice(\n\t\t\t__(\n\t\t\t\t'The backup of this post in your browser is different from the version below.'\n\t\t\t),\n\t\t\t{\n\t\t\t\tid,\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Restore the backup' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\tcontent: editsContent,\n\t\t\t\t\t\t\t\t...editsWithoutContent\n\t\t\t\t\t\t\t} = edits;\n\t\t\t\t\t\t\teditPost( editsWithoutContent );\n\t\t\t\t\t\t\tresetEditorBlocks( parse( edits.content ) );\n\t\t\t\t\t\t\tremoveNotice( id );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [ isEditedPostNew, postId ] );\n}\n\n/**\n * Custom hook which ejects a local autosave after a successful save occurs.\n */\nfunction useAutosavePurge() {\n\tconst { postId, isEditedPostNew, isDirty, isAutosaving, didError } =\n\t\tuseSelect(\n\t\t\t( select ) => ( {\n\t\t\t\tpostId: select( editorStore ).getCurrentPostId(),\n\t\t\t\tisEditedPostNew: select( editorStore ).isEditedPostNew(),\n\t\t\t\tisDirty: select( editorStore ).isEditedPostDirty(),\n\t\t\t\tisAutosaving: select( editorStore ).isAutosavingPost(),\n\t\t\t\tdidError: select( editorStore ).didPostSaveRequestFail(),\n\t\t\t} ),\n\t\t\t[]\n\t\t);\n\n\tconst lastIsDirty = useRef( isDirty );\n\tconst lastIsAutosaving = useRef( isAutosaving );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! didError &&\n\t\t\t( ( lastIsAutosaving.current && ! isAutosaving ) ||\n\t\t\t\t( lastIsDirty.current && ! isDirty ) )\n\t\t) {\n\t\t\tlocalAutosaveClear( postId, isEditedPostNew );\n\t\t}\n\n\t\tlastIsDirty.current = isDirty;\n\t\tlastIsAutosaving.current = isAutosaving;\n\t}, [ isDirty, isAutosaving, didError ] );\n\n\t// Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave.\n\tconst wasEditedPostNew = usePrevious( isEditedPostNew );\n\tconst prevPostId = usePrevious( postId );\n\tuseEffect( () => {\n\t\tif ( prevPostId === postId && wasEditedPostNew && ! isEditedPostNew ) {\n\t\t\tlocalAutosaveClear( postId, true );\n\t\t}\n\t}, [ isEditedPostNew, postId ] );\n}\n\nfunction LocalAutosaveMonitor() {\n\tconst { autosave } = useDispatch( editorStore );\n\tconst deferredAutosave = useCallback( () => {\n\t\trequestIdleCallback( () => autosave( { local: true } ) );\n\t}, [] );\n\tuseAutosaveNotice();\n\tuseAutosavePurge();\n\n\tconst localAutosaveInterval = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditorSettings().localAutosaveInterval,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<AutosaveMonitor\n\t\t\tinterval={ localAutosaveInterval }\n\t\t\tautosave={ deferredAutosave }\n\t\t/>\n\t);\n}\n\nexport default ifCondition( hasSessionStorageSupport )( LocalAutosaveMonitor );\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,gBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AAIA,IAAAS,MAAA,GAAAT,OAAA;AAlBA;AACA;AACA;;AAQA;AACA;AACA;;AAQA,MAAMU,mBAAmB,GAAGC,MAAM,CAACD,mBAAmB,GACnDC,MAAM,CAACD,mBAAmB,GAC1BC,MAAM,CAACC,qBAAqB;AAE/B,IAAIC,iBAAiB;;AAErB;AACA;AACA;AACA;AACA;AACA,MAAMC,wBAAwB,GAAGA,CAAA,KAAM;EACtC,IAAKD,iBAAiB,KAAKE,SAAS,EAAG;IACtC,OAAOF,iBAAiB;EACzB;EAEA,IAAI;IACH;IACA;IACA;IACAF,MAAM,CAACK,cAAc,CAACC,OAAO,CAAE,8BAA8B,EAAE,EAAG,CAAC;IACnEN,MAAM,CAACK,cAAc,CAACE,UAAU,CAAE,8BAA+B,CAAC;IAClEL,iBAAiB,GAAG,IAAI;EACzB,CAAC,CAAC,MAAM;IACPA,iBAAiB,GAAG,KAAK;EAC1B;EAEA,OAAOA,iBAAiB;AACzB,CAAC;;AAED;AACA;AACA;AACA;AACA,SAASM,iBAAiBA,CAAA,EAAG;EAC5B,MAAM;IAAEC,MAAM;IAAEC,eAAe;IAAEC;EAAkB,CAAC,GAAG,IAAAC,eAAS,E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AAC,CAACE,iBAAiB,CAAC,CAAC,CAACkD,qBAAqB,EAChE,EACD,CAAC;EAED,OACC,IAAA9E,QAAA,CAAA+E,aAAA,EAACxE,gBAAA,CAAAyE,OAAe;IACfC,QAAQ,EAAGH,qBAAuB;IAClCjD,QAAQ,EAAG8C;EAAkB,CAC7B,CAAC;AAEJ;AAAC,IAAAO,QAAA,GAEc,IAAAC,oBAAW,EAAEpE,wBAAyB,CAAC,CAAE2D,oBAAqB,CAAC;AAAAU,OAAA,CAAAJ,OAAA,GAAAE,QAAA"}
|
|
1
|
+
{"version":3,"names":["_element","require","_compose","_data","_i18n","_blocks","_notices","_autosaveMonitor","_interopRequireDefault","_localAutosave","_store","requestIdleCallback","window","requestAnimationFrame","hasStorageSupport","hasSessionStorageSupport","undefined","sessionStorage","setItem","removeItem","useAutosaveNotice","postId","isEditedPostNew","hasRemoteAutosave","useSelect","select","editorStore","getCurrentPostId","getEditorSettings","autosave","getEditedPostAttribute","createWarningNotice","removeNotice","useDispatch","noticesStore","editPost","resetEditorBlocks","useEffect","localAutosave","localAutosaveGet","JSON","parse","post_title","title","content","excerpt","edits","hasDifference","Object","keys","some","key","localAutosaveClear","id","__","actions","label","onClick","editsContent","editsWithoutContent","useAutosavePurge","isDirty","isAutosaving","didError","isEditedPostDirty","isAutosavingPost","didPostSaveRequestFail","lastIsDirty","useRef","lastIsAutosaving","current","wasEditedPostNew","usePrevious","prevPostId","LocalAutosaveMonitor","deferredAutosave","useCallback","local","localAutosaveInterval","_react","createElement","default","interval","_default","ifCondition","exports"],"sources":["@wordpress/editor/src/components/local-autosave-monitor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\nimport { ifCondition, usePrevious } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { parse } from '@wordpress/blocks';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport AutosaveMonitor from '../autosave-monitor';\nimport {\n\tlocalAutosaveGet,\n\tlocalAutosaveClear,\n} from '../../store/local-autosave';\nimport { store as editorStore } from '../../store';\n\nconst requestIdleCallback = window.requestIdleCallback\n\t? window.requestIdleCallback\n\t: window.requestAnimationFrame;\n\nlet hasStorageSupport;\n\n/**\n * Function which returns true if the current environment supports browser\n * sessionStorage, or false otherwise. The result of this function is cached and\n * reused in subsequent invocations.\n */\nconst hasSessionStorageSupport = () => {\n\tif ( hasStorageSupport !== undefined ) {\n\t\treturn hasStorageSupport;\n\t}\n\n\ttry {\n\t\t// Private Browsing in Safari 10 and earlier will throw an error when\n\t\t// attempting to set into sessionStorage. The test here is intentional in\n\t\t// causing a thrown error as condition bailing from local autosave.\n\t\twindow.sessionStorage.setItem( '__wpEditorTestSessionStorage', '' );\n\t\twindow.sessionStorage.removeItem( '__wpEditorTestSessionStorage' );\n\t\thasStorageSupport = true;\n\t} catch {\n\t\thasStorageSupport = false;\n\t}\n\n\treturn hasStorageSupport;\n};\n\n/**\n * Custom hook which manages the creation of a notice prompting the user to\n * restore a local autosave, if one exists.\n */\nfunction useAutosaveNotice() {\n\tconst { postId, isEditedPostNew, hasRemoteAutosave } = useSelect(\n\t\t( select ) => ( {\n\t\t\tpostId: select( editorStore ).getCurrentPostId(),\n\t\t\tisEditedPostNew: select( editorStore ).isEditedPostNew(),\n\t\t\thasRemoteAutosave:\n\t\t\t\t!! select( editorStore ).getEditorSettings().autosave,\n\t\t} ),\n\t\t[]\n\t);\n\tconst { getEditedPostAttribute } = useSelect( editorStore );\n\n\tconst { createWarningNotice, removeNotice } = useDispatch( noticesStore );\n\tconst { editPost, resetEditorBlocks } = useDispatch( editorStore );\n\n\tuseEffect( () => {\n\t\tlet localAutosave = localAutosaveGet( postId, isEditedPostNew );\n\t\tif ( ! localAutosave ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tlocalAutosave = JSON.parse( localAutosave );\n\t\t} catch {\n\t\t\t// Not usable if it can't be parsed.\n\t\t\treturn;\n\t\t}\n\n\t\tconst { post_title: title, content, excerpt } = localAutosave;\n\t\tconst edits = { title, content, excerpt };\n\n\t\t{\n\t\t\t// Only display a notice if there is a difference between what has been\n\t\t\t// saved and that which is stored in sessionStorage.\n\t\t\tconst hasDifference = Object.keys( edits ).some( ( key ) => {\n\t\t\t\treturn edits[ key ] !== getEditedPostAttribute( key );\n\t\t\t} );\n\n\t\t\tif ( ! hasDifference ) {\n\t\t\t\t// If there is no difference, it can be safely ejected from storage.\n\t\t\t\tlocalAutosaveClear( postId, isEditedPostNew );\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif ( hasRemoteAutosave ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst id = 'wpEditorAutosaveRestore';\n\n\t\tcreateWarningNotice(\n\t\t\t__(\n\t\t\t\t'The backup of this post in your browser is different from the version below.'\n\t\t\t),\n\t\t\t{\n\t\t\t\tid,\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Restore the backup' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\tcontent: editsContent,\n\t\t\t\t\t\t\t\t...editsWithoutContent\n\t\t\t\t\t\t\t} = edits;\n\t\t\t\t\t\t\teditPost( editsWithoutContent );\n\t\t\t\t\t\t\tresetEditorBlocks( parse( edits.content ) );\n\t\t\t\t\t\t\tremoveNotice( id );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [ isEditedPostNew, postId ] );\n}\n\n/**\n * Custom hook which ejects a local autosave after a successful save occurs.\n */\nfunction useAutosavePurge() {\n\tconst { postId, isEditedPostNew, isDirty, isAutosaving, didError } =\n\t\tuseSelect(\n\t\t\t( select ) => ( {\n\t\t\t\tpostId: select( editorStore ).getCurrentPostId(),\n\t\t\t\tisEditedPostNew: select( editorStore ).isEditedPostNew(),\n\t\t\t\tisDirty: select( editorStore ).isEditedPostDirty(),\n\t\t\t\tisAutosaving: select( editorStore ).isAutosavingPost(),\n\t\t\t\tdidError: select( editorStore ).didPostSaveRequestFail(),\n\t\t\t} ),\n\t\t\t[]\n\t\t);\n\n\tconst lastIsDirty = useRef( isDirty );\n\tconst lastIsAutosaving = useRef( isAutosaving );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! didError &&\n\t\t\t( ( lastIsAutosaving.current && ! isAutosaving ) ||\n\t\t\t\t( lastIsDirty.current && ! isDirty ) )\n\t\t) {\n\t\t\tlocalAutosaveClear( postId, isEditedPostNew );\n\t\t}\n\n\t\tlastIsDirty.current = isDirty;\n\t\tlastIsAutosaving.current = isAutosaving;\n\t}, [ isDirty, isAutosaving, didError ] );\n\n\t// Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave.\n\tconst wasEditedPostNew = usePrevious( isEditedPostNew );\n\tconst prevPostId = usePrevious( postId );\n\tuseEffect( () => {\n\t\tif ( prevPostId === postId && wasEditedPostNew && ! isEditedPostNew ) {\n\t\t\tlocalAutosaveClear( postId, true );\n\t\t}\n\t}, [ isEditedPostNew, postId ] );\n}\n\nfunction LocalAutosaveMonitor() {\n\tconst { autosave } = useDispatch( editorStore );\n\tconst deferredAutosave = useCallback( () => {\n\t\trequestIdleCallback( () => autosave( { local: true } ) );\n\t}, [] );\n\tuseAutosaveNotice();\n\tuseAutosavePurge();\n\n\tconst localAutosaveInterval = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditorSettings().localAutosaveInterval,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<AutosaveMonitor\n\t\t\tinterval={ localAutosaveInterval }\n\t\t\tautosave={ deferredAutosave }\n\t\t/>\n\t);\n}\n\nexport default ifCondition( hasSessionStorageSupport )( LocalAutosaveMonitor );\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAA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AAAJ,OAAA,GAAAE,QAAA"}
|
|
@@ -5,10 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = PageAttributesOrderWithChecks;
|
|
8
|
-
var
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
var _i18n = require("@wordpress/i18n");
|
|
10
10
|
var _components = require("@wordpress/components");
|
|
11
11
|
var _data = require("@wordpress/data");
|
|
12
|
+
var _element = require("@wordpress/element");
|
|
12
13
|
var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support-check"));
|
|
13
14
|
var _store = require("../../store");
|
|
14
15
|
/**
|
|
@@ -38,7 +39,7 @@ function PageAttributesOrder() {
|
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
41
|
const value = orderInput !== null && orderInput !== void 0 ? orderInput : order;
|
|
41
|
-
return (0,
|
|
42
|
+
return (0, _react.createElement)(_components.Flex, null, (0, _react.createElement)(_components.FlexBlock, null, (0, _react.createElement)(_components.__experimentalNumberControl, {
|
|
42
43
|
label: (0, _i18n.__)('Order'),
|
|
43
44
|
value: value,
|
|
44
45
|
onChange: setUpdatedOrder,
|
|
@@ -49,8 +50,8 @@ function PageAttributesOrder() {
|
|
|
49
50
|
})));
|
|
50
51
|
}
|
|
51
52
|
function PageAttributesOrderWithChecks() {
|
|
52
|
-
return (0,
|
|
53
|
+
return (0, _react.createElement)(_postTypeSupportCheck.default, {
|
|
53
54
|
supportKeys: "page-attributes"
|
|
54
|
-
}, (0,
|
|
55
|
+
}, (0, _react.createElement)(PageAttributesOrder, null));
|
|
55
56
|
}
|
|
56
57
|
//# sourceMappingURL=order.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_element","_postTypeSupportCheck","_interopRequireDefault","_store","PageAttributesOrder","order","useSelect","select","_select$getEditedPost","editorStore","getEditedPostAttribute","editPost","useDispatch","orderInput","setOrderInput","useState","setUpdatedOrder","value","newOrder","Number","isInteger","trim","menu_order","_react","createElement","Flex","FlexBlock","__experimentalNumberControl","label","__","onChange","labelPosition","onBlur","PageAttributesOrderWithChecks","default","supportKeys"],"sources":["@wordpress/editor/src/components/page-attributes/order.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tFlex,\n\tFlexBlock,\n\t__experimentalNumberControl as NumberControl,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\nfunction PageAttributesOrder() {\n\tconst order = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'menu_order' ) ?? 0,\n\t\t[]\n\t);\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ orderInput, setOrderInput ] = useState( null );\n\n\tconst setUpdatedOrder = ( value ) => {\n\t\tsetOrderInput( value );\n\t\tconst newOrder = Number( value );\n\t\tif ( Number.isInteger( newOrder ) && value.trim?.() !== '' ) {\n\t\t\teditPost( { menu_order: newOrder } );\n\t\t}\n\t};\n\n\tconst value = orderInput ?? order;\n\n\treturn (\n\t\t<Flex>\n\t\t\t<FlexBlock>\n\t\t\t\t<NumberControl\n\t\t\t\t\tlabel={ __( 'Order' ) }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ setUpdatedOrder }\n\t\t\t\t\tlabelPosition=\"side\"\n\t\t\t\t\tonBlur={ () => {\n\t\t\t\t\t\tsetOrderInput( null );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</FlexBlock>\n\t\t</Flex>\n\t);\n}\n\nexport default function PageAttributesOrderWithChecks() {\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"page-attributes\">\n\t\t\t<PageAttributesOrder />\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"],"mappings":";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