@wordpress/editor 13.34.0 → 13.35.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 +10 -4
- package/build/bindings/pattern-overrides.js +70 -1
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +126 -0
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -0
- package/build/components/block-settings-menu/content-only-settings-menu.native.js +11 -0
- package/build/components/block-settings-menu/content-only-settings-menu.native.js.map +1 -0
- package/build/components/collapsible-block-toolbar/index.js +2 -2
- package/build/components/collapsible-block-toolbar/index.js.map +1 -1
- package/build/components/document-bar/index.js +2 -2
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-outline/item.js +2 -2
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/document-tools/index.js +15 -18
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-canvas/index.js +19 -8
- package/build/components/editor-canvas/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/global-styles-provider/index.js +130 -0
- package/build/components/global-styles-provider/index.js.map +1 -0
- package/build/components/header/index.js +147 -0
- package/build/components/header/index.js.map +1 -0
- package/build/components/inserter-sidebar/index.js +56 -31
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/post-actions/actions.js +122 -64
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +7 -14
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-card-panel/index.js +5 -29
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-comments/index.js +28 -8
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-discussion/panel.js +103 -21
- package/build/components/post-discussion/panel.js.map +1 -1
- package/build/components/post-excerpt/panel.js +2 -2
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-format/panel.js +27 -0
- package/build/components/post-format/panel.js.map +1 -0
- package/build/components/post-panel-row/index.js +2 -2
- package/build/components/post-panel-row/index.js.map +1 -1
- package/build/components/post-panel-section/index.js +28 -0
- package/build/components/post-panel-section/index.js.map +1 -0
- package/build/components/post-pingbacks/index.js +5 -2
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-saved-state/index.js +2 -2
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-slug/panel.js +27 -0
- package/build/components/post-slug/panel.js.map +1 -0
- package/build/components/post-status/index.js +4 -4
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-sticky/panel.js +21 -0
- package/build/components/post-sticky/panel.js.map +1 -0
- package/build/components/post-title/index.js +2 -2
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/post-title-raw.js +2 -2
- package/build/components/post-title/post-title-raw.js.map +1 -1
- package/build/components/post-transform-panel/hooks.js +90 -0
- package/build/components/post-transform-panel/hooks.js.map +1 -0
- package/build/components/post-transform-panel/index.js +101 -0
- package/build/components/post-transform-panel/index.js.map +1 -0
- package/build/components/post-trash/panel.js +18 -0
- package/build/components/post-trash/panel.js.map +1 -0
- package/build/components/post-type-support-check/index.js +1 -1
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +3 -3
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/provider/index.js +3 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +21 -3
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/sidebar/constants.js +11 -0
- package/build/components/sidebar/constants.js.map +1 -0
- package/build/components/sidebar/header.js +53 -0
- package/build/components/sidebar/header.js.map +1 -0
- package/build/components/sidebar/index.js +157 -0
- package/build/components/sidebar/index.js.map +1 -0
- package/build/components/sidebar/post-summary.js +84 -0
- package/build/components/sidebar/post-summary.js.map +1 -0
- package/build/components/start-page-options/index.js +5 -7
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/start-template-options/index.js +192 -0
- package/build/components/start-template-options/index.js.map +1 -0
- package/build/components/template-content-panel/index.js +38 -0
- package/build/components/template-content-panel/index.js.map +1 -0
- package/build/hooks/pattern-overrides.js +10 -5
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/private-apis.js +7 -12
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +72 -0
- package/build/private-apis.native.js.map +1 -0
- package/build/store/private-selectors.js +6 -1
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +15 -0
- package/build/store/reducer.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js +69 -1
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +119 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.native.js +5 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.native.js.map +1 -0
- package/build-module/components/collapsible-block-toolbar/index.js +2 -2
- package/build-module/components/collapsible-block-toolbar/index.js.map +1 -1
- package/build-module/components/document-bar/index.js +2 -2
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-outline/item.js +2 -2
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/document-tools/index.js +16 -19
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-canvas/index.js +19 -8
- package/build-module/components/editor-canvas/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +120 -0
- package/build-module/components/global-styles-provider/index.js.map +1 -0
- package/build-module/components/header/index.js +139 -0
- package/build-module/components/header/index.js.map +1 -0
- package/build-module/components/inserter-sidebar/index.js +59 -34
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/post-actions/actions.js +125 -66
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +7 -14
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +7 -30
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-comments/index.js +30 -10
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-discussion/panel.js +105 -23
- package/build-module/components/post-discussion/panel.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +2 -2
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-format/panel.js +18 -0
- package/build-module/components/post-format/panel.js.map +1 -0
- package/build-module/components/post-panel-row/index.js +2 -2
- package/build-module/components/post-panel-row/index.js.map +1 -1
- package/build-module/components/post-panel-section/index.js +20 -0
- package/build-module/components/post-panel-section/index.js.map +1 -0
- package/build-module/components/post-pingbacks/index.js +6 -3
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +2 -2
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-slug/panel.js +18 -0
- package/build-module/components/post-slug/panel.js.map +1 -0
- package/build-module/components/post-status/index.js +4 -4
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-sticky/panel.js +12 -0
- package/build-module/components/post-sticky/panel.js.map +1 -0
- package/build-module/components/post-title/index.js +2 -2
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/post-title-raw.js +2 -2
- package/build-module/components/post-title/post-title-raw.js.map +1 -1
- package/build-module/components/post-transform-panel/hooks.js +83 -0
- package/build-module/components/post-transform-panel/hooks.js.map +1 -0
- package/build-module/components/post-transform-panel/index.js +94 -0
- package/build-module/components/post-transform-panel/index.js.map +1 -0
- package/build-module/components/post-trash/panel.js +10 -0
- package/build-module/components/post-trash/panel.js.map +1 -0
- package/build-module/components/post-type-support-check/index.js +1 -1
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +3 -3
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/provider/index.js +3 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +21 -3
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/sidebar/constants.js +5 -0
- package/build-module/components/sidebar/constants.js.map +1 -0
- package/build-module/components/sidebar/header.js +46 -0
- package/build-module/components/sidebar/header.js.map +1 -0
- package/build-module/components/sidebar/index.js +149 -0
- package/build-module/components/sidebar/index.js.map +1 -0
- package/build-module/components/sidebar/post-summary.js +77 -0
- package/build-module/components/sidebar/post-summary.js.map +1 -0
- package/build-module/components/start-page-options/index.js +5 -7
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +185 -0
- package/build-module/components/start-template-options/index.js.map +1 -0
- package/build-module/components/template-content-panel/index.js +31 -0
- package/build-module/components/template-content-panel/index.js.map +1 -0
- package/build-module/hooks/pattern-overrides.js +10 -5
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/private-apis.js +7 -12
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +62 -0
- package/build-module/private-apis.native.js.map +1 -0
- package/build-module/store/private-selectors.js +3 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +14 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +328 -18
- package/build-style/style.css +328 -18
- package/package.json +38 -36
- package/src/bindings/pattern-overrides.js +83 -1
- package/src/components/autocompleters/style.scss +1 -2
- package/src/components/block-settings-menu/content-only-settings-menu.js +175 -0
- package/src/components/block-settings-menu/content-only-settings-menu.native.js +4 -0
- package/src/components/block-settings-menu/style.scss +4 -0
- package/src/components/collapsible-block-toolbar/index.js +2 -2
- package/src/components/document-bar/index.js +2 -2
- package/src/components/document-outline/item.js +2 -2
- package/src/components/document-tools/index.js +19 -21
- package/src/components/editor-canvas/index.js +18 -6
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
- package/src/components/global-styles-provider/index.js +162 -0
- package/src/components/header/index.js +154 -0
- package/src/components/header/style.scss +231 -0
- package/src/components/inserter-sidebar/index.js +52 -29
- package/src/components/inserter-sidebar/style.scss +10 -3
- package/src/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/src/components/list-view-sidebar/style.scss +1 -0
- package/src/components/page-attributes/test/order.js +5 -1
- package/src/components/post-actions/actions.js +256 -150
- package/src/components/post-actions/index.js +5 -38
- package/src/components/post-card-panel/index.js +39 -85
- package/src/components/post-comments/index.js +47 -9
- package/src/components/post-discussion/panel.js +108 -31
- package/src/components/post-discussion/style.scss +26 -0
- package/src/components/post-excerpt/panel.js +2 -2
- package/src/components/post-format/panel.js +22 -0
- package/src/components/post-format/style.scss +6 -0
- package/src/components/post-last-revision/test/check.js +5 -1
- package/src/components/post-panel-row/index.js +2 -2
- package/src/components/post-panel-section/index.js +19 -0
- package/src/components/post-panel-section/style.scss +3 -0
- package/src/components/post-pingbacks/index.js +11 -2
- package/src/components/post-publish-panel/style.scss +5 -0
- package/src/components/post-saved-state/index.js +2 -2
- package/src/components/post-slug/panel.js +22 -0
- package/src/components/post-slug/style.scss +5 -0
- package/src/components/post-slug/test/index.js +5 -1
- package/src/components/post-status/index.js +4 -4
- package/src/components/post-sticky/panel.js +18 -0
- package/src/components/post-title/index.js +2 -2
- package/src/components/post-title/post-title-raw.js +2 -2
- package/src/components/post-transform-panel/hooks.js +114 -0
- package/src/components/post-transform-panel/index.js +99 -0
- package/src/components/post-trash/panel.js +13 -0
- package/src/components/post-type-support-check/index.js +1 -1
- package/src/components/post-type-support-check/test/index.js +2 -2
- package/src/components/preferences-modal/index.js +3 -3
- package/src/components/provider/index.js +4 -0
- package/src/components/provider/use-block-editor-settings.js +19 -4
- package/src/components/sidebar/constants.js +4 -0
- package/src/components/sidebar/header.js +49 -0
- package/src/components/sidebar/index.js +200 -0
- package/src/components/sidebar/post-summary.js +104 -0
- package/src/components/sidebar/style.scss +18 -0
- package/src/components/start-page-options/index.js +6 -4
- package/src/components/start-template-options/index.js +219 -0
- package/src/components/start-template-options/style.scss +55 -0
- package/src/components/template-areas/style.scss +0 -1
- package/src/components/template-content-panel/index.js +36 -0
- package/src/hooks/pattern-overrides.js +12 -6
- package/src/private-apis.js +10 -12
- package/src/private-apis.native.js +61 -0
- package/src/store/private-selectors.js +3 -0
- package/src/store/reducer.js +12 -0
- package/src/style.scss +7 -0
- package/src/components/post-slug/test/check.js +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 13.35.0 (2024-05-16)
|
|
6
|
+
|
|
7
|
+
### Internal
|
|
8
|
+
|
|
9
|
+
- Replaced `classnames` package with the faster and smaller `clsx` package ([#61138](https://github.com/WordPress/gutenberg/pull/61138)).
|
|
10
|
+
|
|
5
11
|
## 13.34.0 (2024-05-02)
|
|
6
12
|
|
|
7
13
|
## 13.33.0 (2024-04-19)
|
|
@@ -124,7 +130,7 @@
|
|
|
124
130
|
|
|
125
131
|
### Deprecations
|
|
126
132
|
|
|
127
|
-
-
|
|
133
|
+
- Deprecated `cleanForSlug` that is now part of `@wordpress/url`.
|
|
128
134
|
|
|
129
135
|
## 12.2.0 (2022-02-10)
|
|
130
136
|
|
|
@@ -138,7 +144,7 @@
|
|
|
138
144
|
|
|
139
145
|
### Deprecations
|
|
140
146
|
|
|
141
|
-
-
|
|
147
|
+
- the `createUndoLevel` and `refreshPost` actions were marked as deprecated. They were already defunct and acting as noops.
|
|
142
148
|
|
|
143
149
|
## 12.1.0 (2022-01-27)
|
|
144
150
|
|
|
@@ -163,8 +169,8 @@
|
|
|
163
169
|
|
|
164
170
|
### Breaking Changes
|
|
165
171
|
|
|
166
|
-
- Drop support for Internet Explorer 11 ([#31110](https://github.com/WordPress/gutenberg/pull/31110)). Learn more at https://make.wordpress.org/core/2021/04/22/ie-11-support-phase-out-plan
|
|
167
|
-
- Increase the minimum Node.js version to v12 matching Long Term Support releases ([#31270](https://github.com/WordPress/gutenberg/pull/31270)). Learn more at https://nodejs.org/en/about/releases
|
|
172
|
+
- Drop support for Internet Explorer 11 ([#31110](https://github.com/WordPress/gutenberg/pull/31110)). Learn more at <https://make.wordpress.org/core/2021/04/22/ie-11-support-phase-out-plan/>.
|
|
173
|
+
- Increase the minimum Node.js version to v12 matching Long Term Support releases ([#31270](https://github.com/WordPress/gutenberg/pull/31270)). Learn more at <https://nodejs.org/en/about/releases/>.
|
|
168
174
|
|
|
169
175
|
## 9.26.0 (2021-03-17)
|
|
170
176
|
|
|
@@ -5,13 +5,82 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _i18n = require("@wordpress/i18n");
|
|
8
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
8
9
|
/**
|
|
9
10
|
* WordPress dependencies
|
|
10
11
|
*/
|
|
12
|
+
|
|
13
|
+
const CONTENT = 'content';
|
|
11
14
|
var _default = exports.default = {
|
|
12
15
|
name: 'core/pattern-overrides',
|
|
13
16
|
label: (0, _i18n._x)('Pattern Overrides', 'block bindings source'),
|
|
14
|
-
|
|
17
|
+
getValue({
|
|
18
|
+
registry,
|
|
19
|
+
clientId,
|
|
20
|
+
attributeName
|
|
21
|
+
}) {
|
|
22
|
+
const {
|
|
23
|
+
getBlockAttributes,
|
|
24
|
+
getBlockParentsByBlockName
|
|
25
|
+
} = registry.select(_blockEditor.store);
|
|
26
|
+
const currentBlockAttributes = getBlockAttributes(clientId);
|
|
27
|
+
const [patternClientId] = getBlockParentsByBlockName(clientId, 'core/block', true);
|
|
28
|
+
const overridableValue = getBlockAttributes(patternClientId)?.[CONTENT]?.[currentBlockAttributes?.metadata?.name]?.[attributeName];
|
|
29
|
+
|
|
30
|
+
// If there is no pattern client ID, or it is not overwritten, return the default value.
|
|
31
|
+
if (!patternClientId || overridableValue === undefined) {
|
|
32
|
+
return currentBlockAttributes[attributeName];
|
|
33
|
+
}
|
|
34
|
+
return overridableValue === '' ? undefined : overridableValue;
|
|
35
|
+
},
|
|
36
|
+
setValues({
|
|
37
|
+
registry,
|
|
38
|
+
clientId,
|
|
39
|
+
attributes
|
|
40
|
+
}) {
|
|
41
|
+
const {
|
|
42
|
+
getBlockAttributes,
|
|
43
|
+
getBlockParentsByBlockName,
|
|
44
|
+
getBlocks
|
|
45
|
+
} = registry.select(_blockEditor.store);
|
|
46
|
+
const currentBlockAttributes = getBlockAttributes(clientId);
|
|
47
|
+
const blockName = currentBlockAttributes?.metadata?.name;
|
|
48
|
+
if (!blockName) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const [patternClientId] = getBlockParentsByBlockName(clientId, 'core/block', true);
|
|
52
|
+
|
|
53
|
+
// If there is no pattern client ID, sync blocks with the same name and same attributes.
|
|
54
|
+
if (!patternClientId) {
|
|
55
|
+
const syncBlocksWithSameName = blocks => {
|
|
56
|
+
for (const block of blocks) {
|
|
57
|
+
if (block.attributes?.metadata?.name === blockName) {
|
|
58
|
+
registry.dispatch(_blockEditor.store).updateBlockAttributes(block.clientId, attributes);
|
|
59
|
+
}
|
|
60
|
+
syncBlocksWithSameName(block.innerBlocks);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
syncBlocksWithSameName(getBlocks());
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const currentBindingValue = getBlockAttributes(patternClientId)?.[CONTENT];
|
|
67
|
+
registry.dispatch(_blockEditor.store).updateBlockAttributes(patternClientId, {
|
|
68
|
+
[CONTENT]: {
|
|
69
|
+
...currentBindingValue,
|
|
70
|
+
[blockName]: {
|
|
71
|
+
...currentBindingValue?.[blockName],
|
|
72
|
+
...Object.entries(attributes).reduce((acc, [key, value]) => {
|
|
73
|
+
// TODO: We need a way to represent `undefined` in the serialized overrides.
|
|
74
|
+
// Also see: https://github.com/WordPress/gutenberg/pull/57249#discussion_r1452987871
|
|
75
|
+
// We use an empty string to represent undefined for now until
|
|
76
|
+
// we support a richer format for overrides and the block bindings API.
|
|
77
|
+
acc[key] = value === undefined ? '' : value;
|
|
78
|
+
return acc;
|
|
79
|
+
}, {})
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
},
|
|
15
84
|
lockAttributesEditing: false
|
|
16
85
|
};
|
|
17
86
|
//# sourceMappingURL=pattern-overrides.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_default","exports","default","name","label","_x","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_blockEditor","CONTENT","_default","exports","default","name","label","_x","getValue","registry","clientId","attributeName","getBlockAttributes","getBlockParentsByBlockName","select","blockEditorStore","currentBlockAttributes","patternClientId","overridableValue","metadata","undefined","setValues","attributes","getBlocks","blockName","syncBlocksWithSameName","blocks","block","dispatch","updateBlockAttributes","innerBlocks","currentBindingValue","Object","entries","reduce","acc","key","value","lockAttributesEditing"],"sources":["@wordpress/editor/src/bindings/pattern-overrides.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nconst CONTENT = 'content';\n\nexport default {\n\tname: 'core/pattern-overrides',\n\tlabel: _x( 'Pattern Overrides', 'block bindings source' ),\n\tgetValue( { registry, clientId, attributeName } ) {\n\t\tconst { getBlockAttributes, getBlockParentsByBlockName } =\n\t\t\tregistry.select( blockEditorStore );\n\t\tconst currentBlockAttributes = getBlockAttributes( clientId );\n\t\tconst [ patternClientId ] = getBlockParentsByBlockName(\n\t\t\tclientId,\n\t\t\t'core/block',\n\t\t\ttrue\n\t\t);\n\n\t\tconst overridableValue =\n\t\t\tgetBlockAttributes( patternClientId )?.[ CONTENT ]?.[\n\t\t\t\tcurrentBlockAttributes?.metadata?.name\n\t\t\t]?.[ attributeName ];\n\n\t\t// If there is no pattern client ID, or it is not overwritten, return the default value.\n\t\tif ( ! patternClientId || overridableValue === undefined ) {\n\t\t\treturn currentBlockAttributes[ attributeName ];\n\t\t}\n\n\t\treturn overridableValue === '' ? undefined : overridableValue;\n\t},\n\tsetValues( { registry, clientId, attributes } ) {\n\t\tconst { getBlockAttributes, getBlockParentsByBlockName, getBlocks } =\n\t\t\tregistry.select( blockEditorStore );\n\t\tconst currentBlockAttributes = getBlockAttributes( clientId );\n\t\tconst blockName = currentBlockAttributes?.metadata?.name;\n\t\tif ( ! blockName ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ patternClientId ] = getBlockParentsByBlockName(\n\t\t\tclientId,\n\t\t\t'core/block',\n\t\t\ttrue\n\t\t);\n\n\t\t// If there is no pattern client ID, sync blocks with the same name and same attributes.\n\t\tif ( ! patternClientId ) {\n\t\t\tconst syncBlocksWithSameName = ( blocks ) => {\n\t\t\t\tfor ( const block of blocks ) {\n\t\t\t\t\tif ( block.attributes?.metadata?.name === blockName ) {\n\t\t\t\t\t\tregistry\n\t\t\t\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t\t\t\t.updateBlockAttributes(\n\t\t\t\t\t\t\t\tblock.clientId,\n\t\t\t\t\t\t\t\tattributes\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tsyncBlocksWithSameName( block.innerBlocks );\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tsyncBlocksWithSameName( getBlocks() );\n\t\t\treturn;\n\t\t}\n\t\tconst currentBindingValue =\n\t\t\tgetBlockAttributes( patternClientId )?.[ CONTENT ];\n\t\tregistry\n\t\t\t.dispatch( blockEditorStore )\n\t\t\t.updateBlockAttributes( patternClientId, {\n\t\t\t\t[ CONTENT ]: {\n\t\t\t\t\t...currentBindingValue,\n\t\t\t\t\t[ blockName ]: {\n\t\t\t\t\t\t...currentBindingValue?.[ blockName ],\n\t\t\t\t\t\t...Object.entries( attributes ).reduce(\n\t\t\t\t\t\t\t( acc, [ key, value ] ) => {\n\t\t\t\t\t\t\t\t// TODO: We need a way to represent `undefined` in the serialized overrides.\n\t\t\t\t\t\t\t\t// Also see: https://github.com/WordPress/gutenberg/pull/57249#discussion_r1452987871\n\t\t\t\t\t\t\t\t// We use an empty string to represent undefined for now until\n\t\t\t\t\t\t\t\t// we support a richer format for overrides and the block bindings API.\n\t\t\t\t\t\t\t\tacc[ key ] = value === undefined ? '' : value;\n\t\t\t\t\t\t\t\treturn acc;\n\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},\n\t\t\t\t},\n\t\t\t} );\n\t},\n\tlockAttributesEditing: false,\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,MAAME,OAAO,GAAG,SAAS;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEX;EACdC,IAAI,EAAE,wBAAwB;EAC9BC,KAAK,EAAE,IAAAC,QAAE,EAAE,mBAAmB,EAAE,uBAAwB,CAAC;EACzDC,QAAQA,CAAE;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC;EAAc,CAAC,EAAG;IACjD,MAAM;MAAEC,kBAAkB;MAAEC;IAA2B,CAAC,GACvDJ,QAAQ,CAACK,MAAM,CAAEC,kBAAiB,CAAC;IACpC,MAAMC,sBAAsB,GAAGJ,kBAAkB,CAAEF,QAAS,CAAC;IAC7D,MAAM,CAAEO,eAAe,CAAE,GAAGJ,0BAA0B,CACrDH,QAAQ,EACR,YAAY,EACZ,IACD,CAAC;IAED,MAAMQ,gBAAgB,GACrBN,kBAAkB,CAAEK,eAAgB,CAAC,GAAIhB,OAAO,CAA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,QAAQ,CACNmB,QAAQ,CAAEb,kBAAiB,CAAC,CAC5Bc,qBAAqB,CAAEZ,eAAe,EAAE;MACxC,CAAEhB,OAAO,GAAI;QACZ,GAAG8B,mBAAmB;QACtB,CAAEP,SAAS,GAAI;UACd,GAAGO,mBAAmB,GAAIP,SAAS,CAAE;UACrC,GAAGQ,MAAM,CAACC,OAAO,CAAEX,UAAW,CAAC,CAACY,MAAM,CACrC,CAAEC,GAAG,EAAE,CAAEC,GAAG,EAAEC,KAAK,CAAE,KAAM;YAC1B;YACA;YACA;YACA;YACAF,GAAG,CAAEC,GAAG,CAAE,GAAGC,KAAK,KAAKjB,SAAS,GAAG,EAAE,GAAGiB,KAAK;YAC7C,OAAOF,GAAG;UACX,CAAC,EACD,CAAC,CACF;QACD;MACD;IACD,CAAE,CAAC;EACL,CAAC;EACDG,qBAAqB,EAAE;AACxB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = ContentOnlySettingsMenu;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
9
|
+
var _coreData = require("@wordpress/core-data");
|
|
10
|
+
var _components = require("@wordpress/components");
|
|
11
|
+
var _data = require("@wordpress/data");
|
|
12
|
+
var _i18n = require("@wordpress/i18n");
|
|
13
|
+
var _store = require("../../store");
|
|
14
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
15
|
+
/**
|
|
16
|
+
* WordPress dependencies
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Internal dependencies
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
function ContentOnlySettingsMenuItems({
|
|
24
|
+
clientId,
|
|
25
|
+
onClose
|
|
26
|
+
}) {
|
|
27
|
+
const {
|
|
28
|
+
entity,
|
|
29
|
+
onNavigateToEntityRecord
|
|
30
|
+
} = (0, _data.useSelect)(select => {
|
|
31
|
+
const {
|
|
32
|
+
getBlockEditingMode,
|
|
33
|
+
getBlockParentsByBlockName,
|
|
34
|
+
getSettings,
|
|
35
|
+
getBlockAttributes
|
|
36
|
+
} = select(_blockEditor.store);
|
|
37
|
+
const contentOnly = getBlockEditingMode(clientId) === 'contentOnly';
|
|
38
|
+
if (!contentOnly) {
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
const patternParent = getBlockParentsByBlockName(clientId, 'core/block', true)[0];
|
|
42
|
+
let record;
|
|
43
|
+
if (patternParent) {
|
|
44
|
+
record = select(_coreData.store).getEntityRecord('postType', 'wp_block', getBlockAttributes(patternParent).ref);
|
|
45
|
+
} else {
|
|
46
|
+
const {
|
|
47
|
+
getCurrentPostType,
|
|
48
|
+
getCurrentTemplateId
|
|
49
|
+
} = select(_store.store);
|
|
50
|
+
const currentPostType = getCurrentPostType();
|
|
51
|
+
const templateId = getCurrentTemplateId();
|
|
52
|
+
if (currentPostType === 'page' && templateId) {
|
|
53
|
+
record = select(_coreData.store).getEntityRecord('postType', 'wp_template', templateId);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
entity: record,
|
|
58
|
+
onNavigateToEntityRecord: getSettings().onNavigateToEntityRecord
|
|
59
|
+
};
|
|
60
|
+
}, [clientId]);
|
|
61
|
+
if (!entity) {
|
|
62
|
+
return (0, _react.createElement)(TemplateLockContentOnlyMenuItems, {
|
|
63
|
+
clientId: clientId,
|
|
64
|
+
onClose: onClose
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
const isPattern = entity.type === 'wp_block';
|
|
68
|
+
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_blockEditor.__unstableBlockSettingsMenuFirstItem, null, (0, _react.createElement)(_components.MenuItem, {
|
|
69
|
+
onClick: () => {
|
|
70
|
+
onNavigateToEntityRecord({
|
|
71
|
+
postId: entity.id,
|
|
72
|
+
postType: entity.type
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}, isPattern ? (0, _i18n.__)('Edit pattern') : (0, _i18n.__)('Edit template'))), (0, _react.createElement)(_components.__experimentalText, {
|
|
76
|
+
variant: "muted",
|
|
77
|
+
as: "p",
|
|
78
|
+
className: "editor-content-only-settings-menu__description"
|
|
79
|
+
}, isPattern ? (0, _i18n.__)('Edit the pattern to move, delete, or make further changes to this block.') : (0, _i18n.__)('Edit the template to move, delete, or make further changes to this block.')));
|
|
80
|
+
}
|
|
81
|
+
function TemplateLockContentOnlyMenuItems({
|
|
82
|
+
clientId,
|
|
83
|
+
onClose
|
|
84
|
+
}) {
|
|
85
|
+
const {
|
|
86
|
+
contentLockingParent
|
|
87
|
+
} = (0, _data.useSelect)(select => {
|
|
88
|
+
const {
|
|
89
|
+
getContentLockingParent
|
|
90
|
+
} = (0, _lockUnlock.unlock)(select(_blockEditor.store));
|
|
91
|
+
return {
|
|
92
|
+
contentLockingParent: getContentLockingParent(clientId)
|
|
93
|
+
};
|
|
94
|
+
}, [clientId]);
|
|
95
|
+
const blockDisplayInformation = (0, _blockEditor.useBlockDisplayInformation)(contentLockingParent);
|
|
96
|
+
// Disable reason: We're using a hook here so it has to be on top-level.
|
|
97
|
+
// eslint-disable-next-line @wordpress/no-unused-vars-before-return
|
|
98
|
+
const {
|
|
99
|
+
modifyContentLockBlock,
|
|
100
|
+
selectBlock
|
|
101
|
+
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_blockEditor.store));
|
|
102
|
+
if (!blockDisplayInformation?.title) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_blockEditor.__unstableBlockSettingsMenuFirstItem, null, (0, _react.createElement)(_components.MenuItem, {
|
|
106
|
+
onClick: () => {
|
|
107
|
+
selectBlock(contentLockingParent);
|
|
108
|
+
modifyContentLockBlock(contentLockingParent);
|
|
109
|
+
onClose();
|
|
110
|
+
}
|
|
111
|
+
}, (0, _i18n.__)('Unlock'))), (0, _react.createElement)(_components.__experimentalText, {
|
|
112
|
+
variant: "muted",
|
|
113
|
+
as: "p",
|
|
114
|
+
className: "editor-content-only-settings-menu__description"
|
|
115
|
+
}, (0, _i18n.__)('Temporarily unlock the parent block to edit, delete or make further changes to this block.')));
|
|
116
|
+
}
|
|
117
|
+
function ContentOnlySettingsMenu() {
|
|
118
|
+
return (0, _react.createElement)(_blockEditor.BlockSettingsMenuControls, null, ({
|
|
119
|
+
selectedClientIds,
|
|
120
|
+
onClose
|
|
121
|
+
}) => selectedClientIds.length === 1 && (0, _react.createElement)(ContentOnlySettingsMenuItems, {
|
|
122
|
+
clientId: selectedClientIds[0],
|
|
123
|
+
onClose: onClose
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=content-only-settings-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_coreData","_components","_data","_i18n","_store","_lockUnlock","ContentOnlySettingsMenuItems","clientId","onClose","entity","onNavigateToEntityRecord","useSelect","select","getBlockEditingMode","getBlockParentsByBlockName","getSettings","getBlockAttributes","blockEditorStore","contentOnly","patternParent","record","coreStore","getEntityRecord","ref","getCurrentPostType","getCurrentTemplateId","editorStore","currentPostType","templateId","_react","createElement","TemplateLockContentOnlyMenuItems","isPattern","type","Fragment","__unstableBlockSettingsMenuFirstItem","MenuItem","onClick","postId","id","postType","__","__experimentalText","variant","as","className","contentLockingParent","getContentLockingParent","unlock","blockDisplayInformation","useBlockDisplayInformation","modifyContentLockBlock","selectBlock","useDispatch","title","ContentOnlySettingsMenu","BlockSettingsMenuControls","selectedClientIds","length"],"sources":["@wordpress/editor/src/components/block-settings-menu/content-only-settings-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockSettingsMenuControls,\n\t__unstableBlockSettingsMenuFirstItem as BlockSettingsMenuFirstItem,\n\tstore as blockEditorStore,\n\tuseBlockDisplayInformation,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalText as Text, MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction ContentOnlySettingsMenuItems( { clientId, onClose } ) {\n\tconst { entity, onNavigateToEntityRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetSettings,\n\t\t\t\tgetBlockAttributes,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst contentOnly =\n\t\t\t\tgetBlockEditingMode( clientId ) === 'contentOnly';\n\t\t\tif ( ! contentOnly ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst patternParent = getBlockParentsByBlockName(\n\t\t\t\tclientId,\n\t\t\t\t'core/block',\n\t\t\t\ttrue\n\t\t\t)[ 0 ];\n\n\t\t\tlet record;\n\t\t\tif ( patternParent ) {\n\t\t\t\trecord = select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_block',\n\t\t\t\t\tgetBlockAttributes( patternParent ).ref\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst { getCurrentPostType, getCurrentTemplateId } =\n\t\t\t\t\tselect( editorStore );\n\t\t\t\tconst currentPostType = getCurrentPostType();\n\t\t\t\tconst templateId = getCurrentTemplateId();\n\t\t\t\tif ( currentPostType === 'page' && templateId ) {\n\t\t\t\t\trecord = select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_template',\n\t\t\t\t\t\ttemplateId\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tentity: record,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetSettings().onNavigateToEntityRecord,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tif ( ! entity ) {\n\t\treturn (\n\t\t\t<TemplateLockContentOnlyMenuItems\n\t\t\t\tclientId={ clientId }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst isPattern = entity.type === 'wp_block';\n\n\treturn (\n\t\t<>\n\t\t\t<BlockSettingsMenuFirstItem>\n\t\t\t\t<MenuItem\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\tpostId: entity.id,\n\t\t\t\t\t\t\tpostType: entity.type,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ isPattern ? __( 'Edit pattern' ) : __( 'Edit template' ) }\n\t\t\t\t</MenuItem>\n\t\t\t</BlockSettingsMenuFirstItem>\n\t\t\t<Text\n\t\t\t\tvariant=\"muted\"\n\t\t\t\tas=\"p\"\n\t\t\t\tclassName=\"editor-content-only-settings-menu__description\"\n\t\t\t>\n\t\t\t\t{ isPattern\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Edit the pattern to move, delete, or make further changes to this block.'\n\t\t\t\t\t )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'Edit the template to move, delete, or make further changes to this block.'\n\t\t\t\t\t ) }\n\t\t\t</Text>\n\t\t</>\n\t);\n}\n\nfunction TemplateLockContentOnlyMenuItems( { clientId, onClose } ) {\n\tconst { contentLockingParent } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getContentLockingParent } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tcontentLockingParent: getContentLockingParent( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst blockDisplayInformation =\n\t\tuseBlockDisplayInformation( contentLockingParent );\n\t// Disable reason: We're using a hook here so it has to be on top-level.\n\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\tconst { modifyContentLockBlock, selectBlock } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tif ( ! blockDisplayInformation?.title ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockSettingsMenuFirstItem>\n\t\t\t\t<MenuItem\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tselectBlock( contentLockingParent );\n\t\t\t\t\t\tmodifyContentLockBlock( contentLockingParent );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Unlock' ) }\n\t\t\t\t</MenuItem>\n\t\t\t</BlockSettingsMenuFirstItem>\n\t\t\t<Text\n\t\t\t\tvariant=\"muted\"\n\t\t\t\tas=\"p\"\n\t\t\t\tclassName=\"editor-content-only-settings-menu__description\"\n\t\t\t>\n\t\t\t\t{ __(\n\t\t\t\t\t'Temporarily unlock the parent block to edit, delete or make further changes to this block.'\n\t\t\t\t) }\n\t\t\t</Text>\n\t\t</>\n\t);\n}\n\nexport default function ContentOnlySettingsMenu() {\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { selectedClientIds, onClose } ) =>\n\t\t\t\tselectedClientIds.length === 1 && (\n\t\t\t\t\t<ContentOnlySettingsMenuItems\n\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAMA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,O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|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = ContentOnlySettingsMenu;
|
|
7
|
+
// Render nothing in native for now.
|
|
8
|
+
function ContentOnlySettingsMenu() {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=content-only-settings-menu.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ContentOnlySettingsMenu"],"sources":["@wordpress/editor/src/components/block-settings-menu/content-only-settings-menu.native.js"],"sourcesContent":["// Render nothing in native for now.\nexport default function ContentOnlySettingsMenu() {\n\treturn null;\n}\n"],"mappings":";;;;;;AAAA;AACe,SAASA,uBAAuBA,CAAA,EAAG;EACjD,OAAO,IAAI;AACZ","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
9
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
10
|
var _blockEditor = require("@wordpress/block-editor");
|
|
11
11
|
var _element = require("@wordpress/element");
|
|
12
12
|
var _components = require("@wordpress/components");
|
|
@@ -52,7 +52,7 @@ function CollapsableBlockToolbar({
|
|
|
52
52
|
return null;
|
|
53
53
|
}
|
|
54
54
|
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
|
|
55
|
-
className: (0,
|
|
55
|
+
className: (0, _clsx.default)('editor-collapsible-block-toolbar', {
|
|
56
56
|
'is-collapsed': isCollapsed || !hasBlockSelection
|
|
57
57
|
})
|
|
58
58
|
}, (0, _react.createElement)(_blockEditor.BlockToolbar, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_element","_components","_i18n","_icons","_data","_lockUnlock","useHasBlockToolbar","unlock","blockEditorPrivateApis","CollapsableBlockToolbar","isCollapsed","onToggle","blockSelectionStart","useSelect","select","blockEditorStore","getBlockSelectionStart","hasBlockToolbar","hasBlockSelection","useEffect","_react","createElement","Fragment","className","clsx","BlockToolbar","hideDragHandle","Popover","Slot","name","Button","icon","next","previous","onClick","label","__","size","_default","exports","default"],"sources":["@wordpress/editor/src/components/collapsible-block-toolbar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { Button, Popover } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { next, previous } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useHasBlockToolbar } = unlock( blockEditorPrivateApis );\n\nfunction CollapsableBlockToolbar( { isCollapsed, onToggle } ) {\n\tconst { blockSelectionStart } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tblockSelectionStart:\n\t\t\t\tselect( blockEditorStore ).getBlockSelectionStart(),\n\t\t};\n\t}, [] );\n\tconst hasBlockToolbar = useHasBlockToolbar();\n\n\tconst hasBlockSelection = !! blockSelectionStart;\n\n\tuseEffect( () => {\n\t\t// If we have a new block selection, show the block tools\n\t\tif ( blockSelectionStart ) {\n\t\t\tonToggle( false );\n\t\t}\n\t}, [ blockSelectionStart, onToggle ] );\n\n\tif ( ! hasBlockToolbar ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName={ clsx( 'editor-collapsible-block-toolbar', {\n\t\t\t\t\t'is-collapsed': isCollapsed || ! hasBlockSelection,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t</div>\n\t\t\t<Popover.Slot name=\"block-toolbar\" />\n\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-collapsible-block-toolbar__toggle\"\n\t\t\t\ticon={ isCollapsed ? next : previous }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tonToggle( ! isCollapsed );\n\t\t\t\t} }\n\t\t\t\tlabel={\n\t\t\t\t\tisCollapsed\n\t\t\t\t\t\t? __( 'Show block tools' )\n\t\t\t\t\t\t: __( 'Hide block tools' )\n\t\t\t\t}\n\t\t\t\tsize=\"compact\"\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default CollapsableBlockToolbar;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,WAAA,GAAAP,OAAA;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAYA;AACA;AACA;;AAGA,MAAM;EAAEQ;AAAmB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAE/D,SAASC,uBAAuBA,CAAE;EAAEC,WAAW;EAAEC;AAAS,CAAC,EAAG;EAC7D,MAAM;IAAEC;EAAoB,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACxD,OAAO;MACNF,mBAAmB,EAClBE,MAAM,CAAEC,kBAAiB,CAAC,CAACC,sBAAsB,CAAC;IACpD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAMC,eAAe,GAAGX,kBAAkB,CAAC,CAAC;EAE5C,MAAMY,iBAAiB,GAAG,CAAC,CAAEN,mBAAmB;EAEhD,IAAAO,kBAAS,EAAE,MAAM;IAChB;IACA,IAAKP,mBAAmB,EAAG;MAC1BD,QAAQ,CAAE,KAAM,CAAC;IAClB;EACD,CAAC,EAAE,CAAEC,mBAAmB,EAAED,QAAQ,CAAG,CAAC;EAEtC,IAAK,CAAEM,eAAe,EAAG;IACxB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAG,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA;IACCE,SAAS,EAAG,IAAAC,aAAI,EAAE,kCAAkC,EAAE;MACrD,cAAc,EAAEd,WAAW,IAAI,CAAEQ;IAClC,CAAE;EAAG,GAEL,IAAAE,MAAA,CAAAC,aAAA,EAACtB,YAAA,CAAA0B,YAAY;IAACC,cAAc;EAAA,CAAE,CAC1B,CAAC,EACN,IAAAN,MAAA,CAAAC,aAAA,EAACpB,WAAA,CAAA0B,OAAO,CAACC,IAAI;IAACC,IAAI,EAAC;EAAe,CAAE,CAAC,EAErC,IAAAT,MAAA,CAAAC,aAAA,EAACpB,WAAA,CAAA6B,MAAM;IACNP,SAAS,EAAC,0CAA0C;IACpDQ,IAAI,EAAGrB,WAAW,GAAGsB,WAAI,GAAGC,eAAU;IACtCC,OAAO,EAAGA,CAAA,KAAM;MACfvB,QAAQ,CAAE,CAAED,WAAY,CAAC;IAC1B,CAAG;IACHyB,KAAK,EACJzB,WAAW,GACR,IAAA0B,QAAE,EAAE,kBAAmB,CAAC,GACxB,IAAAA,QAAE,EAAE,kBAAmB,CAC1B;IACDC,IAAI,EAAC;EAAS,CACd,CACA,CAAC;AAEL;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc/B,uBAAuB","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = DocumentBar;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
9
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
10
|
var _i18n = require("@wordpress/i18n");
|
|
11
11
|
var _data = require("@wordpress/data");
|
|
12
12
|
var _components = require("@wordpress/components");
|
|
@@ -92,7 +92,7 @@ function DocumentBar() {
|
|
|
92
92
|
mounted.current = true;
|
|
93
93
|
}, []);
|
|
94
94
|
return (0, _react.createElement)("div", {
|
|
95
|
-
className: (0,
|
|
95
|
+
className: (0, _clsx.default)('editor-document-bar', {
|
|
96
96
|
'has-back-button': hasBackButton,
|
|
97
97
|
'is-global': isGlobalEntity
|
|
98
98
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_data","_components","_blockEditor","_icons","_keycodes","_coreData","_commands","_element","_compose","_store","_lockUnlock","TYPE_LABELS","wp_pattern","__","wp_navigation","wp_template","wp_template_part","TEMPLATE_POST_TYPES","GLOBAL_POST_TYPES","MotionButton","motion","Button","DocumentBar","postType","document","isResolving","templateIcon","templateTitle","onNavigateToPreviousEntityRecord","useSelect","select","getCurrentPostType","getCurrentPostId","getEditorSettings","__experimentalGetTemplateInfo","getTemplateInfo","editorStore","getEditedEntityRecord","isResolvingSelector","coreStore","_postType","_postId","_document","_templateInfo","unlock","getPostIcon","area","title","open","openCommandCenter","useDispatch","commandsStore","isReducedMotion","useReducedMotion","isNotFound","isTemplate","includes","isGlobalEntity","hasBackButton","mounted","useRef","useEffect","current","_react","createElement","className","classnames","__unstableAnimatePresence","icon","isRTL","chevronRightSmall","chevronLeftSmall","onClick","event","stopPropagation","size","initial","opacity","transform","animate","exit","transition","duration","undefined","__experimentalText","__unstableMotion","div","key","BlockIcon","as","sprintf","displayShortcut","primary"],"sources":["@wordpress/editor/src/components/document-bar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { chevronLeftSmall, chevronRightSmall } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst TYPE_LABELS = {\n\t// translators: 1: Pattern title.\n\twp_pattern: __( 'Editing pattern: %s' ),\n\t// translators: 1: Navigation menu title.\n\twp_navigation: __( 'Editing navigation menu: %s' ),\n\t// translators: 1: Template title.\n\twp_template: __( 'Editing template: %s' ),\n\t// translators: 1: Template part title.\n\twp_template_part: __( 'Editing template part: %s' ),\n};\n\nconst TEMPLATE_POST_TYPES = [ 'wp_template', 'wp_template_part' ];\n\nconst GLOBAL_POST_TYPES = [\n\t...TEMPLATE_POST_TYPES,\n\t'wp_block',\n\t'wp_navigation',\n];\n\nconst MotionButton = motion( Button );\n\nexport default function DocumentBar() {\n\tconst {\n\t\tpostType,\n\t\tdocument,\n\t\tisResolving,\n\t\ttemplateIcon,\n\t\ttemplateTitle,\n\t\tonNavigateToPreviousEntityRecord,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\tgetEditorSettings,\n\t\t\t__experimentalGetTemplateInfo: getTemplateInfo,\n\t\t} = select( editorStore );\n\t\tconst { getEditedEntityRecord, isResolving: isResolvingSelector } =\n\t\t\tselect( coreStore );\n\t\tconst _postType = getCurrentPostType();\n\t\tconst _postId = getCurrentPostId();\n\t\tconst _document = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\t_postId\n\t\t);\n\t\tconst _templateInfo = getTemplateInfo( _document );\n\t\treturn {\n\t\t\tpostType: _postType,\n\t\t\tdocument: _document,\n\t\t\tisResolving: isResolvingSelector(\n\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\t_postId\n\t\t\t),\n\t\t\ttemplateIcon: unlock( select( editorStore ) ).getPostIcon(\n\t\t\t\t_postType,\n\t\t\t\t{\n\t\t\t\t\tarea: _document?.area,\n\t\t\t\t}\n\t\t\t),\n\t\t\ttemplateTitle: _templateInfo.title,\n\t\t\tonNavigateToPreviousEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t};\n\t}, [] );\n\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\tconst isReducedMotion = useReducedMotion();\n\n\tconst isNotFound = ! document && ! isResolving;\n\tconst isTemplate = TEMPLATE_POST_TYPES.includes( postType );\n\tconst isGlobalEntity = GLOBAL_POST_TYPES.includes( postType );\n\tconst hasBackButton = !! onNavigateToPreviousEntityRecord;\n\tconst title = isTemplate ? templateTitle : document.title;\n\n\tconst mounted = useRef( false );\n\tuseEffect( () => {\n\t\tmounted.current = true;\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'editor-document-bar', {\n\t\t\t\t'has-back-button': hasBackButton,\n\t\t\t\t'is-global': isGlobalEntity,\n\t\t\t} ) }\n\t\t>\n\t\t\t<AnimatePresence>\n\t\t\t\t{ hasBackButton && (\n\t\t\t\t\t<MotionButton\n\t\t\t\t\t\tclassName=\"editor-document-bar__back\"\n\t\t\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tonNavigateToPreviousEntityRecord();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmounted.current\n\t\t\t\t\t\t\t\t? { opacity: 0, transform: 'translateX(15%)' }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ { opacity: 1, transform: 'translateX(0%)' } }\n\t\t\t\t\t\texit={ { opacity: 0, transform: 'translateX(15%)' } }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</MotionButton>\n\t\t\t\t) }\n\t\t\t</AnimatePresence>\n\t\t\t{ isNotFound ? (\n\t\t\t\t<Text>{ __( 'Document not found' ) }</Text>\n\t\t\t) : (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-document-bar__command\"\n\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"editor-document-bar__title\"\n\t\t\t\t\t\t// Force entry animation when the back button is added or removed.\n\t\t\t\t\t\tkey={ hasBackButton }\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmounted.current\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\t\t\ttransform: hasBackButton\n\t\t\t\t\t\t\t\t\t\t\t? 'translateX(15%)'\n\t\t\t\t\t\t\t\t\t\t\t: 'translateX(-15%)',\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransform: 'translateX(0%)',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockIcon icon={ templateIcon } />\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\t\tas=\"h1\"\n\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\tTYPE_LABELS[ postType ]\n\t\t\t\t\t\t\t\t\t? // eslint-disable-next-line @wordpress/valid-sprintf\n\t\t\t\t\t\t\t\t\t sprintf( TYPE_LABELS[ postType ], title )\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</motion.div>\n\t\t\t\t\t<span className=\"editor-document-bar__shortcut\">\n\t\t\t\t\t\t{ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAMA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AAKA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AA5BA;AACA;AACA;;AAGA;AACA;AACA;;AAiBA;AACA;AACA;;AAIA,MAAMa,WAAW,GAAG;EACnB;EACAC,UAAU,EAAE,IAAAC,QAAE,EAAE,qBAAsB,CAAC;EACvC;EACAC,aAAa,EAAE,IAAAD,QAAE,EAAE,6BAA8B,CAAC;EAClD;EACAE,WAAW,EAAE,IAAAF,QAAE,EAAE,sBAAuB,CAAC;EACzC;EACAG,gBAAgB,EAAE,IAAAH,QAAE,EAAE,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F,kBAAI;IACJT,IAAI,EAAC,MAAM;IACXc,EAAE,EAAC,IAAI;IACP,cACC9E,WAAW,CAAEY,QAAQ,CAAE;IACpB;IACA,IAAAmE,aAAO,EAAE/E,WAAW,CAAEY,QAAQ,CAAE,EAAEwB,KAAM,CAAC,GACzCoC;EACH,GAECpC,KACG,CACK,CAAC,EACb,IAAAgB,MAAA,CAAAC,aAAA;IAAMC,SAAS,EAAC;EAA+B,GAC5C0B,yBAAe,CAACC,OAAO,CAAE,GAAI,CAC1B,CACC,CAEL,CAAC;AAER","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_data","_components","_blockEditor","_icons","_keycodes","_coreData","_commands","_element","_compose","_store","_lockUnlock","TYPE_LABELS","wp_pattern","__","wp_navigation","wp_template","wp_template_part","TEMPLATE_POST_TYPES","GLOBAL_POST_TYPES","MotionButton","motion","Button","DocumentBar","postType","document","isResolving","templateIcon","templateTitle","onNavigateToPreviousEntityRecord","useSelect","select","getCurrentPostType","getCurrentPostId","getEditorSettings","__experimentalGetTemplateInfo","getTemplateInfo","editorStore","getEditedEntityRecord","isResolvingSelector","coreStore","_postType","_postId","_document","_templateInfo","unlock","getPostIcon","area","title","open","openCommandCenter","useDispatch","commandsStore","isReducedMotion","useReducedMotion","isNotFound","isTemplate","includes","isGlobalEntity","hasBackButton","mounted","useRef","useEffect","current","_react","createElement","className","clsx","__unstableAnimatePresence","icon","isRTL","chevronRightSmall","chevronLeftSmall","onClick","event","stopPropagation","size","initial","opacity","transform","animate","exit","transition","duration","undefined","__experimentalText","__unstableMotion","div","key","BlockIcon","as","sprintf","displayShortcut","primary"],"sources":["@wordpress/editor/src/components/document-bar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { chevronLeftSmall, chevronRightSmall } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst TYPE_LABELS = {\n\t// translators: 1: Pattern title.\n\twp_pattern: __( 'Editing pattern: %s' ),\n\t// translators: 1: Navigation menu title.\n\twp_navigation: __( 'Editing navigation menu: %s' ),\n\t// translators: 1: Template title.\n\twp_template: __( 'Editing template: %s' ),\n\t// translators: 1: Template part title.\n\twp_template_part: __( 'Editing template part: %s' ),\n};\n\nconst TEMPLATE_POST_TYPES = [ 'wp_template', 'wp_template_part' ];\n\nconst GLOBAL_POST_TYPES = [\n\t...TEMPLATE_POST_TYPES,\n\t'wp_block',\n\t'wp_navigation',\n];\n\nconst MotionButton = motion( Button );\n\nexport default function DocumentBar() {\n\tconst {\n\t\tpostType,\n\t\tdocument,\n\t\tisResolving,\n\t\ttemplateIcon,\n\t\ttemplateTitle,\n\t\tonNavigateToPreviousEntityRecord,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\tgetEditorSettings,\n\t\t\t__experimentalGetTemplateInfo: getTemplateInfo,\n\t\t} = select( editorStore );\n\t\tconst { getEditedEntityRecord, isResolving: isResolvingSelector } =\n\t\t\tselect( coreStore );\n\t\tconst _postType = getCurrentPostType();\n\t\tconst _postId = getCurrentPostId();\n\t\tconst _document = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\t_postId\n\t\t);\n\t\tconst _templateInfo = getTemplateInfo( _document );\n\t\treturn {\n\t\t\tpostType: _postType,\n\t\t\tdocument: _document,\n\t\t\tisResolving: isResolvingSelector(\n\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\t_postId\n\t\t\t),\n\t\t\ttemplateIcon: unlock( select( editorStore ) ).getPostIcon(\n\t\t\t\t_postType,\n\t\t\t\t{\n\t\t\t\t\tarea: _document?.area,\n\t\t\t\t}\n\t\t\t),\n\t\t\ttemplateTitle: _templateInfo.title,\n\t\t\tonNavigateToPreviousEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t};\n\t}, [] );\n\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\tconst isReducedMotion = useReducedMotion();\n\n\tconst isNotFound = ! document && ! isResolving;\n\tconst isTemplate = TEMPLATE_POST_TYPES.includes( postType );\n\tconst isGlobalEntity = GLOBAL_POST_TYPES.includes( postType );\n\tconst hasBackButton = !! onNavigateToPreviousEntityRecord;\n\tconst title = isTemplate ? templateTitle : document.title;\n\n\tconst mounted = useRef( false );\n\tuseEffect( () => {\n\t\tmounted.current = true;\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'editor-document-bar', {\n\t\t\t\t'has-back-button': hasBackButton,\n\t\t\t\t'is-global': isGlobalEntity,\n\t\t\t} ) }\n\t\t>\n\t\t\t<AnimatePresence>\n\t\t\t\t{ hasBackButton && (\n\t\t\t\t\t<MotionButton\n\t\t\t\t\t\tclassName=\"editor-document-bar__back\"\n\t\t\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tonNavigateToPreviousEntityRecord();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmounted.current\n\t\t\t\t\t\t\t\t? { opacity: 0, transform: 'translateX(15%)' }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ { opacity: 1, transform: 'translateX(0%)' } }\n\t\t\t\t\t\texit={ { opacity: 0, transform: 'translateX(15%)' } }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</MotionButton>\n\t\t\t\t) }\n\t\t\t</AnimatePresence>\n\t\t\t{ isNotFound ? (\n\t\t\t\t<Text>{ __( 'Document not found' ) }</Text>\n\t\t\t) : (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-document-bar__command\"\n\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"editor-document-bar__title\"\n\t\t\t\t\t\t// Force entry animation when the back button is added or removed.\n\t\t\t\t\t\tkey={ hasBackButton }\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmounted.current\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\t\t\ttransform: hasBackButton\n\t\t\t\t\t\t\t\t\t\t\t? 'translateX(15%)'\n\t\t\t\t\t\t\t\t\t\t\t: 'translateX(-15%)',\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransform: 'translateX(0%)',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockIcon icon={ templateIcon } />\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\t\tas=\"h1\"\n\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\tTYPE_LABELS[ postType ]\n\t\t\t\t\t\t\t\t\t? // eslint-disable-next-line @wordpress/valid-sprintf\n\t\t\t\t\t\t\t\t\t sprintf( TYPE_LABELS[ postType ], title )\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</motion.div>\n\t\t\t\t\t<span className=\"editor-document-bar__shortcut\">\n\t\t\t\t\t\t{ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAMA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AAKA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AA5BA;AACA;AACA;;AAGA;AACA;AACA;;AAiBA;AACA;AACA;;AAIA,MAAMa,WAAW,GAAG;EACnB;EACAC,UAAU,EAAE,IAAAC,QAAE,EAAE,qBAAsB,CAAC;EACvC;EACAC,aAAa,EAAE,IAAAD,QAAE,EAAE,6BAA8B,CAAC;EAClD;EACAE,WAAW,EAAE,IAAAF,QAAE,EA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,CAAC,EACnC,IAAAqC,MAAA,CAAAC,aAAA,EAAC/D,WAAA,CAAAmF,kBAAI;IACJT,IAAI,EAAC,MAAM;IACXc,EAAE,EAAC,IAAI;IACP,cACC9E,WAAW,CAAEY,QAAQ,CAAE;IACpB;IACA,IAAAmE,aAAO,EAAE/E,WAAW,CAAEY,QAAQ,CAAE,EAAEwB,KAAM,CAAC,GACzCoC;EACH,GAECpC,KACG,CACK,CAAC,EACb,IAAAgB,MAAA,CAAAC,aAAA;IAAMC,SAAS,EAAC;EAA+B,GAC5C0B,yBAAe,CAACC,OAAO,CAAE,GAAI,CAC1B,CACC,CAEL,CAAC;AAER","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
9
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
10
|
/**
|
|
11
11
|
* External dependencies
|
|
12
12
|
*/
|
|
@@ -18,7 +18,7 @@ const TableOfContentsItem = ({
|
|
|
18
18
|
href,
|
|
19
19
|
onSelect
|
|
20
20
|
}) => (0, _react.createElement)("li", {
|
|
21
|
-
className: (0,
|
|
21
|
+
className: (0, _clsx.default)('document-outline__item', `is-${level.toLowerCase()}`, {
|
|
22
22
|
'is-invalid': !isValid
|
|
23
23
|
})
|
|
24
24
|
}, (0, _react.createElement)("a", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","TableOfContentsItem","children","isValid","level","href","onSelect","_react","createElement","className","clsx","toLowerCase","onClick","_default","exports","default"],"sources":["@wordpress/editor/src/components/document-outline/item.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\nconst TableOfContentsItem = ( {\n\tchildren,\n\tisValid,\n\tlevel,\n\thref,\n\tonSelect,\n} ) => (\n\t<li\n\t\tclassName={ clsx(\n\t\t\t'document-outline__item',\n\t\t\t`is-${ level.toLowerCase() }`,\n\t\t\t{\n\t\t\t\t'is-invalid': ! isValid,\n\t\t\t}\n\t\t) }\n\t>\n\t\t<a\n\t\t\thref={ href }\n\t\t\tclassName=\"document-outline__button\"\n\t\t\tonClick={ onSelect }\n\t\t>\n\t\t\t<span\n\t\t\t\tclassName=\"document-outline__emdash\"\n\t\t\t\taria-hidden=\"true\"\n\t\t\t></span>\n\t\t\t<strong className=\"document-outline__level\">{ level }</strong>\n\t\t\t<span className=\"document-outline__item-content\">{ children }</span>\n\t\t</a>\n\t</li>\n);\n\nexport default TableOfContentsItem;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,mBAAmB,GAAGA,CAAE;EAC7BC,QAAQ;EACRC,OAAO;EACPC,KAAK;EACLC,IAAI;EACJC;AACD,CAAC,KACA,IAAAC,MAAA,CAAAC,aAAA;EACCC,SAAS,EAAG,IAAAC,aAAI,EACf,wBAAwB,EACvB,MAAMN,KAAK,CAACO,WAAW,CAAC,CAAG,EAAC,EAC7B;IACC,YAAY,EAAE,CAAER;EACjB,CACD;AAAG,GAEH,IAAAI,MAAA,CAAAC,aAAA;EACCH,IAAI,EAAGA,IAAM;EACbI,SAAS,EAAC,0BAA0B;EACpCG,OAAO,EAAGN;AAAU,GAEpB,IAAAC,MAAA,CAAAC,aAAA;EACCC,SAAS,EAAC,0BAA0B;EACpC,eAAY;AAAM,CACZ,CAAC,EACR,IAAAF,MAAA,CAAAC,aAAA;EAAQC,SAAS,EAAC;AAAyB,GAAGL,KAAe,CAAC,EAC9D,IAAAG,MAAA,CAAAC,aAAA;EAAMC,SAAS,EAAC;AAAgC,GAAGP,QAAgB,CACjE,CACA,CACJ;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEad,mBAAmB","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
9
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
10
|
var _compose = require("@wordpress/compose");
|
|
11
11
|
var _data = require("@wordpress/data");
|
|
12
12
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -38,11 +38,9 @@ const preventDefault = event => {
|
|
|
38
38
|
function DocumentTools({
|
|
39
39
|
className,
|
|
40
40
|
disableBlockTools = false,
|
|
41
|
-
children,
|
|
42
41
|
// This is a temporary prop until the list view is fully unified between post and site editors.
|
|
43
42
|
listViewLabel = (0, _i18n.__)('Document Overview')
|
|
44
43
|
}) {
|
|
45
|
-
const inserterButton = (0, _element.useRef)();
|
|
46
44
|
const {
|
|
47
45
|
setIsInserterOpened,
|
|
48
46
|
setIsListViewOpened
|
|
@@ -52,6 +50,7 @@ function DocumentTools({
|
|
|
52
50
|
isInserterOpened,
|
|
53
51
|
isListViewOpen,
|
|
54
52
|
listViewShortcut,
|
|
53
|
+
inserterSidebarToggleRef,
|
|
55
54
|
listViewToggleRef,
|
|
56
55
|
hasFixedToolbar,
|
|
57
56
|
showIconLabels
|
|
@@ -64,19 +63,27 @@ function DocumentTools({
|
|
|
64
63
|
} = select(_preferences.store);
|
|
65
64
|
const {
|
|
66
65
|
isListViewOpened,
|
|
66
|
+
getEditorMode,
|
|
67
|
+
getInserterSidebarToggleRef,
|
|
67
68
|
getListViewToggleRef
|
|
68
69
|
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
69
70
|
const {
|
|
70
71
|
getShortcutRepresentation
|
|
71
72
|
} = select(_keyboardShortcuts.store);
|
|
73
|
+
const {
|
|
74
|
+
__unstableGetEditorMode
|
|
75
|
+
} = select(_blockEditor.store);
|
|
72
76
|
return {
|
|
73
77
|
isInserterOpened: select(_store.store).isInserterOpened(),
|
|
74
78
|
isListViewOpen: isListViewOpened(),
|
|
75
79
|
listViewShortcut: getShortcutRepresentation('core/editor/toggle-list-view'),
|
|
80
|
+
inserterSidebarToggleRef: getInserterSidebarToggleRef(),
|
|
76
81
|
listViewToggleRef: getListViewToggleRef(),
|
|
77
82
|
hasFixedToolbar: getSettings().hasFixedToolbar,
|
|
78
83
|
showIconLabels: get('core', 'showIconLabels'),
|
|
79
|
-
isDistractionFree: get('core', 'distractionFree')
|
|
84
|
+
isDistractionFree: get('core', 'distractionFree'),
|
|
85
|
+
isVisualMode: getEditorMode() === 'visual',
|
|
86
|
+
isZoomedOutView: __unstableGetEditorMode() === 'zoom-out'
|
|
80
87
|
};
|
|
81
88
|
}, []);
|
|
82
89
|
const isLargeViewport = (0, _compose.useViewportMatch)('medium');
|
|
@@ -85,17 +92,7 @@ function DocumentTools({
|
|
|
85
92
|
/* translators: accessibility text for the editor toolbar */
|
|
86
93
|
const toolbarAriaLabel = (0, _i18n.__)('Document tools');
|
|
87
94
|
const toggleListView = (0, _element.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
|
|
88
|
-
const toggleInserter = (0, _element.useCallback)(() =>
|
|
89
|
-
if (isInserterOpened) {
|
|
90
|
-
// Focusing the inserter button should close the inserter popover.
|
|
91
|
-
// However, there are some cases it won't close when the focus is lost.
|
|
92
|
-
// See https://github.com/WordPress/gutenberg/issues/43090 for more details.
|
|
93
|
-
inserterButton.current.focus();
|
|
94
|
-
setIsInserterOpened(false);
|
|
95
|
-
} else {
|
|
96
|
-
setIsInserterOpened(true);
|
|
97
|
-
}
|
|
98
|
-
}, [isInserterOpened, setIsInserterOpened]);
|
|
95
|
+
const toggleInserter = (0, _element.useCallback)(() => setIsInserterOpened(!isInserterOpened), [isInserterOpened, setIsInserterOpened]);
|
|
99
96
|
|
|
100
97
|
/* translators: button label text should, if possible, be under 16 characters. */
|
|
101
98
|
const longLabel = (0, _i18n._x)('Toggle block inserter', 'Generic label for block inserter button');
|
|
@@ -106,13 +103,13 @@ function DocumentTools({
|
|
|
106
103
|
// supported, but we're keeping it in the list of class names for backwards
|
|
107
104
|
// compatibility.
|
|
108
105
|
(0, _react.createElement)(_blockEditor.NavigableToolbar, {
|
|
109
|
-
className: (0,
|
|
106
|
+
className: (0, _clsx.default)('editor-document-tools', 'edit-post-header-toolbar', className),
|
|
110
107
|
"aria-label": toolbarAriaLabel,
|
|
111
108
|
variant: "unstyled"
|
|
112
109
|
}, (0, _react.createElement)("div", {
|
|
113
110
|
className: "editor-document-tools__left"
|
|
114
111
|
}, !isDistractionFree && (0, _react.createElement)(_components.ToolbarItem, {
|
|
115
|
-
ref:
|
|
112
|
+
ref: inserterSidebarToggleRef,
|
|
116
113
|
as: _components.Button,
|
|
117
114
|
className: "editor-document-tools__inserter-toggle",
|
|
118
115
|
variant: "primary",
|
|
@@ -155,7 +152,7 @@ function DocumentTools({
|
|
|
155
152
|
"aria-expanded": isListViewOpen,
|
|
156
153
|
ref: listViewToggleRef,
|
|
157
154
|
size: "compact"
|
|
158
|
-
}))
|
|
155
|
+
}))))
|
|
159
156
|
);
|
|
160
157
|
}
|
|
161
158
|
var _default = exports.default = DocumentTools;
|