@wordpress/editor 12.0.1 → 12.0.5
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/build/components/autocompleters/user.js +1 -1
- package/build/components/autosave-monitor/index.js +7 -1
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/deprecated.js +6 -4
- package/build/components/deprecated.js.map +1 -1
- package/build/components/deprecated.native.js +26 -26
- package/build/components/document-outline/check.js +5 -4
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/document-outline/index.js +13 -9
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.js +25 -22
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/editor-help/help-detail-navigation-screen.native.js +5 -4
- 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 +5 -4
- package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build/components/editor-help/help-topic-row.native.js +6 -5
- package/build/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build/components/editor-help/index.native.js +23 -18
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-help/view-sections.native.js +16 -13
- package/build/components/editor-help/view-sections.native.js.map +1 -1
- package/build/components/editor-notices/index.js +5 -4
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js +7 -6
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js +30 -20
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/index.js +51 -26
- 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/save-shortcut.js +4 -3
- package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
- package/build/components/index.js +22 -22
- package/build/components/index.native.js +4 -4
- package/build/components/page-attributes/check.js +4 -3
- package/build/components/page-attributes/check.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 +6 -3
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-author/check.js +4 -3
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/combobox.js +6 -3
- package/build/components/post-author/combobox.js.map +1 -1
- package/build/components/post-comments/index.js +6 -4
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-excerpt/index.js +5 -4
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-featured-image/index.js +51 -41
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-format/check.js +5 -4
- package/build/components/post-format/check.js.map +1 -1
- package/build/components/post-format/index.js +1 -1
- package/build/components/post-last-revision/check.js +7 -5
- package/build/components/post-last-revision/check.js.map +1 -1
- package/build/components/post-last-revision/index.js +5 -4
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-pending-status/check.js +7 -5
- package/build/components/post-pending-status/check.js.map +1 -1
- package/build/components/post-pending-status/index.js +6 -4
- package/build/components/post-pending-status/index.js.map +1 -1
- package/build/components/post-pingbacks/index.js +6 -4
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-preview-button/index.js +11 -7
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +12 -4
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-button/label.js +15 -12
- package/build/components/post-publish-button/label.js.map +1 -1
- package/build/components/post-publish-panel/index.js +4 -3
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +11 -8
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js +7 -4
- package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js +6 -5
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js +4 -3
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-saved-state/index.js +6 -5
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/check.js +6 -4
- package/build/components/post-schedule/check.js.map +1 -1
- package/build/components/post-schedule/index.js +15 -10
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-schedule/label.js +5 -4
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-slug/check.js +4 -3
- package/build/components/post-slug/check.js.map +1 -1
- package/build/components/post-slug/index.js +6 -5
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-sticky/check.js +7 -5
- package/build/components/post-sticky/check.js.map +1 -1
- package/build/components/post-sticky/index.js +5 -4
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js +7 -6
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-taxonomies/check.js +6 -5
- package/build/components/post-taxonomies/check.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +155 -211
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +6 -5
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +6 -5
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +5 -4
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-template/index.js +2 -1
- package/build/components/post-template/index.js.map +1 -1
- package/build/components/post-title/index.js +4 -2
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js +6 -5
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-trash/check.js +8 -6
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-trash/index.js +8 -6
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-type-support-check/index.js +6 -5
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-visibility/check.js +5 -4
- package/build/components/post-visibility/check.js.map +1 -1
- package/build/components/post-visibility/index.js +28 -24
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/post-visibility/label.js +5 -3
- package/build/components/post-visibility/label.js.map +1 -1
- package/build/components/provider/index.js +9 -8
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +17 -11
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +1 -1
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/table-of-contents/index.js +33 -26
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/table-of-contents/panel.js +5 -4
- package/build/components/table-of-contents/panel.js.map +1 -1
- package/build/components/template-validation-notice/index.js +6 -4
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/theme-support-check/index.js +7 -6
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js +12 -8
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/hooks/default-autocompleters.js +2 -1
- package/build/hooks/default-autocompleters.js.map +1 -1
- package/build/index.js +4 -4
- package/build/store/actions.js +51 -30
- package/build/store/actions.js.map +1 -1
- package/build/store/actions.native.js +3 -2
- package/build/store/actions.native.js.map +1 -1
- package/build/store/constants.js +1 -1
- package/build/store/controls.js +10 -9
- package/build/store/controls.js.map +1 -1
- package/build/store/defaults.js +1 -1
- package/build/store/index.js +5 -3
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +52 -22
- package/build/store/reducer.js.map +1 -1
- package/build/store/reducer.native.js +14 -4
- package/build/store/reducer.native.js.map +1 -1
- package/build/store/selectors.js +56 -37
- package/build/store/selectors.js.map +1 -1
- package/build/store/selectors.native.js +1 -1
- package/build/store/utils/notice-builder.js +1 -1
- package/build/utils/index.js +6 -6
- package/build/utils/media-upload/index.js +15 -11
- package/build/utils/media-upload/index.js.map +1 -1
- package/build/utils/url.js +1 -1
- package/build-module/components/autosave-monitor/index.js +7 -1
- package/build-module/components/autosave-monitor/index.js.map +1 -1
- package/build-module/components/deprecated.js +4 -3
- package/build-module/components/deprecated.js.map +1 -1
- package/build-module/components/document-outline/check.js +5 -4
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/document-outline/index.js +13 -9
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-outline/item.js +25 -22
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js +5 -4
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build-module/components/editor-help/help-get-support-button.native.js +5 -4
- package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build-module/components/editor-help/help-topic-row.native.js +6 -5
- package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build-module/components/editor-help/index.native.js +23 -19
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-help/view-sections.native.js +15 -12
- package/build-module/components/editor-help/view-sections.native.js.map +1 -1
- package/build-module/components/editor-notices/index.js +5 -4
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +7 -6
- package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js +31 -19
- package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +50 -25
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +5 -4
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/save-shortcut.js +4 -3
- package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
- package/build-module/components/page-attributes/check.js +4 -3
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/page-attributes/order.js +5 -4
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +5 -2
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-author/check.js +4 -3
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-author/combobox.js +6 -3
- package/build-module/components/post-author/combobox.js.map +1 -1
- package/build-module/components/post-comments/index.js +6 -4
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +5 -4
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +51 -41
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-format/check.js +5 -4
- package/build-module/components/post-format/check.js.map +1 -1
- package/build-module/components/post-last-revision/check.js +7 -5
- package/build-module/components/post-last-revision/check.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +5 -4
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-pending-status/check.js +7 -5
- package/build-module/components/post-pending-status/check.js.map +1 -1
- package/build-module/components/post-pending-status/index.js +6 -4
- package/build-module/components/post-pending-status/index.js.map +1 -1
- package/build-module/components/post-pingbacks/index.js +6 -4
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-preview-button/index.js +11 -7
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +12 -4
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/label.js +15 -12
- package/build-module/components/post-publish-button/label.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +4 -3
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +11 -8
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-tags-panel.js +7 -4
- package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js +6 -5
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js +4 -3
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +6 -5
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/check.js +6 -4
- package/build-module/components/post-schedule/check.js.map +1 -1
- package/build-module/components/post-schedule/index.js +15 -10
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js +6 -4
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-slug/check.js +4 -3
- package/build-module/components/post-slug/check.js.map +1 -1
- package/build-module/components/post-slug/index.js +6 -5
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-sticky/check.js +7 -5
- package/build-module/components/post-sticky/check.js.map +1 -1
- package/build-module/components/post-sticky/index.js +5 -4
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +7 -6
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-taxonomies/check.js +6 -5
- package/build-module/components/post-taxonomies/check.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +157 -214
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +4 -3
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +6 -5
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +5 -4
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-template/index.js +2 -1
- package/build-module/components/post-template/index.js.map +1 -1
- package/build-module/components/post-title/index.js +4 -2
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js +6 -5
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-trash/check.js +8 -6
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-trash/index.js +8 -6
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js +6 -5
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-visibility/check.js +5 -4
- package/build-module/components/post-visibility/check.js.map +1 -1
- package/build-module/components/post-visibility/index.js +28 -24
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/post-visibility/label.js +5 -3
- package/build-module/components/post-visibility/label.js.map +1 -1
- package/build-module/components/provider/index.js +9 -8
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +13 -9
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +1 -1
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/table-of-contents/index.js +33 -26
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/table-of-contents/panel.js +5 -4
- package/build-module/components/table-of-contents/panel.js.map +1 -1
- package/build-module/components/template-validation-notice/index.js +6 -4
- package/build-module/components/template-validation-notice/index.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +7 -6
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js +12 -8
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/hooks/default-autocompleters.js +2 -1
- package/build-module/hooks/default-autocompleters.js.map +1 -1
- package/build-module/store/actions.js +27 -12
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/actions.native.js +2 -1
- package/build-module/store/actions.native.js.map +1 -1
- package/build-module/store/controls.js +8 -7
- package/build-module/store/controls.js.map +1 -1
- package/build-module/store/reducer.js +44 -14
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/reducer.native.js +12 -3
- package/build-module/store/reducer.native.js.map +1 -1
- package/build-module/store/selectors.js +7 -4
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/media-upload/index.js +15 -11
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/package.json +31 -31
- package/src/components/autosave-monitor/index.js +5 -0
- package/src/components/autosave-monitor/test/index.js +10 -4
- package/src/components/editor-help/index.native.js +116 -110
- package/src/components/entities-saved-states/entity-type-list.js +29 -10
- package/src/components/entities-saved-states/index.js +38 -8
- package/src/components/post-taxonomies/flat-term-selector.js +220 -254
- package/src/components/post-title/index.js +4 -2
- package/src/components/provider/use-block-editor-settings.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/template-validation-notice/index.js"],"names":["Notice","__","withSelect","withDispatch","compose","store","blockEditorStore","TemplateValidationNotice","isValid","props","confirmSynchronization","window","confirm","synchronizeTemplate","label","onClick","resetTemplateValidity","select","isValidTemplate","dispatch","setTemplateValidity"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;;AAEA,SAASC,wBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/template-validation-notice/index.js"],"names":["Notice","__","withSelect","withDispatch","compose","store","blockEditorStore","TemplateValidationNotice","isValid","props","confirmSynchronization","window","confirm","synchronizeTemplate","label","onClick","resetTemplateValidity","select","isValidTemplate","dispatch","setTemplateValidity"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;;AAEA,SAASC,wBAAT,OAA2D;AAAA,MAAxB;AAAEC,IAAAA,OAAF;AAAW,OAAGC;AAAd,GAAwB;;AAC1D,MAAKD,OAAL,EAAe;AACd,WAAO,IAAP;AACA;;AAED,QAAME,sBAAsB,GAAG,MAAM;AACpC,SACC;AACAC,IAAAA,MAAM,CAACC,OAAP,CACCX,EAAE,CACD,gFADC,CADH,CAFD,EAOE;AACDQ,MAAAA,KAAK,CAACI,mBAAN;AACA;AACD,GAXD;;AAaA,SACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,mCADX;AAEC,IAAA,aAAa,EAAG,KAFjB;AAGC,IAAA,MAAM,EAAC,SAHR;AAIC,IAAA,OAAO,EAAG,CACT;AACCC,MAAAA,KAAK,EAAEb,EAAE,CAAE,eAAF,CADV;AAECc,MAAAA,OAAO,EAAEN,KAAK,CAACO;AAFhB,KADS,EAKT;AACCF,MAAAA,KAAK,EAAEb,EAAE,CAAE,oBAAF,CADV;AAECc,MAAAA,OAAO,EAAEL;AAFV,KALS;AAJX,KAeGT,EAAE,CACH,iFADG,CAfL,CADD;AAqBA;;AAED,eAAeG,OAAO,CAAE,CACvBF,UAAU,CAAIe,MAAF,KAAgB;AAC3BT,EAAAA,OAAO,EAAES,MAAM,CAAEX,gBAAF,CAAN,CAA2BY,eAA3B;AADkB,CAAhB,CAAF,CADa,EAIvBf,YAAY,CAAIgB,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,mBAAF;AAAuBP,IAAAA;AAAvB,MAA+CM,QAAQ,CAC5Db,gBAD4D,CAA7D;AAGA,SAAO;AACNU,IAAAA,qBAAqB,EAAE,MAAMI,mBAAmB,CAAE,IAAF,CAD1C;AAENP,IAAAA;AAFM,GAAP;AAIA,CARW,CAJW,CAAF,CAAP,CAaVN,wBAbU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction TemplateValidationNotice( { isValid, ...props } ) {\n\tif ( isValid ) {\n\t\treturn null;\n\t}\n\n\tconst confirmSynchronization = () => {\n\t\tif (\n\t\t\t// eslint-disable-next-line no-alert\n\t\t\twindow.confirm(\n\t\t\t\t__(\n\t\t\t\t\t'Resetting the template may result in loss of content, do you want to continue?'\n\t\t\t\t)\n\t\t\t)\n\t\t) {\n\t\t\tprops.synchronizeTemplate();\n\t\t}\n\t};\n\n\treturn (\n\t\t<Notice\n\t\t\tclassName=\"editor-template-validation-notice\"\n\t\t\tisDismissible={ false }\n\t\t\tstatus=\"warning\"\n\t\t\tactions={ [\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Keep it as is' ),\n\t\t\t\t\tonClick: props.resetTemplateValidity,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Reset the template' ),\n\t\t\t\t\tonClick: confirmSynchronization,\n\t\t\t\t},\n\t\t\t] }\n\t\t>\n\t\t\t{ __(\n\t\t\t\t'The content of your post doesn’t match the template assigned to your post type.'\n\t\t\t) }\n\t\t</Notice>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => ( {\n\t\tisValid: select( blockEditorStore ).isValidTemplate(),\n\t} ) ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { setTemplateValidity, synchronizeTemplate } = dispatch(\n\t\t\tblockEditorStore\n\t\t);\n\t\treturn {\n\t\t\tresetTemplateValidity: () => setTemplateValidity( true ),\n\t\t\tsynchronizeTemplate,\n\t\t};\n\t} ),\n] )( TemplateValidationNotice );\n"]}
|
|
@@ -13,12 +13,13 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { store as editorStore } from '../../store';
|
|
16
|
-
export function ThemeSupportCheck({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
export function ThemeSupportCheck(_ref) {
|
|
17
|
+
let {
|
|
18
|
+
themeSupports,
|
|
19
|
+
children,
|
|
20
|
+
postType,
|
|
21
|
+
supportKeys
|
|
22
|
+
} = _ref;
|
|
22
23
|
const isSupported = some(castArray(supportKeys), key => {
|
|
23
24
|
const supported = get(themeSupports, [key], false); // 'post-thumbnails' can be boolean or an array of post types.
|
|
24
25
|
// In the latter case, we need to verify `postType` exists
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"names":["castArray","includes","isArray","get","some","withSelect","store","coreStore","editorStore","ThemeSupportCheck","themeSupports","children","postType","supportKeys","isSupported","key","supported","select","getThemeSupports","getEditedPostAttribute"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,QAApB,EAA8BC,OAA9B,EAAuCC,GAAvC,EAA4CC,IAA5C,QAAwD,QAAxD;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,iBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"names":["castArray","includes","isArray","get","some","withSelect","store","coreStore","editorStore","ThemeSupportCheck","themeSupports","children","postType","supportKeys","isSupported","key","supported","select","getThemeSupports","getEditedPostAttribute"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,QAApB,EAA8BC,OAA9B,EAAuCC,GAAvC,EAA4CC,IAA5C,QAAwD,QAAxD;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,iBAAT,OAKH;AAAA,MAL+B;AAClCC,IAAAA,aADkC;AAElCC,IAAAA,QAFkC;AAGlCC,IAAAA,QAHkC;AAIlCC,IAAAA;AAJkC,GAK/B;AACH,QAAMC,WAAW,GAAGV,IAAI,CAAEJ,SAAS,CAAEa,WAAF,CAAX,EAA8BE,GAAF,IAAW;AAC9D,UAAMC,SAAS,GAAGb,GAAG,CAAEO,aAAF,EAAiB,CAAEK,GAAF,CAAjB,EAA0B,KAA1B,CAArB,CAD8D,CAE9D;AACA;AACA;AACA;;AACA,QAAK,sBAAsBA,GAAtB,IAA6Bb,OAAO,CAAEc,SAAF,CAAzC,EAAyD;AACxD,aAAOf,QAAQ,CAAEe,SAAF,EAAaJ,QAAb,CAAf;AACA;;AACD,WAAOI,SAAP;AACA,GAVuB,CAAxB;;AAYA,MAAK,CAAEF,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AAED,SAAOH,QAAP;AACA;AAED,eAAeN,UAAU,CAAIY,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA;AAAF,MAAuBD,MAAM,CAAEV,SAAF,CAAnC;AACA,QAAM;AAAEY,IAAAA;AAAF,MAA6BF,MAAM,CAAET,WAAF,CAAzC;AACA,SAAO;AACNI,IAAAA,QAAQ,EAAEO,sBAAsB,CAAE,MAAF,CAD1B;AAENT,IAAAA,aAAa,EAAEQ,gBAAgB;AAFzB,GAAP;AAIA,CAPwB,CAAV,CAOVT,iBAPU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { castArray, includes, isArray, get, some } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function ThemeSupportCheck( {\n\tthemeSupports,\n\tchildren,\n\tpostType,\n\tsupportKeys,\n} ) {\n\tconst isSupported = some( castArray( supportKeys ), ( key ) => {\n\t\tconst supported = get( themeSupports, [ key ], false );\n\t\t// 'post-thumbnails' can be boolean or an array of post types.\n\t\t// In the latter case, we need to verify `postType` exists\n\t\t// within `supported`. If `postType` isn't passed, then the check\n\t\t// should fail.\n\t\tif ( 'post-thumbnails' === key && isArray( supported ) ) {\n\t\t\treturn includes( supported, postType );\n\t\t}\n\t\treturn supported;\n\t} );\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getThemeSupports } = select( coreStore );\n\tconst { getEditedPostAttribute } = select( editorStore );\n\treturn {\n\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\tthemeSupports: getThemeSupports(),\n\t};\n} )( ThemeSupportCheck );\n"]}
|
|
@@ -44,11 +44,12 @@ import { store as editorStore } from '../store';
|
|
|
44
44
|
* @return {WPHigherOrderComponent} Higher-order component.
|
|
45
45
|
*/
|
|
46
46
|
|
|
47
|
-
const createWithMetaAttributeSource = metaAttributes => createHigherOrderComponent(BlockEdit =>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
const createWithMetaAttributeSource = metaAttributes => createHigherOrderComponent(BlockEdit => _ref => {
|
|
48
|
+
let {
|
|
49
|
+
attributes,
|
|
50
|
+
setAttributes,
|
|
51
|
+
...props
|
|
52
|
+
} = _ref;
|
|
52
53
|
const postType = useSelect(select => select(editorStore).getCurrentPostType(), []);
|
|
53
54
|
const [meta, setMeta] = useEntityProp('postType', postType, 'meta');
|
|
54
55
|
const mergedAttributes = useMemo(() => ({ ...attributes,
|
|
@@ -112,7 +113,10 @@ addFilter('blocks.registerBlockType', 'core/editor/custom-sources-backwards-comp
|
|
|
112
113
|
// In the future, we could support updating block settings, at which point this
|
|
113
114
|
// implementation could use that mechanism instead.
|
|
114
115
|
|
|
115
|
-
globalSelect(blocksStore).getBlockTypes().map(
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
globalSelect(blocksStore).getBlockTypes().map(_ref2 => {
|
|
117
|
+
let {
|
|
118
|
+
name
|
|
119
|
+
} = _ref2;
|
|
120
|
+
return globalSelect(blocksStore).getBlockType(name);
|
|
121
|
+
}).forEach(shimAttributeSource);
|
|
118
122
|
//# sourceMappingURL=custom-sources-backwards-compatibility.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["pickBy","mapValues","isEmpty","mapKeys","store","blocksStore","select","globalSelect","useSelect","useEntityProp","useMemo","createHigherOrderComponent","addFilter","editorStore","createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","getCurrentPostType","meta","setMeta","mergedAttributes","metaKey","nextAttributes","nextMeta","value","key","attributeKey","shimAttributeSource","settings","source","edit","getBlockTypes","map","name","getBlockType","forEach"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,SAAjB,EAA4BC,OAA5B,EAAqCC,OAArC,QAAoD,QAApD;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,MAAM,IAAIC,YAAnB,EAAiCC,SAAjC,QAAkD,iBAAlD;AACA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;AACA,SAASR,KAAK,IAAIS,WAAlB,QAAqC,UAArC;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,6BAA6B,GAAKC,cAAF,IACrCJ,0BAA0B,CACvBK,SAAF,IAAiB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["pickBy","mapValues","isEmpty","mapKeys","store","blocksStore","select","globalSelect","useSelect","useEntityProp","useMemo","createHigherOrderComponent","addFilter","editorStore","createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","getCurrentPostType","meta","setMeta","mergedAttributes","metaKey","nextAttributes","nextMeta","value","key","attributeKey","shimAttributeSource","settings","source","edit","getBlockTypes","map","name","getBlockType","forEach"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,SAAjB,EAA4BC,OAA5B,EAAqCC,OAArC,QAAoD,QAApD;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,MAAM,IAAIC,YAAnB,EAAiCC,SAAjC,QAAkD,iBAAlD;AACA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;AACA,SAASR,KAAK,IAAIS,WAAlB,QAAqC,UAArC;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,6BAA6B,GAAKC,cAAF,IACrCJ,0BAA0B,CACvBK,SAAF,IAAiB,QAA+C;AAAA,MAA7C;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,aAAd;AAA6B,OAAGC;AAAhC,GAA6C;AAC/D,QAAMC,QAAQ,GAAGZ,SAAS,CACvBF,MAAF,IAAcA,MAAM,CAAEO,WAAF,CAAN,CAAsBQ,kBAAtB,EADW,EAEzB,EAFyB,CAA1B;AAIA,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoBd,aAAa,CACtC,UADsC,EAEtCW,QAFsC,EAGtC,MAHsC,CAAvC;AAMA,QAAMI,gBAAgB,GAAGd,OAAO,CAC/B,OAAQ,EACP,GAAGO,UADI;AAEP,OAAGhB,SAAS,CACXc,cADW,EAETU,OAAF,IAAeH,IAAI,CAAEG,OAAF,CAFR;AAFL,GAAR,CAD+B,EAQ/B,CAAER,UAAF,EAAcK,IAAd,CAR+B,CAAhC;AAW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9B,YAAY,CAAEF,WAAF,CAAZ,CAA4BiC,YAA5B,CAA0CD,IAA1C,CAAhB;AAAA,CAFP,EAGEE,OAHF,CAGWR,mBAHX","sourcesContent":["/**\n * External dependencies\n */\nimport { pickBy, mapValues, isEmpty, mapKeys } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { select as globalSelect, useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Object whose keys are the names of block attributes, where each value\n * represents the meta key to which the block attribute is intended to save.\n *\n * @see https://developer.wordpress.org/reference/functions/register_meta/\n *\n * @typedef {Object<string,string>} WPMetaAttributeMapping\n */\n\n/**\n * Given a mapping of attribute names (meta source attributes) to their\n * associated meta key, returns a higher order component that overrides its\n * `attributes` and `setAttributes` props to sync any changes with the edited\n * post's meta keys.\n *\n * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\nconst createWithMetaAttributeSource = ( metaAttributes ) =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) => ( { attributes, setAttributes, ...props } ) => {\n\t\t\tconst postType = useSelect(\n\t\t\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t\t\t[]\n\t\t\t);\n\t\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t'meta'\n\t\t\t);\n\n\t\t\tconst mergedAttributes = useMemo(\n\t\t\t\t() => ( {\n\t\t\t\t\t...attributes,\n\t\t\t\t\t...mapValues(\n\t\t\t\t\t\tmetaAttributes,\n\t\t\t\t\t\t( metaKey ) => meta[ metaKey ]\n\t\t\t\t\t),\n\t\t\t\t} ),\n\t\t\t\t[ attributes, meta ]\n\t\t\t);\n\n\t\t\treturn (\n\t\t\t\t<BlockEdit\n\t\t\t\t\tattributes={ mergedAttributes }\n\t\t\t\t\tsetAttributes={ ( nextAttributes ) => {\n\t\t\t\t\t\tconst nextMeta = mapKeys(\n\t\t\t\t\t\t\t// Filter to intersection of keys between the updated\n\t\t\t\t\t\t\t// attributes and those with an associated meta key.\n\t\t\t\t\t\t\tpickBy(\n\t\t\t\t\t\t\t\tnextAttributes,\n\t\t\t\t\t\t\t\t( value, key ) => metaAttributes[ key ]\n\t\t\t\t\t\t\t),\n\n\t\t\t\t\t\t\t// Rename the keys to the expected meta key name.\n\t\t\t\t\t\t\t( value, attributeKey ) =>\n\t\t\t\t\t\t\t\tmetaAttributes[ attributeKey ]\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif ( ! isEmpty( nextMeta ) ) {\n\t\t\t\t\t\t\tsetMeta( nextMeta );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t} }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t);\n\t\t},\n\t\t'withMetaAttributeSource'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade meta-sourced attributes to use the post's meta entity property.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\t/** @type {WPMetaAttributeMapping} */\n\tconst metaAttributes = mapValues(\n\t\tpickBy( settings.attributes, { source: 'meta' } ),\n\t\t'meta'\n\t);\n\tif ( ! isEmpty( metaAttributes ) ) {\n\t\tsettings.edit = createWithMetaAttributeSource( metaAttributes )(\n\t\t\tsettings.edit\n\t\t);\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n\n// The above filter will only capture blocks registered after the filter was\n// added. There may already be blocks registered by this point, and those must\n// be updated to apply the shim.\n//\n// The following implementation achieves this, albeit with a couple caveats:\n// - Only blocks registered on the global store will be modified.\n// - The block settings are directly mutated, since there is currently no\n// mechanism to update an existing block registration. This is the reason for\n// `getBlockType` separate from `getBlockTypes`, since the latter returns a\n// _copy_ of the block registration (i.e. the mutation would not affect the\n// actual registered block settings).\n//\n// `getBlockTypes` or `getBlockType` implementation could change in the future\n// in regards to creating settings clones, but the corresponding end-to-end\n// tests for meta blocks should cover against any potential regressions.\n//\n// In the future, we could support updating block settings, at which point this\n// implementation could use that mechanism instead.\nglobalSelect( blocksStore )\n\t.getBlockTypes()\n\t.map( ( { name } ) => globalSelect( blocksStore ).getBlockType( name ) )\n\t.forEach( shimAttributeSource );\n"]}
|
|
@@ -13,7 +13,8 @@ import { addFilter } from '@wordpress/hooks';
|
|
|
13
13
|
|
|
14
14
|
import { userAutocompleter } from '../components';
|
|
15
15
|
|
|
16
|
-
function setDefaultCompleters(
|
|
16
|
+
function setDefaultCompleters() {
|
|
17
|
+
let completers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
17
18
|
// Provide copies so filters may directly modify them.
|
|
18
19
|
completers.push(clone(userAutocompleter));
|
|
19
20
|
return completers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/hooks/default-autocompleters.js"],"names":["clone","addFilter","userAutocompleter","setDefaultCompleters","completers","push"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,QAAtB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;AACA,SAASC,iBAAT,QAAkC,eAAlC;;AAEA,SAASC,oBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/hooks/default-autocompleters.js"],"names":["clone","addFilter","userAutocompleter","setDefaultCompleters","completers","push"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,QAAtB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;AACA,SAASC,iBAAT,QAAkC,eAAlC;;AAEA,SAASC,oBAAT,GAAiD;AAAA,MAAlBC,UAAkB,uEAAL,EAAK;AAChD;AACAA,EAAAA,UAAU,CAACC,IAAX,CAAiBL,KAAK,CAAEE,iBAAF,CAAtB;AAEA,SAAOE,UAAP;AACA;;AAEDH,SAAS,CACR,gCADQ,EAER,8CAFQ,EAGRE,oBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport { clone } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { userAutocompleter } from '../components';\n\nfunction setDefaultCompleters( completers = [] ) {\n\t// Provide copies so filters may directly modify them.\n\tcompleters.push( clone( userAutocompleter ) );\n\n\treturn completers;\n}\n\naddFilter(\n\t'editor.Autocomplete.completers',\n\t'editor/autocompleters/set-default-completers',\n\tsetDefaultCompleters\n);\n"]}
|
|
@@ -98,7 +98,8 @@ export function resetPost(post) {
|
|
|
98
98
|
* @return {Object} An action object
|
|
99
99
|
*/
|
|
100
100
|
|
|
101
|
-
export function __experimentalRequestPostUpdateStart(
|
|
101
|
+
export function __experimentalRequestPostUpdateStart() {
|
|
102
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
102
103
|
return {
|
|
103
104
|
type: 'REQUEST_POST_UPDATE_START',
|
|
104
105
|
options
|
|
@@ -112,7 +113,8 @@ export function __experimentalRequestPostUpdateStart(options = {}) {
|
|
|
112
113
|
* @return {Object} An action object
|
|
113
114
|
*/
|
|
114
115
|
|
|
115
|
-
export function __experimentalRequestPostUpdateFinish(
|
|
116
|
+
export function __experimentalRequestPostUpdateFinish() {
|
|
117
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
116
118
|
return {
|
|
117
119
|
type: 'REQUEST_POST_UPDATE_FINISH',
|
|
118
120
|
options
|
|
@@ -173,7 +175,9 @@ export function* editPost(edits, options) {
|
|
|
173
175
|
* @param {Object} options
|
|
174
176
|
*/
|
|
175
177
|
|
|
176
|
-
export function* savePost(
|
|
178
|
+
export function* savePost() {
|
|
179
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
180
|
+
|
|
177
181
|
if (!(yield controls.select(STORE_NAME, 'isEditedPostSaveable'))) {
|
|
178
182
|
return;
|
|
179
183
|
}
|
|
@@ -275,10 +279,12 @@ export function* trashPost() {
|
|
|
275
279
|
* @param {Object?} options Extra flags to identify the autosave.
|
|
276
280
|
*/
|
|
277
281
|
|
|
278
|
-
export function* autosave({
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
+
export function* autosave() {
|
|
283
|
+
let {
|
|
284
|
+
local = false,
|
|
285
|
+
...options
|
|
286
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
287
|
+
|
|
282
288
|
if (local) {
|
|
283
289
|
const post = yield controls.select(STORE_NAME, 'getCurrentPost');
|
|
284
290
|
const isPostNew = yield controls.select(STORE_NAME, 'isEditedPostNew');
|
|
@@ -488,7 +494,8 @@ export function unlockPostAutosaving(lockName) {
|
|
|
488
494
|
* @yield {Object} Action object
|
|
489
495
|
*/
|
|
490
496
|
|
|
491
|
-
export function* resetEditorBlocks(blocks
|
|
497
|
+
export function* resetEditorBlocks(blocks) {
|
|
498
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
492
499
|
const {
|
|
493
500
|
__unstableShouldCreateUndoLevel,
|
|
494
501
|
selection
|
|
@@ -512,9 +519,12 @@ export function* resetEditorBlocks(blocks, options = {}) {
|
|
|
512
519
|
// a new undo level.
|
|
513
520
|
|
|
514
521
|
|
|
515
|
-
edits.content =
|
|
516
|
-
|
|
517
|
-
|
|
522
|
+
edits.content = _ref => {
|
|
523
|
+
let {
|
|
524
|
+
blocks: blocksForSerialization = []
|
|
525
|
+
} = _ref;
|
|
526
|
+
return __unstableSerializeAndClean(blocksForSerialization);
|
|
527
|
+
};
|
|
518
528
|
}
|
|
519
529
|
|
|
520
530
|
yield* editPost(edits);
|
|
@@ -537,11 +547,16 @@ export function updateEditorSettings(settings) {
|
|
|
537
547
|
* Backward compatibility
|
|
538
548
|
*/
|
|
539
549
|
|
|
540
|
-
const getBlockEditorAction = name => function* (
|
|
550
|
+
const getBlockEditorAction = name => function* () {
|
|
541
551
|
deprecated("`wp.data.dispatch( 'core/editor' )." + name + '`', {
|
|
542
552
|
since: '5.3',
|
|
543
553
|
alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`'
|
|
544
554
|
});
|
|
555
|
+
|
|
556
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
557
|
+
args[_key] = arguments[_key];
|
|
558
|
+
}
|
|
559
|
+
|
|
545
560
|
yield controls.dispatch(blockEditorStore, name, ...args);
|
|
546
561
|
};
|
|
547
562
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/store/actions.js"],"names":["has","deprecated","controls","apiFetch","parse","synchronizeBlocksWithTemplate","__unstableSerializeAndClean","store","noticesStore","coreStore","blockEditorStore","STORE_NAME","TRASH_POST_NOTICE_ID","getNotificationArgumentsForSaveSuccess","getNotificationArgumentsForSaveFail","getNotificationArgumentsForTrashFail","setupEditor","post","edits","template","resetPost","type","setupEditorState","isNewPost","status","content","raw","blocks","resetEditorBlocks","__unstableShouldCreateUndoLevel","Object","keys","some","key","editPost","__experimentalTearDownEditor","__experimentalRequestPostUpdateStart","options","__experimentalRequestPostUpdateFinish","updatePost","since","alternative","id","select","dispatch","savePost","isAutosave","undoIgnore","previousRecord","error","args","length","updatedRecord","previousPost","postType","resolveSelect","refreshPost","postTypeSlug","newPost","path","rest_base","Date","now","trashPost","method","autosave","local","isPostNew","title","excerpt","postId","redo","undo","createUndoLevel","updatePostLock","lock","enablePublishSidebar","disablePublishSidebar","lockPostSaving","lockName","unlockPostSaving","lockPostAutosaving","unlockPostAutosaving","selection","noChange","blocksForSerialization","updateEditorSettings","settings","getBlockEditorAction","name","resetBlocks","receiveBlocks","updateBlock","updateBlockAttributes","selectBlock","startMultiSelect","stopMultiSelect","multiSelect","clearSelectedBlock","toggleSelection","replaceBlocks","replaceBlock","moveBlocksDown","moveBlocksUp","moveBlockToPosition","insertBlock","insertBlocks","showInsertionPoint","hideInsertionPoint","setTemplateValidity","synchronizeTemplate","mergeBlocks","removeBlocks","removeBlock","toggleBlockMode","startTyping","stopTyping","enterFormattedText","exitFormattedText","insertDefaultBlock","updateBlockListSettings"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,QAAT,QAAyB,iBAAzB;AACA,SAASC,QAAT,QAAyB,0BAAzB;AACA,SACCC,KADD,EAECC,6BAFD,EAGCC,2BAHD,QAIO,mBAJP;AAKA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASF,KAAK,IAAIG,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,SAASC,UAAT,EAAqBC,oBAArB,QAAiD,aAAjD;AACA,SACCC,sCADD,EAECC,mCAFD,EAGCC,oCAHD,QAIO,wBAJP;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,UAAUC,WAAV,CAAuBC,IAAvB,EAA6BC,KAA7B,EAAoCC,QAApC,EAA+C;AACrD,QAAMC,SAAS,CAAEH,IAAF,CAAf;AACA,QAAM;AACLI,IAAAA,IAAI,EAAE,cADD;AAELJ,IAAAA,IAFK;AAGLC,IAAAA,KAHK;A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O,SAASgE,eAAT,GAA2B;AACjC,SAAO;AAAEpD,IAAAA,IAAI,EAAE;AAAR,GAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASqD,cAAT,CAAyBC,IAAzB,EAAgC;AACtC,SAAO;AACNtD,IAAAA,IAAI,EAAE,kBADA;AAENsD,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,oBAAT,GAAgC;AACtC,SAAO;AACNvD,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASwD,qBAAT,GAAiC;AACvC,SAAO;AACNxD,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASyD,cAAT,CAAyBC,QAAzB,EAAoC;AAC1C,SAAO;AACN1D,IAAAA,IAAI,EAAE,kBADA;AAEN0D,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,gBAAT,CAA2BD,QAA3B,EAAsC;AAC5C,SAAO;AACN1D,IAAAA,IAAI,EAAE,oBADA;AAEN0D,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,kBAAT,CAA6BF,QAA7B,EAAwC;AAC9C,SAAO;AACN1D,IAAAA,IAAI,EAAE,sBADA;AAEN0D,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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A;AACA;;AACA,OAAO,MAAM4B,UAAU,GAAG5B,oBAAoB,CAAE,YAAF,CAAvC;AAEP;AACA;AACA;;AACA,OAAO,MAAM6B,kBAAkB,GAAG7B,oBAAoB,CAAE,oBAAF,CAA/C;AAEP;AACA;AACA;;AACA,OAAO,MAAM8B,iBAAiB,GAAG9B,oBAAoB,CAAE,mBAAF,CAA9C;AAEP;AACA;AACA;;AACA,OAAO,MAAM+B,kBAAkB,GAAG/B,oBAAoB,CAAE,oBAAF,CAA/C;AAEP;AACA;AACA;;AACA,OAAO,MAAMgC,uBAAuB,GAAGhC,oBAAoB,CAC1D,yBAD0D,CAApD","sourcesContent":["/**\n * External dependencies\n */\nimport { has } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { controls } from '@wordpress/data';\nimport { apiFetch } from '@wordpress/data-controls';\nimport {\n\tparse,\n\tsynchronizeBlocksWithTemplate,\n\t__unstableSerializeAndClean,\n} from '@wordpress/blocks';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME, TRASH_POST_NOTICE_ID } from './constants';\nimport {\n\tgetNotificationArgumentsForSaveSuccess,\n\tgetNotificationArgumentsForSaveFail,\n\tgetNotificationArgumentsForTrashFail,\n} from './utils/notice-builder';\n\n/**\n * Returns an action generator used in signalling that editor has initialized with\n * the specified post object and editor settings.\n *\n * @param {Object} post Post object.\n * @param {Object} edits Initial edited attributes object.\n * @param {Array?} template Block Template.\n */\nexport function* setupEditor( post, edits, template ) {\n\tyield resetPost( post );\n\tyield {\n\t\ttype: 'SETUP_EDITOR',\n\t\tpost,\n\t\tedits,\n\t\ttemplate,\n\t};\n\tyield setupEditorState( post );\n\t// Apply a template for new posts only, if exists.\n\tconst isNewPost = post.status === 'auto-draft';\n\tif ( isNewPost && template ) {\n\t\t// In order to ensure maximum of a single parse during setup, edits are\n\t\t// included as part of editor setup action. Assume edited content as\n\t\t// canonical if provided, falling back to post.\n\t\tlet content;\n\t\tif ( has( edits, [ 'content' ] ) ) {\n\t\t\tcontent = edits.content;\n\t\t} else {\n\t\t\tcontent = post.content.raw;\n\t\t}\n\t\tlet blocks = parse( content );\n\t\tblocks = synchronizeBlocksWithTemplate( blocks, template );\n\t\tyield resetEditorBlocks( blocks, {\n\t\t\t__unstableShouldCreateUndoLevel: false,\n\t\t} );\n\t}\n\tif (\n\t\tedits &&\n\t\tObject.keys( edits ).some(\n\t\t\t( key ) =>\n\t\t\t\tedits[ key ] !==\n\t\t\t\t( has( post, [ key, 'raw' ] ) ? post[ key ].raw : post[ key ] )\n\t\t)\n\t) {\n\t\tyield editPost( edits );\n\t}\n}\n\n/**\n * Returns an action object signalling that the editor is being destroyed and\n * that any necessary state or side-effect cleanup should occur.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalTearDownEditor() {\n\treturn { type: 'TEAR_DOWN_EDITOR' };\n}\n\n/**\n * Returns an action object used in signalling that the latest version of the\n * post has been received, either by initialization or save.\n *\n * @param {Object} post Post object.\n *\n * @return {Object} Action object.\n */\nexport function resetPost( post ) {\n\treturn {\n\t\ttype: 'RESET_POST',\n\t\tpost,\n\t};\n}\n\n/**\n * Action for dispatching that a post update request has started.\n *\n * @param {Object} options\n *\n * @return {Object} An action object\n */\nexport function __experimentalRequestPostUpdateStart( options = {} ) {\n\treturn {\n\t\ttype: 'REQUEST_POST_UPDATE_START',\n\t\toptions,\n\t};\n}\n\n/**\n * Action for dispatching that a post update request has finished.\n *\n * @param {Object} options\n *\n * @return {Object} An action object\n */\nexport function __experimentalRequestPostUpdateFinish( options = {} ) {\n\treturn {\n\t\ttype: 'REQUEST_POST_UPDATE_FINISH',\n\t\toptions,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a patch of updates for the\n * latest version of the post have been received.\n *\n * @return {Object} Action object.\n * @deprecated since Gutenberg 9.7.0.\n */\nexport function updatePost() {\n\tdeprecated( \"wp.data.dispatch( 'core/editor' ).updatePost\", {\n\t\tsince: '5.7',\n\t\talternative: 'Use the core entities store instead',\n\t} );\n\treturn {\n\t\ttype: 'DO_NOTHING',\n\t};\n}\n\n/**\n * Returns an action object used to setup the editor state when first opening\n * an editor.\n *\n * @param {Object} post Post object.\n *\n * @return {Object} Action object.\n */\nexport function setupEditorState( post ) {\n\treturn {\n\t\ttype: 'SETUP_EDITOR_STATE',\n\t\tpost,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that attributes of the post have\n * been edited.\n *\n * @param {Object} edits Post attributes to edit.\n * @param {Object} options Options for the edit.\n *\n * @yield {Object} Action object or control.\n */\nexport function* editPost( edits, options ) {\n\tconst { id, type } = yield controls.select( STORE_NAME, 'getCurrentPost' );\n\tyield controls.dispatch(\n\t\tcoreStore,\n\t\t'editEntityRecord',\n\t\t'postType',\n\t\ttype,\n\t\tid,\n\t\tedits,\n\t\toptions\n\t);\n}\n\n/**\n * Action generator for saving the current post in the editor.\n *\n * @param {Object} options\n */\nexport function* savePost( options = {} ) {\n\tif ( ! ( yield controls.select( STORE_NAME, 'isEditedPostSaveable' ) ) ) {\n\t\treturn;\n\t}\n\tlet edits = {\n\t\tcontent: yield controls.select( STORE_NAME, 'getEditedPostContent' ),\n\t};\n\tif ( ! options.isAutosave ) {\n\t\tyield controls.dispatch( STORE_NAME, 'editPost', edits, {\n\t\t\tundoIgnore: true,\n\t\t} );\n\t}\n\n\tyield __experimentalRequestPostUpdateStart( options );\n\tconst previousRecord = yield controls.select(\n\t\tSTORE_NAME,\n\t\t'getCurrentPost'\n\t);\n\tedits = {\n\t\tid: previousRecord.id,\n\t\t...( yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getEntityRecordNonTransientEdits',\n\t\t\t'postType',\n\t\t\tpreviousRecord.type,\n\t\t\tpreviousRecord.id\n\t\t) ),\n\t\t...edits,\n\t};\n\tyield controls.dispatch(\n\t\tcoreStore,\n\t\t'saveEntityRecord',\n\t\t'postType',\n\t\tpreviousRecord.type,\n\t\tedits,\n\t\toptions\n\t);\n\tyield __experimentalRequestPostUpdateFinish( options );\n\n\tconst error = yield controls.select(\n\t\tcoreStore,\n\t\t'getLastEntitySaveError',\n\t\t'postType',\n\t\tpreviousRecord.type,\n\t\tpreviousRecord.id\n\t);\n\tif ( error ) {\n\t\tconst args = getNotificationArgumentsForSaveFail( {\n\t\t\tpost: previousRecord,\n\t\t\tedits,\n\t\t\terror,\n\t\t} );\n\t\tif ( args.length ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createErrorNotice',\n\t\t\t\t...args\n\t\t\t);\n\t\t}\n\t} else {\n\t\tconst updatedRecord = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getCurrentPost'\n\t\t);\n\t\tconst args = getNotificationArgumentsForSaveSuccess( {\n\t\t\tpreviousPost: previousRecord,\n\t\t\tpost: updatedRecord,\n\t\t\tpostType: yield controls.resolveSelect(\n\t\t\t\tcoreStore,\n\t\t\t\t'getPostType',\n\t\t\t\tupdatedRecord.type\n\t\t\t),\n\t\t\toptions,\n\t\t} );\n\t\tif ( args.length ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createSuccessNotice',\n\t\t\t\t...args\n\t\t\t);\n\t\t}\n\t\t// Make sure that any edits after saving create an undo level and are\n\t\t// considered for change detection.\n\t\tif ( ! options.isAutosave ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tblockEditorStore,\n\t\t\t\t'__unstableMarkLastChangeAsPersistent'\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Action generator for handling refreshing the current post.\n */\nexport function* refreshPost() {\n\tconst post = yield controls.select( STORE_NAME, 'getCurrentPost' );\n\tconst postTypeSlug = yield controls.select(\n\t\tSTORE_NAME,\n\t\t'getCurrentPostType'\n\t);\n\tconst postType = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'getPostType',\n\t\tpostTypeSlug\n\t);\n\tconst newPost = yield apiFetch( {\n\t\t// Timestamp arg allows caller to bypass browser caching, which is\n\t\t// expected for this specific function.\n\t\tpath:\n\t\t\t`/wp/v2/${ postType.rest_base }/${ post.id }` +\n\t\t\t`?context=edit&_timestamp=${ Date.now() }`,\n\t} );\n\tyield controls.dispatch( STORE_NAME, 'resetPost', newPost );\n}\n\n/**\n * Action generator for trashing the current post in the editor.\n */\nexport function* trashPost() {\n\tconst postTypeSlug = yield controls.select(\n\t\tSTORE_NAME,\n\t\t'getCurrentPostType'\n\t);\n\tconst postType = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'getPostType',\n\t\tpostTypeSlug\n\t);\n\tyield controls.dispatch(\n\t\tnoticesStore,\n\t\t'removeNotice',\n\t\tTRASH_POST_NOTICE_ID\n\t);\n\ttry {\n\t\tconst post = yield controls.select( STORE_NAME, 'getCurrentPost' );\n\t\tyield apiFetch( {\n\t\t\tpath: `/wp/v2/${ postType.rest_base }/${ post.id }`,\n\t\t\tmethod: 'DELETE',\n\t\t} );\n\n\t\tyield controls.dispatch( STORE_NAME, 'savePost' );\n\t} catch ( error ) {\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\t...getNotificationArgumentsForTrashFail( { error } )\n\t\t);\n\t}\n}\n\n/**\n * Action generator used in signalling that the post should autosave. This\n * includes server-side autosaving (default) and client-side (a.k.a. local)\n * autosaving (e.g. on the Web, the post might be committed to Session\n * Storage).\n *\n * @param {Object?} options Extra flags to identify the autosave.\n */\nexport function* autosave( { local = false, ...options } = {} ) {\n\tif ( local ) {\n\t\tconst post = yield controls.select( STORE_NAME, 'getCurrentPost' );\n\t\tconst isPostNew = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'isEditedPostNew'\n\t\t);\n\t\tconst title = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getEditedPostAttribute',\n\t\t\t'title'\n\t\t);\n\t\tconst content = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getEditedPostAttribute',\n\t\t\t'content'\n\t\t);\n\t\tconst excerpt = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getEditedPostAttribute',\n\t\t\t'excerpt'\n\t\t);\n\t\tyield {\n\t\t\ttype: 'LOCAL_AUTOSAVE_SET',\n\t\t\tpostId: post.id,\n\t\t\tisPostNew,\n\t\t\ttitle,\n\t\t\tcontent,\n\t\t\texcerpt,\n\t\t};\n\t} else {\n\t\tyield controls.dispatch( STORE_NAME, 'savePost', {\n\t\t\tisAutosave: true,\n\t\t\t...options,\n\t\t} );\n\t}\n}\n\n/**\n * Returns an action object used in signalling that undo history should\n * restore last popped state.\n *\n * @yield {Object} Action object.\n */\nexport function* redo() {\n\tyield controls.dispatch( coreStore, 'redo' );\n}\n\n/**\n * Returns an action object used in signalling that undo history should pop.\n *\n * @yield {Object} Action object.\n */\nexport function* undo() {\n\tyield controls.dispatch( coreStore, 'undo' );\n}\n\n/**\n * Returns an action object used in signalling that undo history record should\n * be created.\n *\n * @return {Object} Action object.\n */\nexport function createUndoLevel() {\n\treturn { type: 'CREATE_UNDO_LEVEL' };\n}\n\n/**\n * Returns an action object used to lock the editor.\n *\n * @param {Object} lock Details about the post lock status, user, and nonce.\n *\n * @return {Object} Action object.\n */\nexport function updatePostLock( lock ) {\n\treturn {\n\t\ttype: 'UPDATE_POST_LOCK',\n\t\tlock,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user has enabled the\n * publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function enablePublishSidebar() {\n\treturn {\n\t\ttype: 'ENABLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user has disabled the\n * publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function disablePublishSidebar() {\n\treturn {\n\t\ttype: 'DISABLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used to signal that post saving is locked.\n *\n * @param {string} lockName The lock name.\n *\n * @example\n * ```\n * const { subscribe } = wp.data;\n *\n * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );\n *\n * // Only allow publishing posts that are set to a future date.\n * if ( 'publish' !== initialPostStatus ) {\n *\n * \t// Track locking.\n * \tlet locked = false;\n *\n * \t// Watch for the publish event.\n * \tlet unssubscribe = subscribe( () => {\n * \t\tconst currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );\n * \t\tif ( 'publish' !== currentPostStatus ) {\n *\n * \t\t\t// Compare the post date to the current date, lock the post if the date isn't in the future.\n * \t\t\tconst postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) );\n * \t\t\tconst currentDate = new Date();\n * \t\t\tif ( postDate.getTime() <= currentDate.getTime() ) {\n * \t\t\t\tif ( ! locked ) {\n * \t\t\t\t\tlocked = true;\n * \t\t\t\t\twp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' );\n * \t\t\t\t}\n * \t\t\t} else {\n * \t\t\t\tif ( locked ) {\n * \t\t\t\t\tlocked = false;\n * \t\t\t\t\twp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' );\n * \t\t\t\t}\n * \t\t\t}\n * \t\t}\n * \t} );\n * }\n * ```\n *\n * @return {Object} Action object\n */\nexport function lockPostSaving( lockName ) {\n\treturn {\n\t\ttype: 'LOCK_POST_SAVING',\n\t\tlockName,\n\t};\n}\n\n/**\n * Returns an action object used to signal that post saving is unlocked.\n *\n * @param {string} lockName The lock name.\n *\n * @example\n * ```\n * // Unlock post saving with the lock key `mylock`:\n * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' );\n * ```\n *\n * @return {Object} Action object\n */\nexport function unlockPostSaving( lockName ) {\n\treturn {\n\t\ttype: 'UNLOCK_POST_SAVING',\n\t\tlockName,\n\t};\n}\n\n/**\n * Returns an action object used to signal that post autosaving is locked.\n *\n * @param {string} lockName The lock name.\n *\n * @example\n * ```\n * // Lock post autosaving with the lock key `mylock`:\n * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' );\n * ```\n *\n * @return {Object} Action object\n */\nexport function lockPostAutosaving( lockName ) {\n\treturn {\n\t\ttype: 'LOCK_POST_AUTOSAVING',\n\t\tlockName,\n\t};\n}\n\n/**\n * Returns an action object used to signal that post autosaving is unlocked.\n *\n * @param {string} lockName The lock name.\n *\n * @example\n * ```\n * // Unlock post saving with the lock key `mylock`:\n * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' );\n * ```\n *\n * @return {Object} Action object\n */\nexport function unlockPostAutosaving( lockName ) {\n\treturn {\n\t\ttype: 'UNLOCK_POST_AUTOSAVING',\n\t\tlockName,\n\t};\n}\n\n/**\n * Returns an action object used to signal that the blocks have been updated.\n *\n * @param {Array} blocks Block Array.\n * @param {?Object} options Optional options.\n *\n * @yield {Object} Action object\n */\nexport function* resetEditorBlocks( blocks, options = {} ) {\n\tconst { __unstableShouldCreateUndoLevel, selection } = options;\n\tconst edits = { blocks, selection };\n\n\tif ( __unstableShouldCreateUndoLevel !== false ) {\n\t\tconst { id, type } = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getCurrentPost'\n\t\t);\n\t\tconst noChange =\n\t\t\t( yield controls.select(\n\t\t\t\tcoreStore,\n\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t'postType',\n\t\t\t\ttype,\n\t\t\t\tid\n\t\t\t) ).blocks === edits.blocks;\n\t\tif ( noChange ) {\n\t\t\treturn yield controls.dispatch(\n\t\t\t\tcoreStore,\n\t\t\t\t'__unstableCreateUndoLevel',\n\t\t\t\t'postType',\n\t\t\t\ttype,\n\t\t\t\tid\n\t\t\t);\n\t\t}\n\n\t\t// We create a new function here on every persistent edit\n\t\t// to make sure the edit makes the post dirty and creates\n\t\t// a new undo level.\n\t\tedits.content = ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t__unstableSerializeAndClean( blocksForSerialization );\n\t}\n\tyield* editPost( edits );\n}\n\n/*\n * Returns an action object used in signalling that the post editor settings have been updated.\n *\n * @param {Object} settings Updated settings\n *\n * @return {Object} Action object\n */\nexport function updateEditorSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_EDITOR_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Backward compatibility\n */\n\nconst getBlockEditorAction = ( name ) =>\n\tfunction* ( ...args ) {\n\t\tdeprecated( \"`wp.data.dispatch( 'core/editor' ).\" + name + '`', {\n\t\t\tsince: '5.3',\n\t\t\talternative:\n\t\t\t\t\"`wp.data.dispatch( 'core/block-editor' ).\" + name + '`',\n\t\t} );\n\t\tyield controls.dispatch( blockEditorStore, name, ...args );\n\t};\n\n/**\n * @see resetBlocks in core/block-editor store.\n */\nexport const resetBlocks = getBlockEditorAction( 'resetBlocks' );\n\n/**\n * @see receiveBlocks in core/block-editor store.\n */\nexport const receiveBlocks = getBlockEditorAction( 'receiveBlocks' );\n\n/**\n * @see updateBlock in core/block-editor store.\n */\nexport const updateBlock = getBlockEditorAction( 'updateBlock' );\n\n/**\n * @see updateBlockAttributes in core/block-editor store.\n */\nexport const updateBlockAttributes = getBlockEditorAction(\n\t'updateBlockAttributes'\n);\n\n/**\n * @see selectBlock in core/block-editor store.\n */\nexport const selectBlock = getBlockEditorAction( 'selectBlock' );\n\n/**\n * @see startMultiSelect in core/block-editor store.\n */\nexport const startMultiSelect = getBlockEditorAction( 'startMultiSelect' );\n\n/**\n * @see stopMultiSelect in core/block-editor store.\n */\nexport const stopMultiSelect = getBlockEditorAction( 'stopMultiSelect' );\n\n/**\n * @see multiSelect in core/block-editor store.\n */\nexport const multiSelect = getBlockEditorAction( 'multiSelect' );\n\n/**\n * @see clearSelectedBlock in core/block-editor store.\n */\nexport const clearSelectedBlock = getBlockEditorAction( 'clearSelectedBlock' );\n\n/**\n * @see toggleSelection in core/block-editor store.\n */\nexport const toggleSelection = getBlockEditorAction( 'toggleSelection' );\n\n/**\n * @see replaceBlocks in core/block-editor store.\n */\nexport const replaceBlocks = getBlockEditorAction( 'replaceBlocks' );\n\n/**\n * @see replaceBlock in core/block-editor store.\n */\nexport const replaceBlock = getBlockEditorAction( 'replaceBlock' );\n\n/**\n * @see moveBlocksDown in core/block-editor store.\n */\nexport const moveBlocksDown = getBlockEditorAction( 'moveBlocksDown' );\n\n/**\n * @see moveBlocksUp in core/block-editor store.\n */\nexport const moveBlocksUp = getBlockEditorAction( 'moveBlocksUp' );\n\n/**\n * @see moveBlockToPosition in core/block-editor store.\n */\nexport const moveBlockToPosition = getBlockEditorAction(\n\t'moveBlockToPosition'\n);\n\n/**\n * @see insertBlock in core/block-editor store.\n */\nexport const insertBlock = getBlockEditorAction( 'insertBlock' );\n\n/**\n * @see insertBlocks in core/block-editor store.\n */\nexport const insertBlocks = getBlockEditorAction( 'insertBlocks' );\n\n/**\n * @see showInsertionPoint in core/block-editor store.\n */\nexport const showInsertionPoint = getBlockEditorAction( 'showInsertionPoint' );\n\n/**\n * @see hideInsertionPoint in core/block-editor store.\n */\nexport const hideInsertionPoint = getBlockEditorAction( 'hideInsertionPoint' );\n\n/**\n * @see setTemplateValidity in core/block-editor store.\n */\nexport const setTemplateValidity = getBlockEditorAction(\n\t'setTemplateValidity'\n);\n\n/**\n * @see synchronizeTemplate in core/block-editor store.\n */\nexport const synchronizeTemplate = getBlockEditorAction(\n\t'synchronizeTemplate'\n);\n\n/**\n * @see mergeBlocks in core/block-editor store.\n */\nexport const mergeBlocks = getBlockEditorAction( 'mergeBlocks' );\n\n/**\n * @see removeBlocks in core/block-editor store.\n */\nexport const removeBlocks = getBlockEditorAction( 'removeBlocks' );\n\n/**\n * @see removeBlock in core/block-editor store.\n */\nexport const removeBlock = getBlockEditorAction( 'removeBlock' );\n\n/**\n * @see toggleBlockMode in core/block-editor store.\n */\nexport const toggleBlockMode = getBlockEditorAction( 'toggleBlockMode' );\n\n/**\n * @see startTyping in core/block-editor store.\n */\nexport const startTyping = getBlockEditorAction( 'startTyping' );\n\n/**\n * @see stopTyping in core/block-editor store.\n */\nexport const stopTyping = getBlockEditorAction( 'stopTyping' );\n\n/**\n * @see enterFormattedText in core/block-editor store.\n */\nexport const enterFormattedText = getBlockEditorAction( 'enterFormattedText' );\n\n/**\n * @see exitFormattedText in core/block-editor store.\n */\nexport const exitFormattedText = getBlockEditorAction( 'exitFormattedText' );\n\n/**\n * @see insertDefaultBlock in core/block-editor store.\n */\nexport const insertDefaultBlock = getBlockEditorAction( 'insertDefaultBlock' );\n\n/**\n * @see updateBlockListSettings in core/block-editor store.\n */\nexport const updateBlockListSettings = getBlockEditorAction(\n\t'updateBlockListSettings'\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/store/actions.js"],"names":["has","deprecated","controls","apiFetch","parse","synchronizeBlocksWithTemplate","__unstableSerializeAndClean","store","noticesStore","coreStore","blockEditorStore","STORE_NAME","TRASH_POST_NOTICE_ID","getNotificationArgumentsForSaveSuccess","getNotificationArgumentsForSaveFail","getNotificationArgumentsForTrashFail","setupEditor","post","edits","template","resetPost","type","setupEditorState","isNewPost","status","content","raw","blocks","resetEditorBlocks","__unstableShouldCreateUndoLevel","Object","keys","some","key","editPost","__experimentalTearDownEditor","__experimentalRequestPostUpdateStart","options","__experimentalRequestPostUpdateFinish","updatePost","since","alternative","id","select","dispatch","savePost","isAutosave","undoIgnore","previousRecord","error","args","length","updatedRecord","previousPost","postType","resolveSelect","refreshPost","postTypeSlug","newPost","path","rest_base","Date","now","trashPost","method","autosave","local","isPostNew","title","excerpt","postId","redo","undo","createUndoLevel","updatePostLock","lock","enablePublishSidebar","disablePublishSidebar","lockPostSaving","lockName","unlockPostSaving","lockPostAutosaving","unlockPostAutosaving","selection","noChange","blocksForSerialization","updateEditorSettings","settings","getBlockEditorAction","name","resetBlocks","receiveBlocks","updateBlock","updateBlockAttributes","selectBlock","startMultiSelect","stopMultiSelect","multiSelect","clearSelectedBlock","toggleSelection","replaceBlocks","replaceBlock","moveBlocksDown","moveBlocksUp","moveBlockToPosition","insertBlock","insertBlocks","showInsertionPoint","hideInsertionPoint","setTemplateValidity","synchronizeTemplate","mergeBlocks","removeBlocks","removeBlock","toggleBlockMode","startTyping","stopTyping","enterFormattedText","exitFormattedText","insertDefaultBlock","updateBlockListSettings"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,QAAT,QAAyB,iBAAzB;AACA,SAASC,QAAT,QAAyB,0BAAzB;AACA,SACCC,KADD,EAECC,6BAFD,EAGCC,2BAHD,QAIO,mBAJP;AAKA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASF,KAAK,IAAIG,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,SAASC,UAAT,EAAqBC,oBAArB,QAAiD,aAAjD;AACA,SACCC,sCADD,EAECC,mCAFD,EAGCC,oCAHD,QAIO,wBAJP;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,UAAUC,WAAV,CAAuBC,IAAvB,EAA6BC,KAA7B,EAAoCC,QAApC,EAA+C;AACrD,QAAMC,SAAS,CAAEH,IAAF,CAAf;AACA,QAAM;AACLI,IAAAA,IAAI,EAAE,cADD;AAELJ,IAAAA,IAFK;AAGLC,IAAAA,KAHK;AAILC,IAAAA;AAJK,GAAN;AAMA,QAAMG,gBAAgB,CAAEL,IAAF,CAAtB,CARqD,CASrD;;AACA,QAAMM,SAAS,GAAGN,IAAI,CAACO,MAAL,KAAgB,YAAlC;;AACA,MAAKD,SAAS,IAAIJ,QAAlB,EAA6B;AAC5B;AACA;AACA;AACA,QAAIM,OAAJ;;AACA,QAAKzB,GAAG,CAAEkB,KAAF,EAAS,CAAE,SAAF,CAAT,CAAR,EAAmC;AAClCO,MAAAA,OAAO,GAAGP,KAAK,CAACO,OAAhB;AACA,KAFD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vD,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASwD,qBAAT,GAAiC;AACvC,SAAO;AACNxD,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASyD,cAAT,CAAyBC,QAAzB,EAAoC;AAC1C,SAAO;AACN1D,IAAAA,IAAI,EAAE,kBADA;AAEN0D,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,gBAAT,CAA2BD,QAA3B,EAAsC;AAC5C,SAAO;AACN1D,IAAAA,IAAI,EAAE,oBADA;AAEN0D,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,kBAAT,CAA6BF,QAA7B,EAAwC;AAC9C,SAAO;AACN1D,IAAAA,IAAI,EAAE,sBADA;AAEN0D,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,oBAAT,CAA+BH,QAA/B,EAA0C;AAChD,SAAO;AACN1D,IAAAA,IAAI,EAAE,wBADA;AAEN0D,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,UAAUnD,iBAAV,CAA6BD,MAA7B,EAAoD;AAAA,MAAfU,OAAe,uEAAL,EAAK;AAC1D,QAAM;AAAER,IAAAA,+BAAF;AAAmCsD,IAAAA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OAAO,MAAM+B,kBAAkB,GAAG/B,oBAAoB,CAAE,oBAAF,CAA/C;AAEP;AACA;AACA;;AACA,OAAO,MAAMgC,uBAAuB,GAAGhC,oBAAoB,CAC1D,yBAD0D,CAApD","sourcesContent":["/**\n * External dependencies\n */\nimport { has } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { controls } from '@wordpress/data';\nimport { apiFetch } from '@wordpress/data-controls';\nimport {\n\tparse,\n\tsynchronizeBlocksWithTemplate,\n\t__unstableSerializeAndClean,\n} from '@wordpress/blocks';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME, TRASH_POST_NOTICE_ID } from './constants';\nimport {\n\tgetNotificationArgumentsForSaveSuccess,\n\tgetNotificationArgumentsForSaveFail,\n\tgetNotificationArgumentsForTrashFail,\n} from './utils/notice-builder';\n\n/**\n * Returns an action generator used in signalling that editor has initialized with\n * the specified post object and editor settings.\n *\n * @param {Object} post Post object.\n * @param {Object} edits Initial edited attributes object.\n * @param {Array?} template Block Template.\n */\nexport function* setupEditor( post, edits, template ) {\n\tyield resetPost( post );\n\tyield {\n\t\ttype: 'SETUP_EDITOR',\n\t\tpost,\n\t\tedits,\n\t\ttemplate,\n\t};\n\tyield setupEditorState( post );\n\t// Apply a template for new posts only, if exists.\n\tconst isNewPost = post.status === 'auto-draft';\n\tif ( isNewPost && template ) {\n\t\t// In order to ensure maximum of a single parse during setup, edits are\n\t\t// included as part of editor setup action. Assume edited content as\n\t\t// canonical if provided, falling back to post.\n\t\tlet content;\n\t\tif ( has( edits, [ 'content' ] ) ) {\n\t\t\tcontent = edits.content;\n\t\t} else {\n\t\t\tcontent = post.content.raw;\n\t\t}\n\t\tlet blocks = parse( content );\n\t\tblocks = synchronizeBlocksWithTemplate( blocks, template );\n\t\tyield resetEditorBlocks( blocks, {\n\t\t\t__unstableShouldCreateUndoLevel: false,\n\t\t} );\n\t}\n\tif (\n\t\tedits &&\n\t\tObject.keys( edits ).some(\n\t\t\t( key ) =>\n\t\t\t\tedits[ key ] !==\n\t\t\t\t( has( post, [ key, 'raw' ] ) ? post[ key ].raw : post[ key ] )\n\t\t)\n\t) {\n\t\tyield editPost( edits );\n\t}\n}\n\n/**\n * Returns an action object signalling that the editor is being destroyed and\n * that any necessary state or side-effect cleanup should occur.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalTearDownEditor() {\n\treturn { type: 'TEAR_DOWN_EDITOR' };\n}\n\n/**\n * Returns an action object used in signalling that the latest version of the\n * post has been received, either by initialization or save.\n *\n * @param {Object} post Post object.\n *\n * @return {Object} Action object.\n */\nexport function resetPost( post ) {\n\treturn {\n\t\ttype: 'RESET_POST',\n\t\tpost,\n\t};\n}\n\n/**\n * Action for dispatching that a post update request has started.\n *\n * @param {Object} options\n *\n * @return {Object} An action object\n */\nexport function __experimentalRequestPostUpdateStart( options = {} ) {\n\treturn {\n\t\ttype: 'REQUEST_POST_UPDATE_START',\n\t\toptions,\n\t};\n}\n\n/**\n * Action for dispatching that a post update request has finished.\n *\n * @param {Object} options\n *\n * @return {Object} An action object\n */\nexport function __experimentalRequestPostUpdateFinish( options = {} ) {\n\treturn {\n\t\ttype: 'REQUEST_POST_UPDATE_FINISH',\n\t\toptions,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a patch of updates for the\n * latest version of the post have been received.\n *\n * @return {Object} Action object.\n * @deprecated since Gutenberg 9.7.0.\n */\nexport function updatePost() {\n\tdeprecated( \"wp.data.dispatch( 'core/editor' ).updatePost\", {\n\t\tsince: '5.7',\n\t\talternative: 'Use the core entities store instead',\n\t} );\n\treturn {\n\t\ttype: 'DO_NOTHING',\n\t};\n}\n\n/**\n * Returns an action object used to setup the editor state when first opening\n * an editor.\n *\n * @param {Object} post Post object.\n *\n * @return {Object} Action object.\n */\nexport function setupEditorState( post ) {\n\treturn {\n\t\ttype: 'SETUP_EDITOR_STATE',\n\t\tpost,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that attributes of the post have\n * been edited.\n *\n * @param {Object} edits Post attributes to edit.\n * @param {Object} options Options for the edit.\n *\n * @yield {Object} Action object or control.\n */\nexport function* editPost( edits, options ) {\n\tconst { id, type } = yield controls.select( STORE_NAME, 'getCurrentPost' );\n\tyield controls.dispatch(\n\t\tcoreStore,\n\t\t'editEntityRecord',\n\t\t'postType',\n\t\ttype,\n\t\tid,\n\t\tedits,\n\t\toptions\n\t);\n}\n\n/**\n * Action generator for saving the current post in the editor.\n *\n * @param {Object} options\n */\nexport function* savePost( options = {} ) {\n\tif ( ! ( yield controls.select( STORE_NAME, 'isEditedPostSaveable' ) ) ) {\n\t\treturn;\n\t}\n\tlet edits = {\n\t\tcontent: yield controls.select( STORE_NAME, 'getEditedPostContent' ),\n\t};\n\tif ( ! options.isAutosave ) {\n\t\tyield controls.dispatch( STORE_NAME, 'editPost', edits, {\n\t\t\tundoIgnore: true,\n\t\t} );\n\t}\n\n\tyield __experimentalRequestPostUpdateStart( options );\n\tconst previousRecord = yield controls.select(\n\t\tSTORE_NAME,\n\t\t'getCurrentPost'\n\t);\n\tedits = {\n\t\tid: previousRecord.id,\n\t\t...( yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getEntityRecordNonTransientEdits',\n\t\t\t'postType',\n\t\t\tpreviousRecord.type,\n\t\t\tpreviousRecord.id\n\t\t) ),\n\t\t...edits,\n\t};\n\tyield controls.dispatch(\n\t\tcoreStore,\n\t\t'saveEntityRecord',\n\t\t'postType',\n\t\tpreviousRecord.type,\n\t\tedits,\n\t\toptions\n\t);\n\tyield __experimentalRequestPostUpdateFinish( options );\n\n\tconst error = yield controls.select(\n\t\tcoreStore,\n\t\t'getLastEntitySaveError',\n\t\t'postType',\n\t\tpreviousRecord.type,\n\t\tpreviousRecord.id\n\t);\n\tif ( error ) {\n\t\tconst args = getNotificationArgumentsForSaveFail( {\n\t\t\tpost: previousRecord,\n\t\t\tedits,\n\t\t\terror,\n\t\t} );\n\t\tif ( args.length ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createErrorNotice',\n\t\t\t\t...args\n\t\t\t);\n\t\t}\n\t} else {\n\t\tconst updatedRecord = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getCurrentPost'\n\t\t);\n\t\tconst args = getNotificationArgumentsForSaveSuccess( {\n\t\t\tpreviousPost: previousRecord,\n\t\t\tpost: updatedRecord,\n\t\t\tpostType: yield controls.resolveSelect(\n\t\t\t\tcoreStore,\n\t\t\t\t'getPostType',\n\t\t\t\tupdatedRecord.type\n\t\t\t),\n\t\t\toptions,\n\t\t} );\n\t\tif ( args.length ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createSuccessNotice',\n\t\t\t\t...args\n\t\t\t);\n\t\t}\n\t\t// Make sure that any edits after saving create an undo level and are\n\t\t// considered for change detection.\n\t\tif ( ! options.isAutosave ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tblockEditorStore,\n\t\t\t\t'__unstableMarkLastChangeAsPersistent'\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Action generator for handling refreshing the current post.\n */\nexport function* refreshPost() {\n\tconst post = yield controls.select( STORE_NAME, 'getCurrentPost' );\n\tconst postTypeSlug = yield controls.select(\n\t\tSTORE_NAME,\n\t\t'getCurrentPostType'\n\t);\n\tconst postType = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'getPostType',\n\t\tpostTypeSlug\n\t);\n\tconst newPost = yield apiFetch( {\n\t\t// Timestamp arg allows caller to bypass browser caching, which is\n\t\t// expected for this specific function.\n\t\tpath:\n\t\t\t`/wp/v2/${ postType.rest_base }/${ post.id }` +\n\t\t\t`?context=edit&_timestamp=${ Date.now() }`,\n\t} );\n\tyield controls.dispatch( STORE_NAME, 'resetPost', newPost );\n}\n\n/**\n * Action generator for trashing the current post in the editor.\n */\nexport function* trashPost() {\n\tconst postTypeSlug = yield controls.select(\n\t\tSTORE_NAME,\n\t\t'getCurrentPostType'\n\t);\n\tconst postType = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'getPostType',\n\t\tpostTypeSlug\n\t);\n\tyield controls.dispatch(\n\t\tnoticesStore,\n\t\t'removeNotice',\n\t\tTRASH_POST_NOTICE_ID\n\t);\n\ttry {\n\t\tconst post = yield controls.select( STORE_NAME, 'getCurrentPost' );\n\t\tyield apiFetch( {\n\t\t\tpath: `/wp/v2/${ postType.rest_base }/${ post.id }`,\n\t\t\tmethod: 'DELETE',\n\t\t} );\n\n\t\tyield controls.dispatch( STORE_NAME, 'savePost' );\n\t} catch ( error ) {\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\t...getNotificationArgumentsForTrashFail( { error } )\n\t\t);\n\t}\n}\n\n/**\n * Action generator used in signalling that the post should autosave. This\n * includes server-side autosaving (default) and client-side (a.k.a. local)\n * autosaving (e.g. on the Web, the post might be committed to Session\n * Storage).\n *\n * @param {Object?} options Extra flags to identify the autosave.\n */\nexport function* autosave( { local = false, ...options } = {} ) {\n\tif ( local ) {\n\t\tconst post = yield controls.select( STORE_NAME, 'getCurrentPost' );\n\t\tconst isPostNew = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'isEditedPostNew'\n\t\t);\n\t\tconst title = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getEditedPostAttribute',\n\t\t\t'title'\n\t\t);\n\t\tconst content = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getEditedPostAttribute',\n\t\t\t'content'\n\t\t);\n\t\tconst excerpt = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getEditedPostAttribute',\n\t\t\t'excerpt'\n\t\t);\n\t\tyield {\n\t\t\ttype: 'LOCAL_AUTOSAVE_SET',\n\t\t\tpostId: post.id,\n\t\t\tisPostNew,\n\t\t\ttitle,\n\t\t\tcontent,\n\t\t\texcerpt,\n\t\t};\n\t} else {\n\t\tyield controls.dispatch( STORE_NAME, 'savePost', {\n\t\t\tisAutosave: true,\n\t\t\t...options,\n\t\t} );\n\t}\n}\n\n/**\n * Returns an action object used in signalling that undo history should\n * restore last popped state.\n *\n * @yield {Object} Action object.\n */\nexport function* redo() {\n\tyield controls.dispatch( coreStore, 'redo' );\n}\n\n/**\n * Returns an action object used in signalling that undo history should pop.\n *\n * @yield {Object} Action object.\n */\nexport function* undo() {\n\tyield controls.dispatch( coreStore, 'undo' );\n}\n\n/**\n * Returns an action object used in signalling that undo history record should\n * be created.\n *\n * @return {Object} Action object.\n */\nexport function createUndoLevel() {\n\treturn { type: 'CREATE_UNDO_LEVEL' };\n}\n\n/**\n * Returns an action object used to lock the editor.\n *\n * @param {Object} lock Details about the post lock status, user, and nonce.\n *\n * @return {Object} Action object.\n */\nexport function updatePostLock( lock ) {\n\treturn {\n\t\ttype: 'UPDATE_POST_LOCK',\n\t\tlock,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user has enabled the\n * publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function enablePublishSidebar() {\n\treturn {\n\t\ttype: 'ENABLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user has disabled the\n * publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function disablePublishSidebar() {\n\treturn {\n\t\ttype: 'DISABLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used to signal that post saving is locked.\n *\n * @param {string} lockName The lock name.\n *\n * @example\n * ```\n * const { subscribe } = wp.data;\n *\n * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );\n *\n * // Only allow publishing posts that are set to a future date.\n * if ( 'publish' !== initialPostStatus ) {\n *\n * \t// Track locking.\n * \tlet locked = false;\n *\n * \t// Watch for the publish event.\n * \tlet unssubscribe = subscribe( () => {\n * \t\tconst currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );\n * \t\tif ( 'publish' !== currentPostStatus ) {\n *\n * \t\t\t// Compare the post date to the current date, lock the post if the date isn't in the future.\n * \t\t\tconst postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) );\n * \t\t\tconst currentDate = new Date();\n * \t\t\tif ( postDate.getTime() <= currentDate.getTime() ) {\n * \t\t\t\tif ( ! locked ) {\n * \t\t\t\t\tlocked = true;\n * \t\t\t\t\twp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' );\n * \t\t\t\t}\n * \t\t\t} else {\n * \t\t\t\tif ( locked ) {\n * \t\t\t\t\tlocked = false;\n * \t\t\t\t\twp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' );\n * \t\t\t\t}\n * \t\t\t}\n * \t\t}\n * \t} );\n * }\n * ```\n *\n * @return {Object} Action object\n */\nexport function lockPostSaving( lockName ) {\n\treturn {\n\t\ttype: 'LOCK_POST_SAVING',\n\t\tlockName,\n\t};\n}\n\n/**\n * Returns an action object used to signal that post saving is unlocked.\n *\n * @param {string} lockName The lock name.\n *\n * @example\n * ```\n * // Unlock post saving with the lock key `mylock`:\n * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' );\n * ```\n *\n * @return {Object} Action object\n */\nexport function unlockPostSaving( lockName ) {\n\treturn {\n\t\ttype: 'UNLOCK_POST_SAVING',\n\t\tlockName,\n\t};\n}\n\n/**\n * Returns an action object used to signal that post autosaving is locked.\n *\n * @param {string} lockName The lock name.\n *\n * @example\n * ```\n * // Lock post autosaving with the lock key `mylock`:\n * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' );\n * ```\n *\n * @return {Object} Action object\n */\nexport function lockPostAutosaving( lockName ) {\n\treturn {\n\t\ttype: 'LOCK_POST_AUTOSAVING',\n\t\tlockName,\n\t};\n}\n\n/**\n * Returns an action object used to signal that post autosaving is unlocked.\n *\n * @param {string} lockName The lock name.\n *\n * @example\n * ```\n * // Unlock post saving with the lock key `mylock`:\n * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' );\n * ```\n *\n * @return {Object} Action object\n */\nexport function unlockPostAutosaving( lockName ) {\n\treturn {\n\t\ttype: 'UNLOCK_POST_AUTOSAVING',\n\t\tlockName,\n\t};\n}\n\n/**\n * Returns an action object used to signal that the blocks have been updated.\n *\n * @param {Array} blocks Block Array.\n * @param {?Object} options Optional options.\n *\n * @yield {Object} Action object\n */\nexport function* resetEditorBlocks( blocks, options = {} ) {\n\tconst { __unstableShouldCreateUndoLevel, selection } = options;\n\tconst edits = { blocks, selection };\n\n\tif ( __unstableShouldCreateUndoLevel !== false ) {\n\t\tconst { id, type } = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getCurrentPost'\n\t\t);\n\t\tconst noChange =\n\t\t\t( yield controls.select(\n\t\t\t\tcoreStore,\n\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t'postType',\n\t\t\t\ttype,\n\t\t\t\tid\n\t\t\t) ).blocks === edits.blocks;\n\t\tif ( noChange ) {\n\t\t\treturn yield controls.dispatch(\n\t\t\t\tcoreStore,\n\t\t\t\t'__unstableCreateUndoLevel',\n\t\t\t\t'postType',\n\t\t\t\ttype,\n\t\t\t\tid\n\t\t\t);\n\t\t}\n\n\t\t// We create a new function here on every persistent edit\n\t\t// to make sure the edit makes the post dirty and creates\n\t\t// a new undo level.\n\t\tedits.content = ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t__unstableSerializeAndClean( blocksForSerialization );\n\t}\n\tyield* editPost( edits );\n}\n\n/*\n * Returns an action object used in signalling that the post editor settings have been updated.\n *\n * @param {Object} settings Updated settings\n *\n * @return {Object} Action object\n */\nexport function updateEditorSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_EDITOR_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Backward compatibility\n */\n\nconst getBlockEditorAction = ( name ) =>\n\tfunction* ( ...args ) {\n\t\tdeprecated( \"`wp.data.dispatch( 'core/editor' ).\" + name + '`', {\n\t\t\tsince: '5.3',\n\t\t\talternative:\n\t\t\t\t\"`wp.data.dispatch( 'core/block-editor' ).\" + name + '`',\n\t\t} );\n\t\tyield controls.dispatch( blockEditorStore, name, ...args );\n\t};\n\n/**\n * @see resetBlocks in core/block-editor store.\n */\nexport const resetBlocks = getBlockEditorAction( 'resetBlocks' );\n\n/**\n * @see receiveBlocks in core/block-editor store.\n */\nexport const receiveBlocks = getBlockEditorAction( 'receiveBlocks' );\n\n/**\n * @see updateBlock in core/block-editor store.\n */\nexport const updateBlock = getBlockEditorAction( 'updateBlock' );\n\n/**\n * @see updateBlockAttributes in core/block-editor store.\n */\nexport const updateBlockAttributes = getBlockEditorAction(\n\t'updateBlockAttributes'\n);\n\n/**\n * @see selectBlock in core/block-editor store.\n */\nexport const selectBlock = getBlockEditorAction( 'selectBlock' );\n\n/**\n * @see startMultiSelect in core/block-editor store.\n */\nexport const startMultiSelect = getBlockEditorAction( 'startMultiSelect' );\n\n/**\n * @see stopMultiSelect in core/block-editor store.\n */\nexport const stopMultiSelect = getBlockEditorAction( 'stopMultiSelect' );\n\n/**\n * @see multiSelect in core/block-editor store.\n */\nexport const multiSelect = getBlockEditorAction( 'multiSelect' );\n\n/**\n * @see clearSelectedBlock in core/block-editor store.\n */\nexport const clearSelectedBlock = getBlockEditorAction( 'clearSelectedBlock' );\n\n/**\n * @see toggleSelection in core/block-editor store.\n */\nexport const toggleSelection = getBlockEditorAction( 'toggleSelection' );\n\n/**\n * @see replaceBlocks in core/block-editor store.\n */\nexport const replaceBlocks = getBlockEditorAction( 'replaceBlocks' );\n\n/**\n * @see replaceBlock in core/block-editor store.\n */\nexport const replaceBlock = getBlockEditorAction( 'replaceBlock' );\n\n/**\n * @see moveBlocksDown in core/block-editor store.\n */\nexport const moveBlocksDown = getBlockEditorAction( 'moveBlocksDown' );\n\n/**\n * @see moveBlocksUp in core/block-editor store.\n */\nexport const moveBlocksUp = getBlockEditorAction( 'moveBlocksUp' );\n\n/**\n * @see moveBlockToPosition in core/block-editor store.\n */\nexport const moveBlockToPosition = getBlockEditorAction(\n\t'moveBlockToPosition'\n);\n\n/**\n * @see insertBlock in core/block-editor store.\n */\nexport const insertBlock = getBlockEditorAction( 'insertBlock' );\n\n/**\n * @see insertBlocks in core/block-editor store.\n */\nexport const insertBlocks = getBlockEditorAction( 'insertBlocks' );\n\n/**\n * @see showInsertionPoint in core/block-editor store.\n */\nexport const showInsertionPoint = getBlockEditorAction( 'showInsertionPoint' );\n\n/**\n * @see hideInsertionPoint in core/block-editor store.\n */\nexport const hideInsertionPoint = getBlockEditorAction( 'hideInsertionPoint' );\n\n/**\n * @see setTemplateValidity in core/block-editor store.\n */\nexport const setTemplateValidity = getBlockEditorAction(\n\t'setTemplateValidity'\n);\n\n/**\n * @see synchronizeTemplate in core/block-editor store.\n */\nexport const synchronizeTemplate = getBlockEditorAction(\n\t'synchronizeTemplate'\n);\n\n/**\n * @see mergeBlocks in core/block-editor store.\n */\nexport const mergeBlocks = getBlockEditorAction( 'mergeBlocks' );\n\n/**\n * @see removeBlocks in core/block-editor store.\n */\nexport const removeBlocks = getBlockEditorAction( 'removeBlocks' );\n\n/**\n * @see removeBlock in core/block-editor store.\n */\nexport const removeBlock = getBlockEditorAction( 'removeBlock' );\n\n/**\n * @see toggleBlockMode in core/block-editor store.\n */\nexport const toggleBlockMode = getBlockEditorAction( 'toggleBlockMode' );\n\n/**\n * @see startTyping in core/block-editor store.\n */\nexport const startTyping = getBlockEditorAction( 'startTyping' );\n\n/**\n * @see stopTyping in core/block-editor store.\n */\nexport const stopTyping = getBlockEditorAction( 'stopTyping' );\n\n/**\n * @see enterFormattedText in core/block-editor store.\n */\nexport const enterFormattedText = getBlockEditorAction( 'enterFormattedText' );\n\n/**\n * @see exitFormattedText in core/block-editor store.\n */\nexport const exitFormattedText = getBlockEditorAction( 'exitFormattedText' );\n\n/**\n * @see insertDefaultBlock in core/block-editor store.\n */\nexport const insertDefaultBlock = getBlockEditorAction( 'insertDefaultBlock' );\n\n/**\n * @see updateBlockListSettings in core/block-editor store.\n */\nexport const updateBlockListSettings = getBlockEditorAction(\n\t'updateBlockListSettings'\n);\n"]}
|
|
@@ -11,7 +11,8 @@ export * from './actions.js';
|
|
|
11
11
|
* @return {Object} Action object.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
export function togglePostTitleSelection(
|
|
14
|
+
export function togglePostTitleSelection() {
|
|
15
|
+
let isSelected = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
15
16
|
return {
|
|
16
17
|
type: 'TOGGLE_POST_TITLE_SELECTION',
|
|
17
18
|
isSelected
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/store/actions.native.js"],"names":["RNReactNativeGutenbergBridge","togglePostTitleSelection","isSelected","type","autosave","editorDidAutosave"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,4BAAP,MAAyC,gCAAzC;AAEA,cAAc,cAAd;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,wBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/store/actions.native.js"],"names":["RNReactNativeGutenbergBridge","togglePostTitleSelection","isSelected","type","autosave","editorDidAutosave"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,4BAAP,MAAyC,gCAAzC;AAEA,cAAc,cAAd;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,wBAAT,GAAuD;AAAA,MAApBC,UAAoB,uEAAP,IAAO;AAC7D,SAAO;AACNC,IAAAA,IAAI,EAAE,6BADA;AAEND,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;;AACA,OAAO,UAAUE,QAAV,GAAqB;AAC3BJ,EAAAA,4BAA4B,CAACK,iBAA7B;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport RNReactNativeGutenbergBridge from '@wordpress/react-native-bridge';\n\nexport * from './actions.js';\n\n/**\n * Returns an action object that enables or disables post title selection.\n *\n * @param {boolean} [isSelected=true] Whether post title is currently selected.\n *\n * @return {Object} Action object.\n */\nexport function togglePostTitleSelection( isSelected = true ) {\n\treturn {\n\t\ttype: 'TOGGLE_POST_TITLE_SELECTION',\n\t\tisSelected,\n\t};\n}\n\n/**\n * Action generator used in signalling that the post should autosave.\n */\nexport function* autosave() {\n\tRNReactNativeGutenbergBridge.editorDidAutosave();\n}\n"]}
|
|
@@ -30,13 +30,14 @@ export function localAutosaveClear(postId, isPostNew) {
|
|
|
30
30
|
window.sessionStorage.removeItem(postKey(postId, isPostNew));
|
|
31
31
|
}
|
|
32
32
|
const controls = {
|
|
33
|
-
LOCAL_AUTOSAVE_SET({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
LOCAL_AUTOSAVE_SET(_ref) {
|
|
34
|
+
let {
|
|
35
|
+
postId,
|
|
36
|
+
isPostNew,
|
|
37
|
+
title,
|
|
38
|
+
content,
|
|
39
|
+
excerpt
|
|
40
|
+
} = _ref;
|
|
40
41
|
localAutosaveSet(postId, isPostNew, title, content, excerpt);
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/store/controls.js"],"names":["postKey","postId","isPostNew","localAutosaveGet","window","sessionStorage","getItem","localAutosaveSet","title","content","excerpt","setItem","JSON","stringify","post_title","localAutosaveClear","removeItem","controls","LOCAL_AUTOSAVE_SET"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAT,CAAkBC,MAAlB,EAA0BC,SAA1B,EAAsC;AACrC,SAAQ,iCACPA,SAAS,GAAG,YAAH,GAAkBD,MAC3B,EAFD;AAGA;;AAED,OAAO,SAASE,gBAAT,CAA2BF,MAA3B,EAAmCC,SAAnC,EAA+C;AACrD,SAAOE,MAAM,CAACC,cAAP,CAAsBC,OAAtB,CAA+BN,OAAO,CAAEC,MAAF,EAAUC,SAAV,CAAtC,CAAP;AACA;AAED,OAAO,SAASK,gBAAT,CAA2BN,MAA3B,EAAmCC,SAAnC,EAA8CM,KAA9C,EAAqDC,OAArD,EAA8DC,OAA9D,EAAwE;AAC9EN,EAAAA,MAAM,CAACC,cAAP,CAAsBM,OAAtB,CACCX,OAAO,CAAEC,MAAF,EAAUC,SAAV,CADR,EAECU,IAAI,CAACC,SAAL,CAAgB;AACfC,IAAAA,UAAU,EAAEN,KADG;AAEfC,IAAAA,OAFe;AAGfC,IAAAA;AAHe,GAAhB,CAFD;AAQA;AAED,OAAO,SAASK,kBAAT,CAA6Bd,MAA7B,EAAqCC,SAArC,EAAiD;AACvDE,EAAAA,MAAM,CAACC,cAAP,CAAsBW,UAAtB,CAAkChB,OAAO,CAAEC,MAAF,EAAUC,SAAV,CAAzC;AACA;AAED,MAAMe,QAAQ,GAAG;AAChBC,EAAAA,kBAAkB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/store/controls.js"],"names":["postKey","postId","isPostNew","localAutosaveGet","window","sessionStorage","getItem","localAutosaveSet","title","content","excerpt","setItem","JSON","stringify","post_title","localAutosaveClear","removeItem","controls","LOCAL_AUTOSAVE_SET"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAT,CAAkBC,MAAlB,EAA0BC,SAA1B,EAAsC;AACrC,SAAQ,iCACPA,SAAS,GAAG,YAAH,GAAkBD,MAC3B,EAFD;AAGA;;AAED,OAAO,SAASE,gBAAT,CAA2BF,MAA3B,EAAmCC,SAAnC,EAA+C;AACrD,SAAOE,MAAM,CAACC,cAAP,CAAsBC,OAAtB,CAA+BN,OAAO,CAAEC,MAAF,EAAUC,SAAV,CAAtC,CAAP;AACA;AAED,OAAO,SAASK,gBAAT,CAA2BN,MAA3B,EAAmCC,SAAnC,EAA8CM,KAA9C,EAAqDC,OAArD,EAA8DC,OAA9D,EAAwE;AAC9EN,EAAAA,MAAM,CAACC,cAAP,CAAsBM,OAAtB,CACCX,OAAO,CAAEC,MAAF,EAAUC,SAAV,CADR,EAECU,IAAI,CAACC,SAAL,CAAgB;AACfC,IAAAA,UAAU,EAAEN,KADG;AAEfC,IAAAA,OAFe;AAGfC,IAAAA;AAHe,GAAhB,CAFD;AAQA;AAED,OAAO,SAASK,kBAAT,CAA6Bd,MAA7B,EAAqCC,SAArC,EAAiD;AACvDE,EAAAA,MAAM,CAACC,cAAP,CAAsBW,UAAtB,CAAkChB,OAAO,CAAEC,MAAF,EAAUC,SAAV,CAAzC;AACA;AAED,MAAMe,QAAQ,GAAG;AAChBC,EAAAA,kBAAkB,OAAmD;AAAA,QAAjD;AAAEjB,MAAAA,MAAF;AAAUC,MAAAA,SAAV;AAAqBM,MAAAA,KAArB;AAA4BC,MAAAA,OAA5B;AAAqCC,MAAAA;AAArC,KAAiD;AACpEH,IAAAA,gBAAgB,CAAEN,MAAF,EAAUC,SAAV,EAAqBM,KAArB,EAA4BC,OAA5B,EAAqCC,OAArC,CAAhB;AACA;;AAHe,CAAjB;AAMA,eAAeO,QAAf","sourcesContent":["/**\n * Function returning a sessionStorage key to set or retrieve a given post's\n * automatic session backup.\n *\n * Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's\n * `loggedout` handler can clear sessionStorage of any user-private content.\n *\n * @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103\n *\n * @param {string} postId Post ID.\n * @param {boolean} isPostNew Whether post new.\n *\n * @return {string} sessionStorage key\n */\nfunction postKey( postId, isPostNew ) {\n\treturn `wp-autosave-block-editor-post-${\n\t\tisPostNew ? 'auto-draft' : postId\n\t}`;\n}\n\nexport function localAutosaveGet( postId, isPostNew ) {\n\treturn window.sessionStorage.getItem( postKey( postId, isPostNew ) );\n}\n\nexport function localAutosaveSet( postId, isPostNew, title, content, excerpt ) {\n\twindow.sessionStorage.setItem(\n\t\tpostKey( postId, isPostNew ),\n\t\tJSON.stringify( {\n\t\t\tpost_title: title,\n\t\t\tcontent,\n\t\t\texcerpt,\n\t\t} )\n\t);\n}\n\nexport function localAutosaveClear( postId, isPostNew ) {\n\twindow.sessionStorage.removeItem( postKey( postId, isPostNew ) );\n}\n\nconst controls = {\n\tLOCAL_AUTOSAVE_SET( { postId, isPostNew, title, content, excerpt } ) {\n\t\tlocalAutosaveSet( postId, isPostNew, title, content, excerpt );\n\t},\n};\n\nexport default controls;\n"]}
|
|
@@ -77,7 +77,10 @@ export function shouldOverwriteState(action, previousAction) {
|
|
|
77
77
|
|
|
78
78
|
return isUpdatingSamePostProperty(action, previousAction);
|
|
79
79
|
}
|
|
80
|
-
export function postId(
|
|
80
|
+
export function postId() {
|
|
81
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
82
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
83
|
+
|
|
81
84
|
switch (action.type) {
|
|
82
85
|
case 'SETUP_EDITOR_STATE':
|
|
83
86
|
case 'RESET_POST':
|
|
@@ -86,7 +89,10 @@ export function postId(state = null, action) {
|
|
|
86
89
|
|
|
87
90
|
return state;
|
|
88
91
|
}
|
|
89
|
-
export function postType(
|
|
92
|
+
export function postType() {
|
|
93
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
94
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
95
|
+
|
|
90
96
|
switch (action.type) {
|
|
91
97
|
case 'SETUP_EDITOR_STATE':
|
|
92
98
|
case 'RESET_POST':
|
|
@@ -104,9 +110,12 @@ export function postType(state = null, action) {
|
|
|
104
110
|
* @return {boolean} Updated state.
|
|
105
111
|
*/
|
|
106
112
|
|
|
107
|
-
export function template(
|
|
108
|
-
|
|
109
|
-
|
|
113
|
+
export function template() {
|
|
114
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
115
|
+
isValid: true
|
|
116
|
+
};
|
|
117
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
118
|
+
|
|
110
119
|
switch (action.type) {
|
|
111
120
|
case 'SET_TEMPLATE_VALIDITY':
|
|
112
121
|
return { ...state,
|
|
@@ -125,7 +134,10 @@ export function template(state = {
|
|
|
125
134
|
* @return {string} Updated state.
|
|
126
135
|
*/
|
|
127
136
|
|
|
128
|
-
export function preferences(
|
|
137
|
+
export function preferences() {
|
|
138
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PREFERENCES_DEFAULTS;
|
|
139
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
140
|
+
|
|
129
141
|
switch (action.type) {
|
|
130
142
|
case 'ENABLE_PUBLISH_SIDEBAR':
|
|
131
143
|
return { ...state,
|
|
@@ -150,7 +162,10 @@ export function preferences(state = PREFERENCES_DEFAULTS, action) {
|
|
|
150
162
|
* @return {Object} Updated state.
|
|
151
163
|
*/
|
|
152
164
|
|
|
153
|
-
export function saving(
|
|
165
|
+
export function saving() {
|
|
166
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
167
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
168
|
+
|
|
154
169
|
switch (action.type) {
|
|
155
170
|
case 'REQUEST_POST_UPDATE_START':
|
|
156
171
|
case 'REQUEST_POST_UPDATE_FINISH':
|
|
@@ -182,9 +197,12 @@ export function saving(state = {}, action) {
|
|
|
182
197
|
* @return {PostLockState} Updated state.
|
|
183
198
|
*/
|
|
184
199
|
|
|
185
|
-
export function postLock(
|
|
186
|
-
|
|
187
|
-
|
|
200
|
+
export function postLock() {
|
|
201
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
202
|
+
isLocked: false
|
|
203
|
+
};
|
|
204
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
205
|
+
|
|
188
206
|
switch (action.type) {
|
|
189
207
|
case 'UPDATE_POST_LOCK':
|
|
190
208
|
return action.lock;
|
|
@@ -203,7 +221,10 @@ export function postLock(state = {
|
|
|
203
221
|
* @return {PostLockState} Updated state.
|
|
204
222
|
*/
|
|
205
223
|
|
|
206
|
-
export function postSavingLock(
|
|
224
|
+
export function postSavingLock() {
|
|
225
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
226
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
227
|
+
|
|
207
228
|
switch (action.type) {
|
|
208
229
|
case 'LOCK_POST_SAVING':
|
|
209
230
|
return { ...state,
|
|
@@ -227,7 +248,10 @@ export function postSavingLock(state = {}, action) {
|
|
|
227
248
|
* @return {PostLockState} Updated state.
|
|
228
249
|
*/
|
|
229
250
|
|
|
230
|
-
export function postAutosavingLock(
|
|
251
|
+
export function postAutosavingLock() {
|
|
252
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
253
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
254
|
+
|
|
231
255
|
switch (action.type) {
|
|
232
256
|
case 'LOCK_POST_AUTOSAVING':
|
|
233
257
|
return { ...state,
|
|
@@ -251,7 +275,10 @@ export function postAutosavingLock(state = {}, action) {
|
|
|
251
275
|
* @return {boolean} Updated state.
|
|
252
276
|
*/
|
|
253
277
|
|
|
254
|
-
export function isReady(
|
|
278
|
+
export function isReady() {
|
|
279
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
280
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
281
|
+
|
|
255
282
|
switch (action.type) {
|
|
256
283
|
case 'SETUP_EDITOR_STATE':
|
|
257
284
|
return true;
|
|
@@ -271,7 +298,10 @@ export function isReady(state = false, action) {
|
|
|
271
298
|
* @return {Object} Updated state.
|
|
272
299
|
*/
|
|
273
300
|
|
|
274
|
-
export function editorSettings(
|
|
301
|
+
export function editorSettings() {
|
|
302
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : EDITOR_SETTINGS_DEFAULTS;
|
|
303
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
304
|
+
|
|
275
305
|
switch (action.type) {
|
|
276
306
|
case 'UPDATE_EDITOR_SETTINGS':
|
|
277
307
|
return { ...state,
|