@wordpress/edit-post 7.34.0 → 8.0.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 +15 -2
- package/build/commands/use-commands.js +56 -0
- package/build/commands/use-commands.js.map +1 -0
- package/build/components/{header/fullscreen-mode-close/index.js → back-button/fullscreen-mode-close.js} +18 -16
- package/build/components/back-button/fullscreen-mode-close.js.map +1 -0
- package/build/components/back-button/index.js +57 -0
- package/build/components/back-button/index.js.map +1 -0
- package/build/components/header/header-toolbar/index.native.js +63 -62
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.native.js +2 -2
- package/build/components/header/index.native.js.map +1 -1
- package/build/components/init-pattern-modal/index.js +50 -43
- package/build/components/init-pattern-modal/index.js.map +1 -1
- package/build/components/layout/index.js +134 -156
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/index.native.js +28 -21
- package/build/components/layout/index.native.js.map +1 -1
- package/build/components/{visual-editor → layout}/use-padding-appender.js +6 -1
- package/build/components/layout/use-padding-appender.js.map +1 -0
- package/build/components/layout/use-should-iframe.js +46 -0
- package/build/components/layout/use-should-iframe.js.map +1 -0
- package/build/components/meta-boxes/index.js +10 -9
- package/build/components/meta-boxes/index.js.map +1 -1
- package/build/components/meta-boxes/meta-boxes-area/index.js +13 -13
- package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build/components/more-menu/index.js +49 -0
- package/build/components/more-menu/index.js.map +1 -0
- package/build/components/{header/more-menu → more-menu}/manage-patterns-menu-item.js +6 -5
- package/build/components/more-menu/manage-patterns-menu-item.js.map +1 -0
- package/build/components/{header/more-menu → more-menu}/welcome-guide-menu-item.js +2 -2
- package/build/components/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build/components/preferences-modal/enable-custom-fields.js +23 -18
- package/build/components/preferences-modal/enable-custom-fields.js.map +1 -1
- package/build/components/preferences-modal/index.js +4 -4
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js +13 -13
- package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build/components/visual-editor/header.native.js +11 -10
- package/build/components/visual-editor/header.native.js.map +1 -1
- package/build/components/visual-editor/index.native.js +3 -3
- package/build/components/visual-editor/index.native.js.map +1 -1
- package/build/components/welcome-guide/default.js +50 -33
- package/build/components/welcome-guide/default.js.map +1 -1
- package/build/components/welcome-guide/image.js +13 -12
- package/build/components/welcome-guide/image.js.map +1 -1
- package/build/components/welcome-guide/index.js +2 -2
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/template.js +12 -8
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/deprecated.js +9 -9
- package/build/deprecated.js.map +1 -1
- package/build/editor.js +16 -11
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +18 -12
- package/build/editor.native.js.map +1 -1
- package/build/index.js +12 -13
- package/build/index.js.map +1 -1
- package/build/index.native.js +2 -2
- package/build/index.native.js.map +1 -1
- package/build/store/selectors.js +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/commands/use-commands.js +49 -0
- package/build-module/commands/use-commands.js.map +1 -0
- package/build-module/components/{header/fullscreen-mode-close/index.js → back-button/fullscreen-mode-close.js} +18 -16
- package/build-module/components/back-button/fullscreen-mode-close.js.map +1 -0
- package/build-module/components/back-button/index.js +49 -0
- package/build-module/components/back-button/index.js.map +1 -0
- package/build-module/components/header/header-toolbar/index.native.js +64 -62
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/index.native.js +2 -2
- package/build-module/components/header/index.native.js.map +1 -1
- package/build-module/components/init-pattern-modal/index.js +52 -43
- package/build-module/components/init-pattern-modal/index.js.map +1 -1
- package/build-module/components/layout/index.js +139 -159
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/index.native.js +30 -21
- package/build-module/components/layout/index.native.js.map +1 -1
- package/build-module/components/{visual-editor → layout}/use-padding-appender.js +6 -1
- package/build-module/components/layout/use-padding-appender.js.map +1 -0
- package/build-module/components/layout/use-should-iframe.js +39 -0
- package/build-module/components/layout/use-should-iframe.js.map +1 -0
- package/build-module/components/meta-boxes/index.js +12 -9
- package/build-module/components/meta-boxes/index.js.map +1 -1
- package/build-module/components/meta-boxes/meta-boxes-area/index.js +13 -11
- package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build-module/components/more-menu/index.js +43 -0
- package/build-module/components/more-menu/index.js.map +1 -0
- package/build-module/components/{header/more-menu → more-menu}/manage-patterns-menu-item.js +6 -5
- package/build-module/components/more-menu/manage-patterns-menu-item.js.map +1 -0
- package/build-module/components/{header/more-menu → more-menu}/welcome-guide-menu-item.js +2 -2
- package/build-module/components/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build-module/components/preferences-modal/enable-custom-fields.js +25 -18
- package/build-module/components/preferences-modal/enable-custom-fields.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +4 -4
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preferences-modal/meta-boxes-section.js +14 -13
- package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build-module/components/visual-editor/header.native.js +11 -10
- package/build-module/components/visual-editor/header.native.js.map +1 -1
- package/build-module/components/visual-editor/index.native.js +3 -3
- package/build-module/components/visual-editor/index.native.js.map +1 -1
- package/build-module/components/welcome-guide/default.js +52 -33
- package/build-module/components/welcome-guide/default.js.map +1 -1
- package/build-module/components/welcome-guide/image.js +14 -12
- package/build-module/components/welcome-guide/image.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +2 -2
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +14 -8
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/deprecated.js +9 -9
- package/build-module/deprecated.js.map +1 -1
- package/build-module/editor.js +17 -11
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +18 -12
- package/build-module/editor.native.js.map +1 -1
- package/build-module/index.js +10 -7
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +2 -2
- package/build-module/index.native.js.map +1 -1
- package/build-module/store/selectors.js +1 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +31 -392
- package/build-style/style.css +31 -392
- package/package.json +33 -33
- package/src/commands/use-commands.js +48 -0
- package/src/components/{header/fullscreen-mode-close/index.js → back-button/fullscreen-mode-close.js} +3 -3
- package/src/components/back-button/index.js +34 -0
- package/src/components/{header/fullscreen-mode-close → back-button}/style.scss +16 -2
- package/src/components/{header/fullscreen-mode-close/test/index.js → back-button/test/fullscreen-mode-close.js} +1 -1
- package/src/components/layout/index.js +151 -207
- package/src/components/layout/style.scss +9 -17
- package/src/components/{visual-editor → layout}/use-padding-appender.js +7 -1
- package/src/components/layout/use-should-iframe.js +40 -0
- package/src/components/meta-boxes/meta-boxes-area/index.js +4 -8
- package/src/components/{header/more-menu → more-menu}/index.js +2 -2
- package/src/components/{header/more-menu → more-menu}/manage-patterns-menu-item.js +1 -1
- package/src/index.js +11 -6
- package/src/store/selectors.js +8 -5
- package/src/style.scss +3 -10
- package/src/test/__snapshots__/editor.native.js.snap +72 -0
- package/src/test/editor.native.js +77 -0
- package/build/components/header/fullscreen-mode-close/index.js.map +0 -1
- package/build/components/header/index.js +0 -158
- package/build/components/header/index.js.map +0 -1
- package/build/components/header/main-dashboard-button/index.js +0 -33
- package/build/components/header/main-dashboard-button/index.js.map +0 -1
- package/build/components/header/more-menu/index.js +0 -43
- package/build/components/header/more-menu/index.js.map +0 -1
- package/build/components/header/more-menu/manage-patterns-menu-item.js.map +0 -1
- package/build/components/header/more-menu/welcome-guide-menu-item.js.map +0 -1
- package/build/components/sidebar/post-format/index.js +0 -21
- package/build/components/sidebar/post-format/index.js.map +0 -1
- package/build/components/sidebar/post-pending-status/index.js +0 -26
- package/build/components/sidebar/post-pending-status/index.js.map +0 -1
- package/build/components/sidebar/post-slug/index.js +0 -21
- package/build/components/sidebar/post-slug/index.js.map +0 -1
- package/build/components/sidebar/post-status/index.js +0 -92
- package/build/components/sidebar/post-status/index.js.map +0 -1
- package/build/components/sidebar/post-sticky/index.js +0 -26
- package/build/components/sidebar/post-sticky/index.js.map +0 -1
- package/build/components/sidebar/post-trash/index.js +0 -16
- package/build/components/sidebar/post-trash/index.js.map +0 -1
- package/build/components/sidebar/post-visibility/index.js +0 -78
- package/build/components/sidebar/post-visibility/index.js.map +0 -1
- package/build/components/sidebar/settings-header/index.js +0 -53
- package/build/components/sidebar/settings-header/index.js.map +0 -1
- package/build/components/sidebar/settings-sidebar/index.js +0 -193
- package/build/components/sidebar/settings-sidebar/index.js.map +0 -1
- package/build/components/text-editor/index.js +0 -61
- package/build/components/text-editor/index.js.map +0 -1
- package/build/components/visual-editor/block-inspector-button.js +0 -55
- package/build/components/visual-editor/block-inspector-button.js.map +0 -1
- package/build/components/visual-editor/index.js +0 -92
- package/build/components/visual-editor/index.js.map +0 -1
- package/build/components/visual-editor/use-padding-appender.js.map +0 -1
- package/build/hooks/commands/use-common-commands.js +0 -119
- package/build/hooks/commands/use-common-commands.js.map +0 -1
- package/build/hooks/components/index.js +0 -11
- package/build/hooks/components/index.js.map +0 -1
- package/build/hooks/index.js +0 -5
- package/build/hooks/index.js.map +0 -1
- package/build/hooks/validate-multiple-use/index.js +0 -134
- package/build/hooks/validate-multiple-use/index.js.map +0 -1
- package/build-module/components/header/fullscreen-mode-close/index.js.map +0 -1
- package/build-module/components/header/index.js +0 -150
- package/build-module/components/header/index.js.map +0 -1
- package/build-module/components/header/main-dashboard-button/index.js +0 -26
- package/build-module/components/header/main-dashboard-button/index.js.map +0 -1
- package/build-module/components/header/more-menu/index.js +0 -35
- package/build-module/components/header/more-menu/index.js.map +0 -1
- package/build-module/components/header/more-menu/manage-patterns-menu-item.js.map +0 -1
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +0 -1
- package/build-module/components/sidebar/post-format/index.js +0 -13
- package/build-module/components/sidebar/post-format/index.js.map +0 -1
- package/build-module/components/sidebar/post-pending-status/index.js +0 -18
- package/build-module/components/sidebar/post-pending-status/index.js.map +0 -1
- package/build-module/components/sidebar/post-slug/index.js +0 -13
- package/build-module/components/sidebar/post-slug/index.js.map +0 -1
- package/build-module/components/sidebar/post-status/index.js +0 -84
- package/build-module/components/sidebar/post-status/index.js.map +0 -1
- package/build-module/components/sidebar/post-sticky/index.js +0 -18
- package/build-module/components/sidebar/post-sticky/index.js.map +0 -1
- package/build-module/components/sidebar/post-trash/index.js +0 -9
- package/build-module/components/sidebar/post-trash/index.js.map +0 -1
- package/build-module/components/sidebar/post-visibility/index.js +0 -70
- package/build-module/components/sidebar/post-visibility/index.js.map +0 -1
- package/build-module/components/sidebar/settings-header/index.js +0 -46
- package/build-module/components/sidebar/settings-header/index.js.map +0 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +0 -185
- package/build-module/components/sidebar/settings-sidebar/index.js.map +0 -1
- package/build-module/components/text-editor/index.js +0 -54
- package/build-module/components/text-editor/index.js.map +0 -1
- package/build-module/components/visual-editor/block-inspector-button.js +0 -47
- package/build-module/components/visual-editor/block-inspector-button.js.map +0 -1
- package/build-module/components/visual-editor/index.js +0 -84
- package/build-module/components/visual-editor/index.js.map +0 -1
- package/build-module/components/visual-editor/use-padding-appender.js.map +0 -1
- package/build-module/hooks/commands/use-common-commands.js +0 -112
- package/build-module/hooks/commands/use-common-commands.js.map +0 -1
- package/build-module/hooks/components/index.js +0 -8
- package/build-module/hooks/components/index.js.map +0 -1
- package/build-module/hooks/index.js +0 -6
- package/build-module/hooks/index.js.map +0 -1
- package/build-module/hooks/validate-multiple-use/index.js +0 -132
- package/build-module/hooks/validate-multiple-use/index.js.map +0 -1
- package/src/components/header/index.js +0 -156
- package/src/components/header/main-dashboard-button/index.js +0 -28
- package/src/components/header/style.scss +0 -251
- package/src/components/sidebar/post-format/index.js +0 -20
- package/src/components/sidebar/post-format/style.scss +0 -5
- package/src/components/sidebar/post-pending-status/index.js +0 -27
- package/src/components/sidebar/post-slug/index.js +0 -17
- package/src/components/sidebar/post-slug/style.scss +0 -5
- package/src/components/sidebar/post-status/index.js +0 -128
- package/src/components/sidebar/post-sticky/index.js +0 -27
- package/src/components/sidebar/post-trash/index.js +0 -12
- package/src/components/sidebar/post-visibility/index.js +0 -88
- package/src/components/sidebar/post-visibility/style.scss +0 -5
- package/src/components/sidebar/settings-header/index.js +0 -49
- package/src/components/sidebar/settings-sidebar/index.js +0 -247
- package/src/components/sidebar/style.scss +0 -18
- package/src/components/text-editor/index.js +0 -63
- package/src/components/text-editor/style.scss +0 -71
- package/src/components/visual-editor/block-inspector-button.js +0 -59
- package/src/components/visual-editor/index.js +0 -101
- package/src/components/visual-editor/style.scss +0 -53
- package/src/hooks/commands/use-common-commands.js +0 -126
- package/src/hooks/components/index.js +0 -13
- package/src/hooks/index.js +0 -5
- package/src/hooks/validate-multiple-use/index.js +0 -163
- /package/src/components/{header/fullscreen-mode-close/test/__snapshots__/index.js.snap → back-button/test/__snapshots__/fullscreen-mode-close.js.snap} +0 -0
- /package/src/components/{header/more-menu → more-menu}/welcome-guide-menu-item.js +0 -0
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { createBlock, findTransform, getBlockTransforms, getBlockType, hasBlockSupport } from '@wordpress/blocks';
|
|
6
|
-
import { Button } from '@wordpress/components';
|
|
7
|
-
import { withSelect, withDispatch } from '@wordpress/data';
|
|
8
|
-
import { Warning, store as blockEditorStore } from '@wordpress/block-editor';
|
|
9
|
-
import { addFilter } from '@wordpress/hooks';
|
|
10
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import { compose, createHigherOrderComponent } from '@wordpress/compose';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Recursively find very first block of an specific block type.
|
|
15
|
-
*
|
|
16
|
-
* @param {Object[]} blocks List of blocks.
|
|
17
|
-
* @param {string} name Block name to search.
|
|
18
|
-
*
|
|
19
|
-
* @return {Object|undefined} Return block object or undefined.
|
|
20
|
-
*/
|
|
21
|
-
function findFirstOfSameType(blocks, name) {
|
|
22
|
-
if (!Array.isArray(blocks) || !blocks.length) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
for (const block of blocks) {
|
|
26
|
-
if (block.name === name) {
|
|
27
|
-
return block;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Search inside innerBlocks.
|
|
31
|
-
const firstBlock = findFirstOfSameType(block.innerBlocks, name);
|
|
32
|
-
if (firstBlock) {
|
|
33
|
-
return firstBlock;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const enhance = compose(
|
|
38
|
-
/**
|
|
39
|
-
* For blocks whose block type doesn't support `multiple`, provides the
|
|
40
|
-
* wrapped component with `originalBlockClientId` -- a reference to the
|
|
41
|
-
* first block of the same type in the content -- if and only if that
|
|
42
|
-
* "original" block is not the current one. Thus, an inexisting
|
|
43
|
-
* `originalBlockClientId` prop signals that the block is valid.
|
|
44
|
-
*
|
|
45
|
-
* @param {Component} WrappedBlockEdit A filtered BlockEdit instance.
|
|
46
|
-
*
|
|
47
|
-
* @return {Component} Enhanced component with merged state data props.
|
|
48
|
-
*/
|
|
49
|
-
withSelect((select, block) => {
|
|
50
|
-
const multiple = hasBlockSupport(block.name, 'multiple', true);
|
|
51
|
-
|
|
52
|
-
// For block types with `multiple` support, there is no "original
|
|
53
|
-
// block" to be found in the content, as the block itself is valid.
|
|
54
|
-
if (multiple) {
|
|
55
|
-
return {};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Otherwise, only pass `originalBlockClientId` if it refers to a different
|
|
59
|
-
// block from the current one.
|
|
60
|
-
const blocks = select(blockEditorStore).getBlocks();
|
|
61
|
-
const firstOfSameType = findFirstOfSameType(blocks, block.name);
|
|
62
|
-
const isInvalid = firstOfSameType && firstOfSameType.clientId !== block.clientId;
|
|
63
|
-
return {
|
|
64
|
-
originalBlockClientId: isInvalid && firstOfSameType.clientId
|
|
65
|
-
};
|
|
66
|
-
}), withDispatch((dispatch, {
|
|
67
|
-
originalBlockClientId
|
|
68
|
-
}) => ({
|
|
69
|
-
selectFirst: () => dispatch(blockEditorStore).selectBlock(originalBlockClientId)
|
|
70
|
-
})));
|
|
71
|
-
const withMultipleValidation = createHigherOrderComponent(BlockEdit => {
|
|
72
|
-
return enhance(({
|
|
73
|
-
originalBlockClientId,
|
|
74
|
-
selectFirst,
|
|
75
|
-
...props
|
|
76
|
-
}) => {
|
|
77
|
-
if (!originalBlockClientId) {
|
|
78
|
-
return createElement(BlockEdit, {
|
|
79
|
-
...props
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
const blockType = getBlockType(props.name);
|
|
83
|
-
const outboundType = getOutboundType(props.name);
|
|
84
|
-
return [createElement("div", {
|
|
85
|
-
key: "invalid-preview",
|
|
86
|
-
style: {
|
|
87
|
-
minHeight: '60px'
|
|
88
|
-
}
|
|
89
|
-
}, createElement(BlockEdit, {
|
|
90
|
-
key: "block-edit",
|
|
91
|
-
...props
|
|
92
|
-
})), createElement(Warning, {
|
|
93
|
-
key: "multiple-use-warning",
|
|
94
|
-
actions: [createElement(Button, {
|
|
95
|
-
key: "find-original",
|
|
96
|
-
variant: "secondary",
|
|
97
|
-
onClick: selectFirst
|
|
98
|
-
}, __('Find original')), createElement(Button, {
|
|
99
|
-
key: "remove",
|
|
100
|
-
variant: "secondary",
|
|
101
|
-
onClick: () => props.onReplace([])
|
|
102
|
-
}, __('Remove')), outboundType && createElement(Button, {
|
|
103
|
-
key: "transform",
|
|
104
|
-
variant: "secondary",
|
|
105
|
-
onClick: () => props.onReplace(createBlock(outboundType.name, props.attributes))
|
|
106
|
-
}, __('Transform into:'), " ", outboundType.title)]
|
|
107
|
-
}, createElement("strong", null, blockType?.title, ": "), __('This block can only be used once.'))];
|
|
108
|
-
});
|
|
109
|
-
}, 'withMultipleValidation');
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Given a base block name, returns the default block type to which to offer
|
|
113
|
-
* transforms.
|
|
114
|
-
*
|
|
115
|
-
* @param {string} blockName Base block name.
|
|
116
|
-
*
|
|
117
|
-
* @return {?Object} The chosen default block type.
|
|
118
|
-
*/
|
|
119
|
-
function getOutboundType(blockName) {
|
|
120
|
-
// Grab the first outbound transform.
|
|
121
|
-
const transform = findTransform(getBlockTransforms('to', blockName), ({
|
|
122
|
-
type,
|
|
123
|
-
blocks
|
|
124
|
-
}) => type === 'block' && blocks.length === 1 // What about when .length > 1?
|
|
125
|
-
);
|
|
126
|
-
if (!transform) {
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
return getBlockType(transform.blocks[0]);
|
|
130
|
-
}
|
|
131
|
-
addFilter('editor.BlockEdit', 'core/edit-post/validate-multiple-use/with-multiple-validation', withMultipleValidation);
|
|
132
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createBlock","findTransform","getBlockTransforms","getBlockType","hasBlockSupport","Button","withSelect","withDispatch","Warning","store","blockEditorStore","addFilter","__","compose","createHigherOrderComponent","findFirstOfSameType","blocks","name","Array","isArray","length","block","firstBlock","innerBlocks","enhance","select","multiple","getBlocks","firstOfSameType","isInvalid","clientId","originalBlockClientId","dispatch","selectFirst","selectBlock","withMultipleValidation","BlockEdit","props","createElement","blockType","outboundType","getOutboundType","key","style","minHeight","actions","variant","onClick","onReplace","attributes","title","blockName","transform","type"],"sources":["@wordpress/edit-post/src/hooks/validate-multiple-use/index.js"],"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\n/**\n * Recursively find very first block of an specific block type.\n *\n * @param {Object[]} blocks List of blocks.\n * @param {string} name Block name to search.\n *\n * @return {Object|undefined} Return block object or undefined.\n */\nfunction findFirstOfSameType( blocks, name ) {\n\tif ( ! Array.isArray( blocks ) || ! blocks.length ) {\n\t\treturn;\n\t}\n\n\tfor ( const block of blocks ) {\n\t\tif ( block.name === name ) {\n\t\t\treturn block;\n\t\t}\n\n\t\t// Search inside innerBlocks.\n\t\tconst firstBlock = findFirstOfSameType( block.innerBlocks, name );\n\n\t\tif ( firstBlock ) {\n\t\t\treturn firstBlock;\n\t\t}\n\t}\n}\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 {Component} WrappedBlockEdit A filtered BlockEdit instance.\n\t *\n\t * @return {Component} 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 = findFirstOfSameType( blocks, block.name );\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"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import {
|
|
10
|
-
DocumentBar,
|
|
11
|
-
PostSavedState,
|
|
12
|
-
PostPreviewButton,
|
|
13
|
-
store as editorStore,
|
|
14
|
-
privateApis as editorPrivateApis,
|
|
15
|
-
} from '@wordpress/editor';
|
|
16
|
-
import { useSelect } from '@wordpress/data';
|
|
17
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
18
|
-
import { __unstableMotion as motion } from '@wordpress/components';
|
|
19
|
-
import { store as preferencesStore } from '@wordpress/preferences';
|
|
20
|
-
import { useState } from '@wordpress/element';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies
|
|
24
|
-
*/
|
|
25
|
-
import FullscreenModeClose from './fullscreen-mode-close';
|
|
26
|
-
import PostEditorMoreMenu from './more-menu';
|
|
27
|
-
import MainDashboardButton from './main-dashboard-button';
|
|
28
|
-
import { store as editPostStore } from '../../store';
|
|
29
|
-
import { unlock } from '../../lock-unlock';
|
|
30
|
-
|
|
31
|
-
const {
|
|
32
|
-
CollapsableBlockToolbar,
|
|
33
|
-
DocumentTools,
|
|
34
|
-
PostViewLink,
|
|
35
|
-
PreviewDropdown,
|
|
36
|
-
PinnedItems,
|
|
37
|
-
MoreMenu,
|
|
38
|
-
PostPublishButtonOrToggle,
|
|
39
|
-
} = unlock( editorPrivateApis );
|
|
40
|
-
|
|
41
|
-
const slideY = {
|
|
42
|
-
hidden: { y: '-50px' },
|
|
43
|
-
distractionFreeInactive: { y: 0 },
|
|
44
|
-
hover: { y: 0, transition: { type: 'tween', delay: 0.2 } },
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const slideX = {
|
|
48
|
-
hidden: { x: '-100%' },
|
|
49
|
-
distractionFreeInactive: { x: 0 },
|
|
50
|
-
hover: { x: 0, transition: { type: 'tween', delay: 0.2 } },
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
function Header( { setEntitiesSavedStatesCallback, initialPost } ) {
|
|
54
|
-
const isWideViewport = useViewportMatch( 'large' );
|
|
55
|
-
const isLargeViewport = useViewportMatch( 'medium' );
|
|
56
|
-
const {
|
|
57
|
-
isTextEditor,
|
|
58
|
-
hasActiveMetaboxes,
|
|
59
|
-
isPublishSidebarOpened,
|
|
60
|
-
showIconLabels,
|
|
61
|
-
hasHistory,
|
|
62
|
-
hasFixedToolbar,
|
|
63
|
-
} = useSelect( ( select ) => {
|
|
64
|
-
const { get: getPreference } = select( preferencesStore );
|
|
65
|
-
const { getEditorMode } = select( editorStore );
|
|
66
|
-
|
|
67
|
-
return {
|
|
68
|
-
isTextEditor: getEditorMode() === 'text',
|
|
69
|
-
hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
|
|
70
|
-
hasHistory:
|
|
71
|
-
!! select( editorStore ).getEditorSettings()
|
|
72
|
-
.onNavigateToPreviousEntityRecord,
|
|
73
|
-
isPublishSidebarOpened:
|
|
74
|
-
select( editorStore ).isPublishSidebarOpened(),
|
|
75
|
-
showIconLabels: getPreference( 'core', 'showIconLabels' ),
|
|
76
|
-
hasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),
|
|
77
|
-
};
|
|
78
|
-
}, [] );
|
|
79
|
-
|
|
80
|
-
const hasTopToolbar = isLargeViewport && hasFixedToolbar;
|
|
81
|
-
|
|
82
|
-
const [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =
|
|
83
|
-
useState( true );
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<div className="edit-post-header">
|
|
87
|
-
<MainDashboardButton.Slot>
|
|
88
|
-
<motion.div
|
|
89
|
-
variants={ slideX }
|
|
90
|
-
transition={ { type: 'tween', delay: 0.8 } }
|
|
91
|
-
>
|
|
92
|
-
<FullscreenModeClose
|
|
93
|
-
showTooltip
|
|
94
|
-
initialPost={ initialPost }
|
|
95
|
-
/>
|
|
96
|
-
</motion.div>
|
|
97
|
-
</MainDashboardButton.Slot>
|
|
98
|
-
<motion.div
|
|
99
|
-
variants={ slideY }
|
|
100
|
-
transition={ { type: 'tween', delay: 0.8 } }
|
|
101
|
-
className="edit-post-header__toolbar"
|
|
102
|
-
>
|
|
103
|
-
<DocumentTools disableBlockTools={ isTextEditor } />
|
|
104
|
-
{ hasTopToolbar && (
|
|
105
|
-
<CollapsableBlockToolbar
|
|
106
|
-
isCollapsed={ isBlockToolsCollapsed }
|
|
107
|
-
onToggle={ setIsBlockToolsCollapsed }
|
|
108
|
-
/>
|
|
109
|
-
) }
|
|
110
|
-
<div
|
|
111
|
-
className={ classnames( 'edit-post-header__center', {
|
|
112
|
-
'is-collapsed':
|
|
113
|
-
hasHistory &&
|
|
114
|
-
! isBlockToolsCollapsed &&
|
|
115
|
-
hasTopToolbar,
|
|
116
|
-
} ) }
|
|
117
|
-
>
|
|
118
|
-
{ hasHistory && <DocumentBar /> }
|
|
119
|
-
</div>
|
|
120
|
-
</motion.div>
|
|
121
|
-
<motion.div
|
|
122
|
-
variants={ slideY }
|
|
123
|
-
transition={ { type: 'tween', delay: 0.8 } }
|
|
124
|
-
className="edit-post-header__settings"
|
|
125
|
-
>
|
|
126
|
-
{ ! isPublishSidebarOpened && (
|
|
127
|
-
// This button isn't completely hidden by the publish sidebar.
|
|
128
|
-
// We can't hide the whole toolbar when the publish sidebar is open because
|
|
129
|
-
// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.
|
|
130
|
-
// We track that DOM node to return focus to the PostPublishButtonOrToggle
|
|
131
|
-
// when the publish sidebar has been closed.
|
|
132
|
-
<PostSavedState forceIsDirty={ hasActiveMetaboxes } />
|
|
133
|
-
) }
|
|
134
|
-
<PreviewDropdown forceIsAutosaveable={ hasActiveMetaboxes } />
|
|
135
|
-
<PostPreviewButton
|
|
136
|
-
className="edit-post-header__post-preview-button"
|
|
137
|
-
forceIsAutosaveable={ hasActiveMetaboxes }
|
|
138
|
-
/>
|
|
139
|
-
<PostViewLink />
|
|
140
|
-
<PostPublishButtonOrToggle
|
|
141
|
-
forceIsDirty={ hasActiveMetaboxes }
|
|
142
|
-
setEntitiesSavedStatesCallback={
|
|
143
|
-
setEntitiesSavedStatesCallback
|
|
144
|
-
}
|
|
145
|
-
/>
|
|
146
|
-
{ ( isWideViewport || ! showIconLabels ) && (
|
|
147
|
-
<PinnedItems.Slot scope="core" />
|
|
148
|
-
) }
|
|
149
|
-
<MoreMenu />
|
|
150
|
-
<PostEditorMoreMenu />
|
|
151
|
-
</motion.div>
|
|
152
|
-
</div>
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export default Header;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
__experimentalUseSlotFills as useSlotFills,
|
|
6
|
-
createSlotFill,
|
|
7
|
-
} from '@wordpress/components';
|
|
8
|
-
|
|
9
|
-
const slotName = '__experimentalMainDashboardButton';
|
|
10
|
-
|
|
11
|
-
const { Fill, Slot: MainDashboardButtonSlot } = createSlotFill( slotName );
|
|
12
|
-
|
|
13
|
-
const MainDashboardButton = Fill;
|
|
14
|
-
|
|
15
|
-
const Slot = ( { children } ) => {
|
|
16
|
-
const fills = useSlotFills( slotName );
|
|
17
|
-
const hasFills = Boolean( fills && fills.length );
|
|
18
|
-
|
|
19
|
-
if ( ! hasFills ) {
|
|
20
|
-
return children;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return <MainDashboardButtonSlot bubblesVirtually />;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
MainDashboardButton.Slot = Slot;
|
|
27
|
-
|
|
28
|
-
export default MainDashboardButton;
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
.edit-post-header {
|
|
2
|
-
height: $header-height;
|
|
3
|
-
background: $white;
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-wrap: wrap;
|
|
6
|
-
align-items: center;
|
|
7
|
-
// The header should never be wider than the viewport, or buttons might be hidden. Especially relevant at high zoom levels. Related to https://core.trac.wordpress.org/ticket/47603#ticket.
|
|
8
|
-
max-width: 100vw;
|
|
9
|
-
justify-content: space-between;
|
|
10
|
-
|
|
11
|
-
// Make toolbar sticky on larger breakpoints
|
|
12
|
-
@include break-zoomed-in {
|
|
13
|
-
flex-wrap: nowrap;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.edit-post-header__toolbar {
|
|
18
|
-
display: flex;
|
|
19
|
-
// Allow this area to shrink to fit the toolbar buttons.
|
|
20
|
-
flex-shrink: 8;
|
|
21
|
-
// Take up the space of the toolbar so it can be justified to the left side of the toolbar.
|
|
22
|
-
flex-grow: 3;
|
|
23
|
-
// Hide the overflow so flex will limit its width. Block toolbar will allow scrolling on fixed toolbar.
|
|
24
|
-
overflow: hidden;
|
|
25
|
-
// Leave enough room for the focus ring to show.
|
|
26
|
-
padding: 2px 0;
|
|
27
|
-
align-items: center;
|
|
28
|
-
// Allow focus ring to be fully visible on furthest right button.
|
|
29
|
-
@include break-medium() {
|
|
30
|
-
padding-right: var(--wp-admin-border-width-focus);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.table-of-contents {
|
|
34
|
-
display: none;
|
|
35
|
-
|
|
36
|
-
@include break-small() {
|
|
37
|
-
display: block;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.edit-post-header__center {
|
|
43
|
-
flex-grow: 1;
|
|
44
|
-
display: flex;
|
|
45
|
-
justify-content: center;
|
|
46
|
-
|
|
47
|
-
&.is-collapsed {
|
|
48
|
-
display: none;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Buttons on the right side
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
.edit-post-header__settings {
|
|
57
|
-
display: inline-flex;
|
|
58
|
-
align-items: center;
|
|
59
|
-
flex-wrap: nowrap;
|
|
60
|
-
padding-right: $grid-unit-05;
|
|
61
|
-
|
|
62
|
-
@include break-small () {
|
|
63
|
-
padding-right: $grid-unit-10;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
gap: $grid-unit-10;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Show icon labels.
|
|
71
|
-
*/
|
|
72
|
-
|
|
73
|
-
.show-icon-labels.interface-pinned-items,
|
|
74
|
-
.show-icon-labels .edit-post-header,
|
|
75
|
-
.edit-post-header__dropdown {
|
|
76
|
-
.components-button.has-icon {
|
|
77
|
-
width: auto;
|
|
78
|
-
|
|
79
|
-
// Hide the button icons when labels are set to display...
|
|
80
|
-
svg {
|
|
81
|
-
display: none;
|
|
82
|
-
}
|
|
83
|
-
// ... and display labels.
|
|
84
|
-
&::after {
|
|
85
|
-
content: attr(aria-label);
|
|
86
|
-
}
|
|
87
|
-
&[aria-disabled="true"] {
|
|
88
|
-
background-color: transparent;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
.is-tertiary {
|
|
92
|
-
&:active {
|
|
93
|
-
box-shadow: 0 0 0 1.5px var(--wp-admin-theme-color);
|
|
94
|
-
background-color: transparent;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
// Exception for drodpdown toggle buttons.
|
|
98
|
-
// Exception for the fullscreen mode button.
|
|
99
|
-
.edit-post-fullscreen-mode-close.has-icon,
|
|
100
|
-
.components-button.has-icon.button-toggle {
|
|
101
|
-
svg {
|
|
102
|
-
display: block;
|
|
103
|
-
}
|
|
104
|
-
&::after {
|
|
105
|
-
content: none;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
// Undo the width override for fullscreen mode button.
|
|
109
|
-
.edit-post-fullscreen-mode-close.has-icon {
|
|
110
|
-
width: $header-height;
|
|
111
|
-
}
|
|
112
|
-
// Don't hide MenuItemsChoice check icons
|
|
113
|
-
.components-menu-items-choice .components-menu-items__item-icon.components-menu-items__item-icon {
|
|
114
|
-
display: block;
|
|
115
|
-
}
|
|
116
|
-
.editor-document-tools__inserter-toggle.editor-document-tools__inserter-toggle,
|
|
117
|
-
.interface-pinned-items .components-button {
|
|
118
|
-
padding-left: $grid-unit;
|
|
119
|
-
padding-right: $grid-unit;
|
|
120
|
-
|
|
121
|
-
@include break-small {
|
|
122
|
-
padding-left: $grid-unit-15;
|
|
123
|
-
padding-right: $grid-unit-15;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.editor-post-save-draft.editor-post-save-draft,
|
|
128
|
-
.editor-post-saved-state.editor-post-saved-state {
|
|
129
|
-
&::after {
|
|
130
|
-
content: none;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.show-icon-labels {
|
|
136
|
-
.edit-post-header__toolbar .block-editor-block-mover {
|
|
137
|
-
// Modified group borders.
|
|
138
|
-
border-left: none;
|
|
139
|
-
|
|
140
|
-
&::before {
|
|
141
|
-
content: "";
|
|
142
|
-
width: $border-width;
|
|
143
|
-
height: $grid-unit-30;
|
|
144
|
-
background-color: $gray-300;
|
|
145
|
-
margin-top: $grid-unit-05;
|
|
146
|
-
margin-left: $grid-unit;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// Modified block movers horizontal separator.
|
|
150
|
-
.block-editor-block-mover__move-button-container {
|
|
151
|
-
&::before {
|
|
152
|
-
width: calc(100% - #{$grid-unit-30});
|
|
153
|
-
background: $gray-300;
|
|
154
|
-
left: calc(50% + 1px);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.edit-post-header__dropdown {
|
|
161
|
-
.components-menu-item__button.components-menu-item__button,
|
|
162
|
-
.components-button.editor-history__undo,
|
|
163
|
-
.components-button.editor-history__redo,
|
|
164
|
-
.table-of-contents .components-button,
|
|
165
|
-
.components-button.block-editor-list-view {
|
|
166
|
-
margin: 0;
|
|
167
|
-
padding: 6px 6px 6px $grid-unit-50;
|
|
168
|
-
width: 14.625rem;
|
|
169
|
-
text-align: left;
|
|
170
|
-
justify-content: flex-start;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.show-icon-labels.interface-pinned-items {
|
|
175
|
-
padding: 6px $grid-unit-15 $grid-unit-15;
|
|
176
|
-
margin-top: 0;
|
|
177
|
-
margin-bottom: 0;
|
|
178
|
-
margin-left: -$grid-unit-15;
|
|
179
|
-
margin-right: -$grid-unit-15;
|
|
180
|
-
border-bottom: 1px solid $gray-400;
|
|
181
|
-
display: block;
|
|
182
|
-
|
|
183
|
-
> .components-button.has-icon {
|
|
184
|
-
margin: 0;
|
|
185
|
-
padding: 6px 6px 6px $grid-unit;
|
|
186
|
-
width: 14.625rem;
|
|
187
|
-
justify-content: flex-start;
|
|
188
|
-
|
|
189
|
-
&[aria-expanded="true"] svg {
|
|
190
|
-
display: block;
|
|
191
|
-
max-width: $grid-unit-30;
|
|
192
|
-
}
|
|
193
|
-
&[aria-expanded="false"] {
|
|
194
|
-
padding-left: $grid-unit-50;
|
|
195
|
-
}
|
|
196
|
-
svg {
|
|
197
|
-
margin-right: 8px;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.edit-post-header__post-preview-button {
|
|
203
|
-
@include break-small {
|
|
204
|
-
display: none;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.is-distraction-free {
|
|
209
|
-
.interface-interface-skeleton__header {
|
|
210
|
-
border-bottom: none;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
.edit-post-header {
|
|
214
|
-
background-color: $white;
|
|
215
|
-
border-bottom: 1px solid #e0e0e0;
|
|
216
|
-
position: absolute;
|
|
217
|
-
width: 100%;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
// hide some parts
|
|
221
|
-
& > .edit-post-header__settings > .edit-post-header__post-preview-button {
|
|
222
|
-
visibility: hidden;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
& > .edit-post-header__toolbar .editor-document-tools__document-overview-toggle,
|
|
226
|
-
& > .edit-post-header__settings > .editor-preview-dropdown,
|
|
227
|
-
& > .edit-post-header__settings > .interface-pinned-items {
|
|
228
|
-
display: none;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// We need ! important because we override inline styles
|
|
234
|
-
// set by the motion component.
|
|
235
|
-
.interface-interface-skeleton__header:focus-within {
|
|
236
|
-
opacity: 1 !important;
|
|
237
|
-
div {
|
|
238
|
-
transform: translateX(0) translateZ(0) !important;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.components-editor-notices__dismissible {
|
|
244
|
-
position: absolute;
|
|
245
|
-
z-index: 35;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
.components-popover.more-menu-dropdown__content {
|
|
250
|
-
z-index: z-index(".components-popover.more-menu__content");
|
|
251
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { PanelRow } from '@wordpress/components';
|
|
5
|
-
import {
|
|
6
|
-
PostFormat as PostFormatForm,
|
|
7
|
-
PostFormatCheck,
|
|
8
|
-
} from '@wordpress/editor';
|
|
9
|
-
|
|
10
|
-
export function PostFormat() {
|
|
11
|
-
return (
|
|
12
|
-
<PostFormatCheck>
|
|
13
|
-
<PanelRow className="edit-post-post-format">
|
|
14
|
-
<PostFormatForm />
|
|
15
|
-
</PanelRow>
|
|
16
|
-
</PostFormatCheck>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default PostFormat;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
PostPendingStatus as PostPendingStatusForm,
|
|
6
|
-
PostPendingStatusCheck,
|
|
7
|
-
privateApis as editorPrivateApis,
|
|
8
|
-
} from '@wordpress/editor';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import { unlock } from '../../../lock-unlock';
|
|
14
|
-
|
|
15
|
-
const { PostPanelRow } = unlock( editorPrivateApis );
|
|
16
|
-
|
|
17
|
-
export function PostPendingStatus() {
|
|
18
|
-
return (
|
|
19
|
-
<PostPendingStatusCheck>
|
|
20
|
-
<PostPanelRow>
|
|
21
|
-
<PostPendingStatusForm />
|
|
22
|
-
</PostPanelRow>
|
|
23
|
-
</PostPendingStatusCheck>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export default PostPendingStatus;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { PanelRow } from '@wordpress/components';
|
|
5
|
-
import { PostSlug as PostSlugForm, PostSlugCheck } from '@wordpress/editor';
|
|
6
|
-
|
|
7
|
-
export function PostSlug() {
|
|
8
|
-
return (
|
|
9
|
-
<PostSlugCheck>
|
|
10
|
-
<PanelRow className="edit-post-post-slug">
|
|
11
|
-
<PostSlugForm />
|
|
12
|
-
</PanelRow>
|
|
13
|
-
</PostSlugCheck>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default PostSlug;
|