@wordpress/edit-post 7.10.0 → 7.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/block-manager/category.js +14 -22
- package/build/components/block-manager/category.js.map +1 -1
- package/build/components/block-manager/checklist.js +6 -13
- package/build/components/block-manager/checklist.js.map +1 -1
- package/build/components/block-manager/index.js +10 -14
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +21 -26
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build/components/device-preview/index.js +1 -1
- package/build/components/device-preview/index.js.map +1 -1
- package/build/components/editor-initialization/index.js +3 -4
- package/build/components/editor-initialization/index.js.map +1 -1
- package/build/components/header/document-title/index.js +103 -0
- package/build/components/header/document-title/index.js.map +1 -0
- package/build/components/header/fullscreen-mode-close/index.js +8 -9
- package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.js +4 -3
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js +12 -13
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.js +7 -6
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/main-dashboard-button/index.js +3 -4
- package/build/components/header/main-dashboard-button/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +19 -23
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/post-publish-button-or-toggle.js +15 -16
- package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build/components/header/tools-more-menu-group/index.js +7 -10
- package/build/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +44 -54
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/layout/actions-panel.js +5 -6
- package/build/components/layout/actions-panel.js.map +1 -1
- package/build/components/layout/index.js +3 -4
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/index.native.js +3 -7
- package/build/components/layout/index.native.js.map +1 -1
- package/build/components/meta-boxes/index.js +9 -13
- package/build/components/meta-boxes/index.js.map +1 -1
- package/build/components/meta-boxes/meta-box-visibility.js +5 -8
- package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build/components/meta-boxes/meta-boxes-area/index.js +3 -4
- package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js +16 -23
- package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build/components/preferences-modal/options/enable-custom-fields.js +7 -9
- package/build/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
- package/build/components/preferences-modal/options/enable-feature.js +12 -16
- package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build/components/preferences-modal/options/enable-panel.js +10 -17
- package/build/components/preferences-modal/options/enable-panel.js.map +1 -1
- package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js +7 -10
- package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +58 -44
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/discussion-panel/index.js +5 -7
- package/build/components/sidebar/discussion-panel/index.js.map +1 -1
- package/build/components/sidebar/featured-image/index.js +9 -17
- package/build/components/sidebar/featured-image/index.js.map +1 -1
- package/build/components/sidebar/page-attributes/index.js +3 -9
- package/build/components/sidebar/page-attributes/index.js.map +1 -1
- package/build/components/sidebar/plugin-document-setting-panel/index.js +20 -25
- package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-post-publish-panel/index.js +12 -15
- package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-post-status-info/index.js +6 -9
- package/build/components/sidebar/plugin-post-status-info/index.js.map +1 -1
- package/build/components/sidebar/plugin-pre-publish-panel/index.js +12 -15
- package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-sidebar/index.js +4 -5
- package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar/post-excerpt/index.js +5 -7
- package/build/components/sidebar/post-excerpt/index.js.map +1 -1
- package/build/components/sidebar/post-schedule/index.js +16 -23
- package/build/components/sidebar/post-schedule/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +7 -11
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/post-taxonomies/taxonomy-panel.js +9 -15
- package/build/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
- package/build/components/sidebar/post-template/create-modal.js +3 -4
- package/build/components/sidebar/post-template/create-modal.js.map +1 -1
- package/build/components/sidebar/post-template/form.js +13 -20
- package/build/components/sidebar/post-template/form.js.map +1 -1
- package/build/components/sidebar/post-template/index.js +18 -25
- package/build/components/sidebar/post-template/index.js.map +1 -1
- package/build/components/sidebar/post-url/index.js +16 -23
- package/build/components/sidebar/post-url/index.js.map +1 -1
- package/build/components/sidebar/post-visibility/index.js +26 -36
- package/build/components/sidebar/post-visibility/index.js.map +1 -1
- package/build/components/sidebar/settings-header/index.js +3 -4
- package/build/components/sidebar/settings-header/index.js.map +1 -1
- package/build/components/sidebar/template-summary/index.js +1 -1
- package/build/components/sidebar/template-summary/index.js.map +1 -1
- package/build/components/start-page-options/index.js +3 -4
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/view-link/index.js +1 -1
- package/build/components/view-link/index.js.map +1 -1
- package/build/components/visual-editor/block-inspector-button.js +4 -5
- package/build/components/visual-editor/block-inspector-button.js.map +1 -1
- package/build/components/visual-editor/header.native.js +6 -7
- package/build/components/visual-editor/header.native.js.map +1 -1
- package/build/components/visual-editor/index.js +32 -48
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/welcome-guide/image.js +4 -5
- package/build/components/welcome-guide/image.js.map +1 -1
- package/build/editor.js +15 -23
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +3 -6
- package/build/editor.native.js.map +1 -1
- package/build/hooks/validate-multiple-use/index.js +18 -29
- package/build/hooks/validate-multiple-use/index.js.map +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/plugins/index.js +20 -23
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +3 -4
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
- package/build/store/actions.js +60 -88
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +11 -43
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +11 -16
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-manager/category.js +14 -22
- package/build-module/components/block-manager/category.js.map +1 -1
- package/build-module/components/block-manager/checklist.js +6 -13
- package/build-module/components/block-manager/checklist.js.map +1 -1
- package/build-module/components/block-manager/index.js +10 -14
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +21 -26
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build-module/components/device-preview/index.js +1 -1
- package/build-module/components/device-preview/index.js.map +1 -1
- package/build-module/components/editor-initialization/index.js +3 -4
- package/build-module/components/editor-initialization/index.js.map +1 -1
- package/build-module/components/header/document-title/index.js +88 -0
- package/build-module/components/header/document-title/index.js.map +1 -0
- package/build-module/components/header/fullscreen-mode-close/index.js +7 -8
- package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.js +3 -3
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js +12 -13
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/index.js +7 -6
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/main-dashboard-button/index.js +3 -4
- package/build-module/components/header/main-dashboard-button/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +19 -23
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/post-publish-button-or-toggle.js +15 -16
- package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build-module/components/header/tools-more-menu-group/index.js +7 -10
- package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +42 -52
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/layout/actions-panel.js +5 -6
- package/build-module/components/layout/actions-panel.js.map +1 -1
- package/build-module/components/layout/index.js +3 -4
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/index.native.js +3 -7
- package/build-module/components/layout/index.native.js.map +1 -1
- package/build-module/components/meta-boxes/index.js +9 -13
- package/build-module/components/meta-boxes/index.js.map +1 -1
- package/build-module/components/meta-boxes/meta-box-visibility.js +5 -8
- package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build-module/components/meta-boxes/meta-boxes-area/index.js +3 -4
- package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build-module/components/preferences-modal/meta-boxes-section.js +16 -23
- package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-custom-fields.js +7 -9
- package/build-module/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-feature.js +12 -16
- package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-panel.js +10 -17
- package/build-module/components/preferences-modal/options/enable-panel.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js +7 -10
- package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +58 -44
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/discussion-panel/index.js +5 -7
- package/build-module/components/sidebar/discussion-panel/index.js.map +1 -1
- package/build-module/components/sidebar/featured-image/index.js +9 -17
- package/build-module/components/sidebar/featured-image/index.js.map +1 -1
- package/build-module/components/sidebar/page-attributes/index.js +3 -9
- package/build-module/components/sidebar/page-attributes/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js +20 -25
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js +12 -15
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-post-status-info/index.js +6 -9
- package/build-module/components/sidebar/plugin-post-status-info/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +12 -15
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +4 -5
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/post-excerpt/index.js +5 -7
- package/build-module/components/sidebar/post-excerpt/index.js.map +1 -1
- package/build-module/components/sidebar/post-schedule/index.js +16 -23
- package/build-module/components/sidebar/post-schedule/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +7 -11
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js +9 -15
- package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
- package/build-module/components/sidebar/post-template/create-modal.js +3 -4
- package/build-module/components/sidebar/post-template/create-modal.js.map +1 -1
- package/build-module/components/sidebar/post-template/form.js +13 -20
- package/build-module/components/sidebar/post-template/form.js.map +1 -1
- package/build-module/components/sidebar/post-template/index.js +18 -25
- package/build-module/components/sidebar/post-template/index.js.map +1 -1
- package/build-module/components/sidebar/post-url/index.js +16 -23
- package/build-module/components/sidebar/post-url/index.js.map +1 -1
- package/build-module/components/sidebar/post-visibility/index.js +26 -36
- package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
- package/build-module/components/sidebar/settings-header/index.js +3 -4
- package/build-module/components/sidebar/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar/template-summary/index.js +1 -1
- package/build-module/components/sidebar/template-summary/index.js.map +1 -1
- package/build-module/components/start-page-options/index.js +3 -4
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/view-link/index.js +1 -1
- package/build-module/components/view-link/index.js.map +1 -1
- package/build-module/components/visual-editor/block-inspector-button.js +4 -5
- package/build-module/components/visual-editor/block-inspector-button.js.map +1 -1
- package/build-module/components/visual-editor/header.native.js +6 -7
- package/build-module/components/visual-editor/header.native.js.map +1 -1
- package/build-module/components/visual-editor/index.js +35 -49
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/welcome-guide/image.js +4 -5
- package/build-module/components/welcome-guide/image.js.map +1 -1
- package/build-module/editor.js +15 -23
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +3 -6
- package/build-module/editor.native.js.map +1 -1
- package/build-module/hooks/validate-multiple-use/index.js +18 -29
- package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
- package/build-module/index.js +2 -2
- package/build-module/index.js.map +1 -1
- package/build-module/plugins/index.js +20 -23
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +3 -4
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
- package/build-module/store/actions.js +60 -88
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +11 -43
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +11 -16
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/classic-rtl.css +1 -1
- package/build-style/classic.css +1 -1
- package/build-style/style-rtl.css +74 -114
- package/build-style/style.css +74 -114
- package/package.json +33 -33
- package/src/components/header/document-title/index.js +86 -0
- package/src/components/header/document-title/style.scss +61 -0
- package/src/components/header/header-toolbar/index.js +2 -2
- package/src/components/header/header-toolbar/style.scss +0 -1
- package/src/components/header/index.js +4 -2
- package/src/components/header/style.scss +6 -0
- package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +1 -3
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +2 -6
- package/src/components/secondary-sidebar/list-view-sidebar.js +68 -66
- package/src/components/secondary-sidebar/style.scss +28 -31
- package/src/components/visual-editor/index.js +10 -21
- package/src/components/visual-editor/style.scss +0 -13
- package/src/editor.js +1 -3
- package/src/index.js +3 -2
- package/src/style.scss +1 -1
- package/build/components/header/template-title/delete-template.js +0 -117
- package/build/components/header/template-title/delete-template.js.map +0 -1
- package/build/components/header/template-title/edit-template-title.js +0 -95
- package/build/components/header/template-title/edit-template-title.js.map +0 -1
- package/build/components/header/template-title/index.js +0 -124
- package/build/components/header/template-title/index.js.map +0 -1
- package/build/components/header/template-title/template-description.js +0 -55
- package/build/components/header/template-title/template-description.js.map +0 -1
- package/build-module/components/header/template-title/delete-template.js +0 -104
- package/build-module/components/header/template-title/delete-template.js.map +0 -1
- package/build-module/components/header/template-title/edit-template-title.js +0 -83
- package/build-module/components/header/template-title/edit-template-title.js.map +0 -1
- package/build-module/components/header/template-title/index.js +0 -105
- package/build-module/components/header/template-title/index.js.map +0 -1
- package/build-module/components/header/template-title/template-description.js +0 -45
- package/build-module/components/header/template-title/template-description.js.map +0 -1
- package/src/components/header/template-title/delete-template.js +0 -106
- package/src/components/header/template-title/edit-template-title.js +0 -78
- package/src/components/header/template-title/index.js +0 -115
- package/src/components/header/template-title/style.scss +0 -94
- package/src/components/header/template-title/template-description.js +0 -42
|
@@ -46,32 +46,24 @@ const enhance = (0, _compose.compose)(
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
const blocks = select(_blockEditor.store).getBlocks();
|
|
49
|
-
const firstOfSameType = blocks.find(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
} = _ref;
|
|
53
|
-
return block.name === name;
|
|
54
|
-
});
|
|
49
|
+
const firstOfSameType = blocks.find(({
|
|
50
|
+
name
|
|
51
|
+
}) => block.name === name);
|
|
55
52
|
const isInvalid = firstOfSameType && firstOfSameType.clientId !== block.clientId;
|
|
56
53
|
return {
|
|
57
54
|
originalBlockClientId: isInvalid && firstOfSameType.clientId
|
|
58
55
|
};
|
|
59
|
-
}), (0, _data.withDispatch)((dispatch,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
selectFirst: () => dispatch(_blockEditor.store).selectBlock(originalBlockClientId)
|
|
65
|
-
};
|
|
66
|
-
}));
|
|
56
|
+
}), (0, _data.withDispatch)((dispatch, {
|
|
57
|
+
originalBlockClientId
|
|
58
|
+
}) => ({
|
|
59
|
+
selectFirst: () => dispatch(_blockEditor.store).selectBlock(originalBlockClientId)
|
|
60
|
+
})));
|
|
67
61
|
const withMultipleValidation = (0, _compose.createHigherOrderComponent)(BlockEdit => {
|
|
68
|
-
return enhance(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
} = _ref3;
|
|
74
|
-
|
|
62
|
+
return enhance(({
|
|
63
|
+
originalBlockClientId,
|
|
64
|
+
selectFirst,
|
|
65
|
+
...props
|
|
66
|
+
}) => {
|
|
75
67
|
if (!originalBlockClientId) {
|
|
76
68
|
return (0, _element.createElement)(BlockEdit, props);
|
|
77
69
|
}
|
|
@@ -100,7 +92,7 @@ const withMultipleValidation = (0, _compose.createHigherOrderComponent)(BlockEdi
|
|
|
100
92
|
variant: "secondary",
|
|
101
93
|
onClick: () => props.onReplace((0, _blocks.createBlock)(outboundType.name, props.attributes))
|
|
102
94
|
}, (0, _i18n.__)('Transform into:'), " ", outboundType.title)]
|
|
103
|
-
}, (0, _element.createElement)("strong", null, blockType
|
|
95
|
+
}, (0, _element.createElement)("strong", null, blockType?.title, ": "), (0, _i18n.__)('This block can only be used once.'))];
|
|
104
96
|
});
|
|
105
97
|
}, 'withMultipleValidation');
|
|
106
98
|
/**
|
|
@@ -114,13 +106,10 @@ const withMultipleValidation = (0, _compose.createHigherOrderComponent)(BlockEdi
|
|
|
114
106
|
|
|
115
107
|
function getOutboundType(blockName) {
|
|
116
108
|
// Grab the first outbound transform.
|
|
117
|
-
const transform = (0, _blocks.findTransform)((0, _blocks.getBlockTransforms)('to', blockName),
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
} = _ref4;
|
|
122
|
-
return type === 'block' && blocks.length === 1;
|
|
123
|
-
} // What about when .length > 1?
|
|
109
|
+
const transform = (0, _blocks.findTransform)((0, _blocks.getBlockTransforms)('to', blockName), ({
|
|
110
|
+
type,
|
|
111
|
+
blocks
|
|
112
|
+
}) => type === 'block' && blocks.length === 1 // What about when .length > 1?
|
|
124
113
|
);
|
|
125
114
|
|
|
126
115
|
if (!transform) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/hooks/validate-multiple-use/index.js"],"names":["enhance","select","block","multiple","name","blocks","blockEditorStore","getBlocks","firstOfSameType","find","isInvalid","clientId","originalBlockClientId","dispatch","selectFirst","selectBlock","withMultipleValidation","BlockEdit","props","blockType","outboundType","getOutboundType","minHeight","onReplace","attributes","title","blockName","transform","type","length"],"mappings":";;;;;;;;AAGA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAfA;AACA;AACA;AAeA,MAAMA,OAAO,GAAG;AACf;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACC,sBAAY,CAAEC,MAAF,EAAUC,KAAV,KAAqB;AAChC,QAAMC,QAAQ,GAAG,6BAAiBD,KAAK,CAACE,IAAvB,EAA6B,UAA7B,EAAyC,IAAzC,CAAjB,CADgC,CAGhC;AACA;;AACA,MAAKD,QAAL,EAAgB;AACf,WAAO,EAAP;AACA,GAP+B,CAShC;AACA;;;AACA,QAAME,MAAM,GAAGJ,MAAM,CAAEK,kBAAF,CAAN,CAA2BC,SAA3B,EAAf;AACA,QAAMC,eAAe,GAAGH,MAAM,CAACI,IAAP,CACvB
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/hooks/validate-multiple-use/index.js"],"names":["enhance","select","block","multiple","name","blocks","blockEditorStore","getBlocks","firstOfSameType","find","isInvalid","clientId","originalBlockClientId","dispatch","selectFirst","selectBlock","withMultipleValidation","BlockEdit","props","blockType","outboundType","getOutboundType","minHeight","onReplace","attributes","title","blockName","transform","type","length"],"mappings":";;;;;;;;AAGA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAfA;AACA;AACA;AAeA,MAAMA,OAAO,GAAG;AACf;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACC,sBAAY,CAAEC,MAAF,EAAUC,KAAV,KAAqB;AAChC,QAAMC,QAAQ,GAAG,6BAAiBD,KAAK,CAACE,IAAvB,EAA6B,UAA7B,EAAyC,IAAzC,CAAjB,CADgC,CAGhC;AACA;;AACA,MAAKD,QAAL,EAAgB;AACf,WAAO,EAAP;AACA,GAP+B,CAShC;AACA;;;AACA,QAAME,MAAM,GAAGJ,MAAM,CAAEK,kBAAF,CAAN,CAA2BC,SAA3B,EAAf;AACA,QAAMC,eAAe,GAAGH,MAAM,CAACI,IAAP,CACvB,CAAE;AAAEL,IAAAA;AAAF,GAAF,KAAgBF,KAAK,CAACE,IAAN,KAAeA,IADR,CAAxB;AAGA,QA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A,OAAO,EAAG,MAAMI,KAAK,CAACK,SAAN,CAAiB,EAAjB;AAHjB,SAKG,cAAI,QAAJ,CALH,CARS,EAeTH,YAAY,IACX,4BAAC,kBAAD;AACC,QAAA,GAAG,EAAC,WADL;AAEC,QAAA,OAAO,EAAC,WAFT;AAGC,QAAA,OAAO,EAAG,MACTF,KAAK,CAACK,SAAN,CACC,yBACCH,YAAY,CAAChB,IADd,EAECc,KAAK,CAACM,UAFP,CADD;AAJF,SAYG,cAAI,iBAAJ,CAZH,OAY+BJ,YAAY,CAACK,KAZ5C,CAhBQ;AAFX,OAmCC,4CAAUN,SAAS,EAAEM,KAArB,OAnCD,EAoCG,cAAI,mCAAJ,CApCH,CAJM,CAAP;AA2CA,GAnDa,CAAd;AAoDA,CArD8B,EAqD5B,wBArD4B,CAA/B;AAuDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASJ,eAAT,CAA0BK,SAA1B,EAAsC;AACrC;AACA,QAAMC,SAAS,GAAG,2BACjB,gCAAoB,IAApB,EAA0BD,SAA1B,CADiB,EAEjB,CAAE;AAAEE,IAAAA,IAAF;AAAQvB,IAAAA;AAAR,GAAF,KAAwBuB,IAAI,KAAK,OAAT,IAAoBvB,MAAM,CAACwB,MAAP,KAAkB,CAF7C,CAE+C;AAF/C,GAAlB;;AAKA,MAAK,CAAEF,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,SAAO,0BAAcA,SAAS,CAACtB,MAAV,CAAkB,CAAlB,CAAd,CAAP;AACA;;AAED,sBACC,kBADD,EAEC,+DAFD,EAGCW,sBAHD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { Button } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { Warning, store as blockEditorStore } from '@wordpress/block-editor';\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { compose, createHigherOrderComponent } from '@wordpress/compose';\n\nconst enhance = compose(\n\t/**\n\t * For blocks whose block type doesn't support `multiple`, provides the\n\t * wrapped component with `originalBlockClientId` -- a reference to the\n\t * first block of the same type in the content -- if and only if that\n\t * \"original\" block is not the current one. Thus, an inexisting\n\t * `originalBlockClientId` prop signals that the block is valid.\n\t *\n\t * @param {WPComponent} WrappedBlockEdit A filtered BlockEdit instance.\n\t *\n\t * @return {WPComponent} Enhanced component with merged state data props.\n\t */\n\twithSelect( ( select, block ) => {\n\t\tconst multiple = hasBlockSupport( block.name, 'multiple', true );\n\n\t\t// For block types with `multiple` support, there is no \"original\n\t\t// block\" to be found in the content, as the block itself is valid.\n\t\tif ( multiple ) {\n\t\t\treturn {};\n\t\t}\n\n\t\t// Otherwise, only pass `originalBlockClientId` if it refers to a different\n\t\t// block from the current one.\n\t\tconst blocks = select( blockEditorStore ).getBlocks();\n\t\tconst firstOfSameType = blocks.find(\n\t\t\t( { name } ) => block.name === name\n\t\t);\n\t\tconst isInvalid =\n\t\t\tfirstOfSameType && firstOfSameType.clientId !== block.clientId;\n\t\treturn {\n\t\t\toriginalBlockClientId: isInvalid && firstOfSameType.clientId,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { originalBlockClientId } ) => ( {\n\t\tselectFirst: () =>\n\t\t\tdispatch( blockEditorStore ).selectBlock( originalBlockClientId ),\n\t} ) )\n);\n\nconst withMultipleValidation = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn enhance( ( { originalBlockClientId, selectFirst, ...props } ) => {\n\t\tif ( ! originalBlockClientId ) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\n\t\tconst blockType = getBlockType( props.name );\n\t\tconst outboundType = getOutboundType( props.name );\n\n\t\treturn [\n\t\t\t<div key=\"invalid-preview\" style={ { minHeight: '60px' } }>\n\t\t\t\t<BlockEdit key=\"block-edit\" { ...props } />\n\t\t\t</div>,\n\t\t\t<Warning\n\t\t\t\tkey=\"multiple-use-warning\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"find-original\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ selectFirst }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Find original' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"remove\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ () => props.onReplace( [] ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\toutboundType && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey=\"transform\"\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tprops.onReplace(\n\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\toutboundType.name,\n\t\t\t\t\t\t\t\t\t\tprops.attributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Transform into:' ) } { outboundType.title }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t),\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t<strong>{ blockType?.title }: </strong>\n\t\t\t\t{ __( 'This block can only be used once.' ) }\n\t\t\t</Warning>,\n\t\t];\n\t} );\n}, 'withMultipleValidation' );\n\n/**\n * Given a base block name, returns the default block type to which to offer\n * transforms.\n *\n * @param {string} blockName Base block name.\n *\n * @return {?Object} The chosen default block type.\n */\nfunction getOutboundType( blockName ) {\n\t// Grab the first outbound transform.\n\tconst transform = findTransform(\n\t\tgetBlockTransforms( 'to', blockName ),\n\t\t( { type, blocks } ) => type === 'block' && blocks.length === 1 // What about when .length > 1?\n\t);\n\n\tif ( ! transform ) {\n\t\treturn null;\n\t}\n\n\treturn getBlockType( transform.blocks[ 0 ] );\n}\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-post/validate-multiple-use/with-multiple-validation',\n\twithMultipleValidation\n);\n"]}
|
package/build/index.js
CHANGED
|
@@ -178,7 +178,7 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
|
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
/*
|
|
181
|
-
* Prevent adding template part in the post editor.
|
|
181
|
+
* Prevent adding template part and post content block in the post editor.
|
|
182
182
|
* Only add the filter when the post editor is initialized, not imported.
|
|
183
183
|
* Also only add the filter(s) after registerCoreBlocks()
|
|
184
184
|
* so that common filters in the block library are not overwritten.
|
|
@@ -186,7 +186,7 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
|
|
|
186
186
|
|
|
187
187
|
|
|
188
188
|
(0, _hooks.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (canInsert, blockType) => {
|
|
189
|
-
if (!(0, _data.select)(_store.store).isEditingTemplate() && blockType.name === 'core/template-part') {
|
|
189
|
+
if (!(0, _data.select)(_store.store).isEditingTemplate() && (blockType.name === 'core/template-part' || blockType.name === 'core/post-content')) {
|
|
190
190
|
return false;
|
|
191
191
|
}
|
|
192
192
|
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/index.js"],"names":["initializeEditor","id","postType","postId","settings","initialEdits","target","document","getElementById","root","preferencesStore","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","themeStyles","welcomeGuide","welcomeGuideTemplate","blocksStore","__experimentalReapplyBlockTypeFilters","editPostStore","isFeatureActive","setIsListViewOpened","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","canInsert","blockType","isEditingTemplate","name","documentMode","compatMode","console","warn","isIphone","window","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","reinitializeEditor","since","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;AANA;;AACA;;AAIA;;AAEA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AACA;;AA8IA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA/KA;AACA;AACA;;AAgBA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CACNC,EADM,EAENC,QAFM,EAGNC,MAHM,EAINC,QAJM,EAKNC,YALM,EAML;AACD,QAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAT,CAAyBP,EAAzB,CAAf;AACA,QAAMQ,IAAI,GAAG,yBAAYH,MAAZ,CAAb;AAEA,sBAAUI,kBAAV,EAA6BC,WAA7B,CAA0C,gBAA1C,EAA4D;AAC3DC,IAAAA,UAAU,EAAE,QAD+C;AAE3DC,IAAAA,YAAY,EAAE,KAF6C;AAG3DC,IAAAA,cAAc,EAAE,IAH2C;AAI3DC,IAAAA,gBAAgB,EAAE,EAJyC;AAK3DC,IAAAA,cAAc,EAAE,EAL2C;AAM3DC,IAAAA,uBAAuB,EAAE,IANkC;AAO3DC,IAAAA,UAAU,EAAE,CAAE,aAAF,CAP+C;AAQ3DC,IAAAA,wBAAwB,EAAE,EARiC;AAS3DC,IAAAA,oBAAoB,EAAE,IATqC;AAU3DC,IAAAA,cAAc,EAAE,KAV2C;AAW3DC,IAAAA,qBAAqB,EAAE,KAXoC;AAY3DC,IAAAA,WAAW,EAAE,IAZ8C;AAa3DC,IAAAA,YAAY,EAAE,IAb6C;AAc3DC,IA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EAE3B,CAF2B,CAA9B;;AAGA,UAAKF,KAAK,CAAC7C,MAAN,KAAiBC,QAAtB,EAAiC;AAChC;AACA;AACA,YAAKuC,MAAM,CAACQ,OAAP,GAAiB,GAAtB,EAA4B;AAC3BF,UAAAA,qBAAqB,CAACG,SAAtB,GACCH,qBAAqB,CAACG,SAAtB,GAAkCT,MAAM,CAACQ,OAD1C;AAEA,SAN+B,CAOhC;;;AACA,YACC/C,QAAQ,CAAC8C,sBAAT,CAAiC,gBAAjC,EAAqD,CAArD,CADD,EAEE;AACDP,UAAAA,MAAM,CAACU,QAAP,CAAiB,CAAjB,EAAoB,CAApB;AACA;AACD;AACD,KAlBD;AAmBA,GA/FA,CAiGD;;;AACAV,EAAAA,MAAM,CAACI,gBAAP,CAAyB,UAAzB,EAAuCO,CAAF,IAASA,CAAC,CAACC,cAAF,EAA9C,EAAkE,KAAlE;AACAZ,EAAAA,MAAM,CAACI,gBAAP,CAAyB,MAAzB,EAAmCO,CAAF,IAASA,CAAC,CAACC,cAAF,EAA1C,EAA8D,KAA9D;AAEAjD,EAAAA,IAAI,CAACkD,MAAL,CACC,4BAAC,eAAD;AACC,IAAA,QAAQ,EAAGvD,QADZ;AAEC,IAAA,MAAM,EAAGD,MAFV;AAGC,IAAA,QAAQ,EAAGD,QAHZ;AAIC,IAAA,YAAY,EAAGG;AAJhB,IADD;AASA,SAAOI,IAAP;AACA;AAED;AACA;AACA;;;AACO,SAASmD,kBAAT,GAA8B;AACpC,2BAAY,gCAAZ,EAA8C;AAC7CC,IAAAA,KAAK,EAAE,KADsC;AAE7CC,IAAAA,OAAO,EAAE;AAFoC,GAA9C;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { store as editPostStore } from './store';\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfullscreenMode: true,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\tpreferredStyleVariations: {},\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\tif ( select( editPostStore ).isFeatureActive( 'showListViewByDefault' ) ) {\n\t\tdispatch( editPostStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t/*\n\t * Prevent adding template part in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeTemplatePartsFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\tblockType.name === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { default as PluginDocumentSettingPanel } from './components/sidebar/plugin-document-setting-panel';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { store } from './store';\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/index.js"],"names":["initializeEditor","id","postType","postId","settings","initialEdits","target","document","getElementById","root","preferencesStore","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","themeStyles","welcomeGuide","welcomeGuideTemplate","blocksStore","__experimentalReapplyBlockTypeFilters","editPostStore","isFeatureActive","setIsListViewOpened","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","canInsert","blockType","isEditingTemplate","name","documentMode","compatMode","console","warn","isIphone","window","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","reinitializeEditor","since","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;AANA;;AACA;;AAIA;;AAEA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AACA;;AA+IA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAhLA;AACA;AACA;;AAgBA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CACNC,EADM,EAENC,QAFM,EAGNC,MAHM,EAINC,QAJM,EAKNC,YALM,EAML;AACD,QAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAT,CAAyBP,EAAzB,CAAf;AACA,QAAMQ,IAAI,GAAG,yBAAYH,MAAZ,CAAb;AAEA,sBAAUI,kBAAV,EAA6BC,WAA7B,CAA0C,gBAA1C,EAA4D;AAC3DC,IAAAA,UAAU,EAAE,QAD+C;AAE3DC,IAAAA,YAAY,EAAE,KAF6C;AAG3DC,IAAAA,cAAc,EAAE,IAH2C;AAI3DC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AAA,YAAY,EAAGG;AAJhB,IADD;AASA,SAAOI,IAAP;AACA;AAED;AACA;AACA;;;AACO,SAASmD,kBAAT,GAA8B;AACpC,2BAAY,gCAAZ,EAA8C;AAC7CC,IAAAA,KAAK,EAAE,KADsC;AAE7CC,IAAAA,OAAO,EAAE;AAFoC,GAA9C;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { store as editPostStore } from './store';\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfullscreenMode: true,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\tpreferredStyleVariations: {},\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\tif ( select( editPostStore ).isFeatureActive( 'showListViewByDefault' ) ) {\n\t\tdispatch( editPostStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t/*\n\t * Prevent adding template part and post content block in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeTemplatePartsFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\t( blockType.name === 'core/template-part' ||\n\t\t\t\t\tblockType.name === 'core/post-content' )\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { default as PluginDocumentSettingPanel } from './components/sidebar/plugin-document-setting-panel';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { store } from './store';\n"]}
|
package/build/plugins/index.js
CHANGED
|
@@ -31,29 +31,26 @@ var _welcomeGuideMenuItem = _interopRequireDefault(require("./welcome-guide-menu
|
|
|
31
31
|
*/
|
|
32
32
|
(0, _plugins.registerPlugin)('edit-post', {
|
|
33
33
|
render() {
|
|
34
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_toolsMoreMenuGroup.default, null,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/* translators: accessibility text */
|
|
55
|
-
(0, _i18n.__)('(opens in a new tab)'))));
|
|
56
|
-
}));
|
|
34
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_toolsMoreMenuGroup.default, null, ({
|
|
35
|
+
onClose
|
|
36
|
+
}) => (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.MenuItem, {
|
|
37
|
+
role: "menuitem",
|
|
38
|
+
href: (0, _url.addQueryArgs)('edit.php', {
|
|
39
|
+
post_type: 'wp_block'
|
|
40
|
+
})
|
|
41
|
+
}, (0, _i18n.__)('Manage Reusable blocks')), (0, _element.createElement)(_keyboardShortcutsHelpMenuItem.default, {
|
|
42
|
+
onSelect: onClose
|
|
43
|
+
}), (0, _element.createElement)(_welcomeGuideMenuItem.default, null), (0, _element.createElement)(_copyContentMenuItem.default, null), (0, _element.createElement)(_components.MenuItem, {
|
|
44
|
+
role: "menuitem",
|
|
45
|
+
icon: _icons.external,
|
|
46
|
+
href: (0, _i18n.__)('https://wordpress.org/documentation/article/wordpress-block-editor/'),
|
|
47
|
+
target: "_blank",
|
|
48
|
+
rel: "noopener noreferrer"
|
|
49
|
+
}, (0, _i18n.__)('Help'), (0, _element.createElement)(_components.VisuallyHidden, {
|
|
50
|
+
as: "span"
|
|
51
|
+
},
|
|
52
|
+
/* translators: accessibility text */
|
|
53
|
+
(0, _i18n.__)('(opens in a new tab)'))))));
|
|
57
54
|
}
|
|
58
55
|
|
|
59
56
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["render","onClose","post_type","external"],"mappings":";;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAfA;AACA;AACA;;AAOA;AACA;AACA;AAMA,6BAAgB,WAAhB,EAA6B;AAC5BA,EAAAA,MAAM,GAAG;AACR,WACC,qDACC,4BAAC,2BAAD,QACG
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["render","onClose","post_type","external"],"mappings":";;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAfA;AACA;AACA;;AAOA;AACA;AACA;AAMA,6BAAgB,WAAhB,EAA6B;AAC5BA,EAAAA,MAAM,GAAG;AACR,WACC,qDACC,4BAAC,2BAAD,QACG,CAAE;AAAEC,MAAAA;AAAF,KAAF,KACD,qDACC,4BAAC,oBAAD;AACC,MAAA,IAAI,EAAC,UADN;AAEC,MAAA,IAAI,EAAG,uBAAc,UAAd,EAA0B;AAChCC,QAAAA,SAAS,EAAE;AADqB,OAA1B;AAFR,OAMG,cAAI,wBAAJ,CANH,CADD,EASC,4BAAC,sCAAD;AACC,MAAA,QAAQ,EAAGD;AADZ,MATD,EAYC,4BAAC,6BAAD,OAZD,EAaC,4BAAC,4BAAD,OAbD,EAcC,4BAAC,oBAAD;AACC,MAAA,IAAI,EAAC,UADN;AAEC,MAAA,IAAI,EAAGE,eAFR;AAGC,MAAA,IAAI,EAAG,cACN,qEADM,CAHR;AAMC,MAAA,MAAM,EAAC,QANR;AAOC,MAAA,GAAG,EAAC;AAPL,OASG,cAAI,MAAJ,CATH,EAUC,4BAAC,0BAAD;AAAgB,MAAA,EAAE,EAAC;AAAnB;AAEE;AACA,kBAAI,sBAAJ,CAHF,CAVD,CAdD,CAFF,CADD,CADD;AAwCA;;AA1C2B,CAA7B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { external } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { registerPlugin } from '@wordpress/plugins';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport CopyContentMenuItem from './copy-content-menu-item';\nimport KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';\nimport ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\n\nregisterPlugin( 'edit-post', {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\thref={ addQueryArgs( 'edit.php', {\n\t\t\t\t\t\t\t\t\tpost_type: 'wp_block',\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Manage Reusable blocks' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<KeyboardShortcutsHelpMenuItem\n\t\t\t\t\t\t\t\tonSelect={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t\t\t\t\t<CopyContentMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsMoreMenuGroup>\n\t\t\t</>\n\t\t);\n\t},\n} );\n"]}
|
|
@@ -25,10 +25,9 @@ var _store = require("../../store");
|
|
|
25
25
|
/**
|
|
26
26
|
* Internal dependencies
|
|
27
27
|
*/
|
|
28
|
-
function KeyboardShortcutsHelpMenuItem(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} = _ref;
|
|
28
|
+
function KeyboardShortcutsHelpMenuItem({
|
|
29
|
+
openModal
|
|
30
|
+
}) {
|
|
32
31
|
return (0, _element.createElement)(_components.MenuItem, {
|
|
33
32
|
onClick: () => {
|
|
34
33
|
openModal('edit-post/keyboard-shortcut-help');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/plugins/keyboard-shortcuts-help-menu-item/index.js"],"names":["KeyboardShortcutsHelpMenuItem","openModal","displayShortcut","access","dispatch","editPostStore"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGO,SAASA,6BAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/plugins/keyboard-shortcuts-help-menu-item/index.js"],"names":["KeyboardShortcutsHelpMenuItem","openModal","displayShortcut","access","dispatch","editPostStore"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGO,SAASA,6BAAT,CAAwC;AAAEC,EAAAA;AAAF,CAAxC,EAAwD;AAC9D,SACC,4BAAC,oBAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACfA,MAAAA,SAAS,CAAE,kCAAF,CAAT;AACA,KAHF;AAIC,IAAA,QAAQ,EAAGC,0BAAgBC,MAAhB,CAAwB,GAAxB;AAJZ,KAMG,cAAI,oBAAJ,CANH,CADD;AAUA;;eAEc,wBAAgBC,QAAF,IAAgB;AAC5C,QAAM;AAAEH,IAAAA;AAAF,MAAgBG,QAAQ,CAAEC,YAAF,CAA9B;AAEA,SAAO;AACNJ,IAAAA;AADM,GAAP;AAGA,CANc,EAMVD,6BANU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { withDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport function KeyboardShortcutsHelpMenuItem( { openModal } ) {\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\topenModal( 'edit-post/keyboard-shortcut-help' );\n\t\t\t} }\n\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t>\n\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default withDispatch( ( dispatch ) => {\n\tconst { openModal } = dispatch( editPostStore );\n\n\treturn {\n\t\topenModal,\n\t};\n} )( KeyboardShortcutsHelpMenuItem );\n"]}
|
package/build/store/actions.js
CHANGED
|
@@ -60,12 +60,9 @@ var _ = require(".");
|
|
|
60
60
|
*
|
|
61
61
|
* @param {?string} name Sidebar name to be opened.
|
|
62
62
|
*/
|
|
63
|
-
const openGeneralSidebar = name =>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
} = _ref;
|
|
67
|
-
return registry.dispatch(_interface.store).enableComplementaryArea(_.store.name, name);
|
|
68
|
-
};
|
|
63
|
+
const openGeneralSidebar = name => ({
|
|
64
|
+
registry
|
|
65
|
+
}) => registry.dispatch(_interface.store).enableComplementaryArea(_.store.name, name);
|
|
69
66
|
/**
|
|
70
67
|
* Returns an action object signalling that the user closed the sidebar.
|
|
71
68
|
*/
|
|
@@ -73,12 +70,9 @@ const openGeneralSidebar = name => _ref => {
|
|
|
73
70
|
|
|
74
71
|
exports.openGeneralSidebar = openGeneralSidebar;
|
|
75
72
|
|
|
76
|
-
const closeGeneralSidebar = () =>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
} = _ref2;
|
|
80
|
-
return registry.dispatch(_interface.store).disableComplementaryArea(_.store.name);
|
|
81
|
-
};
|
|
73
|
+
const closeGeneralSidebar = () => ({
|
|
74
|
+
registry
|
|
75
|
+
}) => registry.dispatch(_interface.store).disableComplementaryArea(_.store.name);
|
|
82
76
|
/**
|
|
83
77
|
* Returns an action object used in signalling that the user opened a modal.
|
|
84
78
|
*
|
|
@@ -155,14 +149,13 @@ function togglePublishSidebar() {
|
|
|
155
149
|
*/
|
|
156
150
|
|
|
157
151
|
|
|
158
|
-
const toggleEditorPanelEnabled = panelName =>
|
|
152
|
+
const toggleEditorPanelEnabled = panelName => ({
|
|
153
|
+
registry
|
|
154
|
+
}) => {
|
|
159
155
|
var _registry$select$get;
|
|
160
156
|
|
|
161
|
-
let {
|
|
162
|
-
registry
|
|
163
|
-
} = _ref3;
|
|
164
157
|
const inactivePanels = (_registry$select$get = registry.select(_preferences.store).get('core/edit-post', 'inactivePanels')) !== null && _registry$select$get !== void 0 ? _registry$select$get : [];
|
|
165
|
-
const isPanelInactive = !!
|
|
158
|
+
const isPanelInactive = !!inactivePanels?.includes(panelName); // If the panel is inactive, remove it to enable it, else add it to
|
|
166
159
|
// make it inactive.
|
|
167
160
|
|
|
168
161
|
let updatedInactivePanels;
|
|
@@ -184,14 +177,13 @@ const toggleEditorPanelEnabled = panelName => _ref3 => {
|
|
|
184
177
|
|
|
185
178
|
exports.toggleEditorPanelEnabled = toggleEditorPanelEnabled;
|
|
186
179
|
|
|
187
|
-
const toggleEditorPanelOpened = panelName =>
|
|
180
|
+
const toggleEditorPanelOpened = panelName => ({
|
|
181
|
+
registry
|
|
182
|
+
}) => {
|
|
188
183
|
var _registry$select$get2;
|
|
189
184
|
|
|
190
|
-
let {
|
|
191
|
-
registry
|
|
192
|
-
} = _ref4;
|
|
193
185
|
const openPanels = (_registry$select$get2 = registry.select(_preferences.store).get('core/edit-post', 'openPanels')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : [];
|
|
194
|
-
const isPanelOpen = !!
|
|
186
|
+
const isPanelOpen = !!openPanels?.includes(panelName); // If the panel is open, remove it to close it, else add it to
|
|
195
187
|
// make it open.
|
|
196
188
|
|
|
197
189
|
let updatedOpenPanels;
|
|
@@ -228,12 +220,9 @@ function removeEditorPanel(panelName) {
|
|
|
228
220
|
*/
|
|
229
221
|
|
|
230
222
|
|
|
231
|
-
const toggleFeature = feature =>
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
} = _ref5;
|
|
235
|
-
return registry.dispatch(_preferences.store).toggle('core/edit-post', feature);
|
|
236
|
-
};
|
|
223
|
+
const toggleFeature = feature => ({
|
|
224
|
+
registry
|
|
225
|
+
}) => registry.dispatch(_preferences.store).toggle('core/edit-post', feature);
|
|
237
226
|
/**
|
|
238
227
|
* Triggers an action used to switch editor mode.
|
|
239
228
|
*
|
|
@@ -243,10 +232,9 @@ const toggleFeature = feature => _ref5 => {
|
|
|
243
232
|
|
|
244
233
|
exports.toggleFeature = toggleFeature;
|
|
245
234
|
|
|
246
|
-
const switchEditorMode = mode =>
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
} = _ref6;
|
|
235
|
+
const switchEditorMode = mode => ({
|
|
236
|
+
registry
|
|
237
|
+
}) => {
|
|
250
238
|
registry.dispatch(_preferences.store).set('core/edit-post', 'editorMode', mode); // Unselect blocks when we switch to the code editor.
|
|
251
239
|
|
|
252
240
|
if (mode !== 'visual') {
|
|
@@ -265,10 +253,9 @@ const switchEditorMode = mode => _ref6 => {
|
|
|
265
253
|
|
|
266
254
|
exports.switchEditorMode = switchEditorMode;
|
|
267
255
|
|
|
268
|
-
const togglePinnedPluginItem = pluginName =>
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
} = _ref7;
|
|
256
|
+
const togglePinnedPluginItem = pluginName => ({
|
|
257
|
+
registry
|
|
258
|
+
}) => {
|
|
272
259
|
const isPinned = registry.select(_interface.store).isItemPinned('core/edit-post', pluginName);
|
|
273
260
|
registry.dispatch(_interface.store)[isPinned ? 'unpinItem' : 'pinItem']('core/edit-post', pluginName);
|
|
274
261
|
};
|
|
@@ -282,13 +269,11 @@ const togglePinnedPluginItem = pluginName => _ref7 => {
|
|
|
282
269
|
|
|
283
270
|
exports.togglePinnedPluginItem = togglePinnedPluginItem;
|
|
284
271
|
|
|
285
|
-
const updatePreferredStyleVariations = (blockName, blockStyle) =>
|
|
272
|
+
const updatePreferredStyleVariations = (blockName, blockStyle) => ({
|
|
273
|
+
registry
|
|
274
|
+
}) => {
|
|
286
275
|
var _registry$select$get3;
|
|
287
276
|
|
|
288
|
-
let {
|
|
289
|
-
registry
|
|
290
|
-
} = _ref8;
|
|
291
|
-
|
|
292
277
|
if (!blockName) {
|
|
293
278
|
return;
|
|
294
279
|
}
|
|
@@ -316,12 +301,11 @@ const updatePreferredStyleVariations = (blockName, blockStyle) => _ref8 => {
|
|
|
316
301
|
|
|
317
302
|
exports.updatePreferredStyleVariations = updatePreferredStyleVariations;
|
|
318
303
|
|
|
319
|
-
const showBlockTypes = blockNames =>
|
|
304
|
+
const showBlockTypes = blockNames => ({
|
|
305
|
+
registry
|
|
306
|
+
}) => {
|
|
320
307
|
var _registry$select$get4;
|
|
321
308
|
|
|
322
|
-
let {
|
|
323
|
-
registry
|
|
324
|
-
} = _ref9;
|
|
325
309
|
const existingBlockNames = (_registry$select$get4 = registry.select(_preferences.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get4 !== void 0 ? _registry$select$get4 : [];
|
|
326
310
|
const newBlockNames = existingBlockNames.filter(type => !(Array.isArray(blockNames) ? blockNames : [blockNames]).includes(type));
|
|
327
311
|
registry.dispatch(_preferences.store).set('core/edit-post', 'hiddenBlockTypes', newBlockNames);
|
|
@@ -335,12 +319,11 @@ const showBlockTypes = blockNames => _ref9 => {
|
|
|
335
319
|
|
|
336
320
|
exports.showBlockTypes = showBlockTypes;
|
|
337
321
|
|
|
338
|
-
const hideBlockTypes = blockNames =>
|
|
322
|
+
const hideBlockTypes = blockNames => ({
|
|
323
|
+
registry
|
|
324
|
+
}) => {
|
|
339
325
|
var _registry$select$get5;
|
|
340
326
|
|
|
341
|
-
let {
|
|
342
|
-
registry
|
|
343
|
-
} = _ref10;
|
|
344
327
|
const existingBlockNames = (_registry$select$get5 = registry.select(_preferences.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get5 !== void 0 ? _registry$select$get5 : [];
|
|
345
328
|
const mergedBlockNames = new Set([...existingBlockNames, ...(Array.isArray(blockNames) ? blockNames : [blockNames])]);
|
|
346
329
|
registry.dispatch(_preferences.store).set('core/edit-post', 'hiddenBlockTypes', [...mergedBlockNames]);
|
|
@@ -365,12 +348,11 @@ function setAvailableMetaBoxesPerLocation(metaBoxesPerLocation) {
|
|
|
365
348
|
*/
|
|
366
349
|
|
|
367
350
|
|
|
368
|
-
const requestMetaBoxUpdates = () => async
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
} = _ref11;
|
|
351
|
+
const requestMetaBoxUpdates = () => async ({
|
|
352
|
+
registry,
|
|
353
|
+
select,
|
|
354
|
+
dispatch
|
|
355
|
+
}) => {
|
|
374
356
|
dispatch({
|
|
375
357
|
type: 'REQUEST_META_BOX_UPDATES'
|
|
376
358
|
}); // Saves the wp_editor fields.
|
|
@@ -395,10 +377,7 @@ const requestMetaBoxUpdates = () => async _ref11 => {
|
|
|
395
377
|
|
|
396
378
|
return memo;
|
|
397
379
|
}, new window.FormData());
|
|
398
|
-
additionalData.forEach(
|
|
399
|
-
let [key, value] = _ref12;
|
|
400
|
-
return formData.append(key, value);
|
|
401
|
-
});
|
|
380
|
+
additionalData.forEach(([key, value]) => formData.append(key, value));
|
|
402
381
|
|
|
403
382
|
try {
|
|
404
383
|
// Save the metaboxes.
|
|
@@ -509,24 +488,20 @@ function setIsEditingTemplate(value) {
|
|
|
509
488
|
*/
|
|
510
489
|
|
|
511
490
|
|
|
512
|
-
const __unstableSwitchToTemplateMode =
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
const
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
type: 'snackbar'
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
};
|
|
491
|
+
const __unstableSwitchToTemplateMode = (newTemplate = false) => ({
|
|
492
|
+
registry,
|
|
493
|
+
select,
|
|
494
|
+
dispatch
|
|
495
|
+
}) => {
|
|
496
|
+
dispatch(setIsEditingTemplate(true));
|
|
497
|
+
const isWelcomeGuideActive = select.isFeatureActive('welcomeGuideTemplate');
|
|
498
|
+
|
|
499
|
+
if (!isWelcomeGuideActive) {
|
|
500
|
+
const message = newTemplate ? (0, _i18n.__)("Custom template created. You're in template mode now.") : (0, _i18n.__)('Editing template. Changes made here affect all posts and pages that use the template.');
|
|
501
|
+
registry.dispatch(_notices.store).createSuccessNotice(message, {
|
|
502
|
+
type: 'snackbar'
|
|
503
|
+
});
|
|
504
|
+
}
|
|
530
505
|
};
|
|
531
506
|
/**
|
|
532
507
|
* Create a block based template.
|
|
@@ -537,10 +512,9 @@ const __unstableSwitchToTemplateMode = function () {
|
|
|
537
512
|
|
|
538
513
|
exports.__unstableSwitchToTemplateMode = __unstableSwitchToTemplateMode;
|
|
539
514
|
|
|
540
|
-
const __unstableCreateTemplate = template => async
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
} = _ref14;
|
|
515
|
+
const __unstableCreateTemplate = template => async ({
|
|
516
|
+
registry
|
|
517
|
+
}) => {
|
|
544
518
|
const savedTemplate = await registry.dispatch(_coreData.store).saveEntityRecord('postType', 'wp_template', template);
|
|
545
519
|
const post = registry.select(_editor.store).getCurrentPost();
|
|
546
520
|
registry.dispatch(_coreData.store).editEntityRecord('postType', post.type, post.id, {
|
|
@@ -554,13 +528,11 @@ let metaBoxesInitialized = false;
|
|
|
554
528
|
* Initializes WordPress `postboxes` script and the logic for saving meta boxes.
|
|
555
529
|
*/
|
|
556
530
|
|
|
557
|
-
const initializeMetaBoxes = () =>
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
} = _ref15;
|
|
563
|
-
|
|
531
|
+
const initializeMetaBoxes = () => ({
|
|
532
|
+
registry,
|
|
533
|
+
select,
|
|
534
|
+
dispatch
|
|
535
|
+
}) => {
|
|
564
536
|
const isEditorReady = registry.select(_editor.store).__unstableIsEditorReady();
|
|
565
537
|
|
|
566
538
|
if (!isEditorReady) {
|