@wordpress/editor 13.26.1-next.79a6196f.0 → 13.27.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 +3 -1
- package/build/bindings/index.js +20 -0
- package/build/bindings/index.js.map +1 -0
- package/build/bindings/post-meta.js +52 -0
- package/build/bindings/post-meta.js.map +1 -0
- package/build/components/block-manager/category.js +106 -0
- package/build/components/block-manager/category.js.map +1 -0
- package/build/components/block-manager/checklist.js +35 -0
- package/build/components/block-manager/checklist.js.map +1 -0
- package/build/components/block-manager/index.js +130 -0
- package/build/components/block-manager/index.js.map +1 -0
- package/build/components/document-tools/index.js +58 -52
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-canvas/index.js +4 -4
- package/build/components/editor-canvas/index.js.map +1 -1
- package/build/components/editor-notices/index.js +11 -11
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js +38 -7
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/offline-status/index.native.js +1 -3
- package/build/components/offline-status/index.native.js.map +1 -1
- package/build/components/post-locked-modal/index.js +1 -1
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-saved-state/index.js +10 -24
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/check.js +5 -16
- package/build/components/post-schedule/check.js.map +1 -1
- package/build/components/preferences-modal/enable-panel.js +42 -0
- package/build/components/preferences-modal/enable-panel.js.map +1 -0
- package/build/components/preferences-modal/enable-plugin-document-setting-panel.js +33 -0
- package/build/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -0
- package/build/components/preferences-modal/index.js +186 -0
- package/build/components/preferences-modal/index.js.map +1 -0
- package/build/components/provider/disable-non-page-content-blocks.js +1 -4
- package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +34 -8
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/hooks/pattern-partial-syncing.js +12 -6
- package/build/hooks/pattern-partial-syncing.js.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/private-apis.js +6 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/defaults.js +2 -0
- package/build/store/defaults.js.map +1 -1
- package/build/store/private-actions.js +33 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +1 -1
- package/build/store/private-selectors.js.map +1 -1
- package/build-module/bindings/index.js +15 -0
- package/build-module/bindings/index.js.map +1 -0
- package/build-module/bindings/post-meta.js +45 -0
- package/build-module/bindings/post-meta.js.map +1 -0
- package/build-module/components/block-manager/category.js +97 -0
- package/build-module/components/block-manager/category.js.map +1 -0
- package/build-module/components/block-manager/checklist.js +27 -0
- package/build-module/components/block-manager/checklist.js.map +1 -0
- package/build-module/components/block-manager/index.js +121 -0
- package/build-module/components/block-manager/index.js.map +1 -0
- package/build-module/components/document-tools/index.js +58 -52
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-canvas/index.js +4 -4
- package/build-module/components/editor-canvas/index.js.map +1 -1
- package/build-module/components/editor-notices/index.js +12 -12
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js +39 -8
- package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build-module/components/offline-status/index.native.js +1 -3
- package/build-module/components/offline-status/index.native.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +1 -1
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +11 -25
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/check.js +6 -15
- package/build-module/components/post-schedule/check.js.map +1 -1
- package/build-module/components/preferences-modal/enable-panel.js +34 -0
- package/build-module/components/preferences-modal/enable-panel.js.map +1 -0
- package/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js +24 -0
- package/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +179 -0
- package/build-module/components/preferences-modal/index.js.map +1 -0
- package/build-module/components/provider/disable-non-page-content-blocks.js +1 -4
- package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +35 -9
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/hooks/pattern-partial-syncing.js +12 -6
- package/build-module/hooks/pattern-partial-syncing.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/private-apis.js +6 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/defaults.js +2 -0
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/private-actions.js +29 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +1 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-style/style-rtl.css +80 -12
- package/build-style/style.css +80 -12
- package/package.json +33 -33
- package/src/bindings/index.js +13 -0
- package/src/bindings/post-meta.js +42 -0
- package/src/components/block-manager/category.js +96 -0
- package/src/components/block-manager/checklist.js +30 -0
- package/src/components/block-manager/index.js +160 -0
- package/src/components/block-manager/style.scss +82 -0
- package/src/components/document-tools/index.js +9 -1
- package/src/components/editor-canvas/index.js +3 -2
- package/src/components/editor-notices/index.js +11 -12
- package/src/components/editor-notices/style.scss +0 -1
- package/src/components/entities-saved-states/entity-type-list.js +47 -5
- package/src/components/entities-saved-states/style.scss +4 -0
- package/src/components/offline-status/index.native.js +2 -4
- package/src/components/post-locked-modal/index.js +1 -1
- package/src/components/post-locked-modal/style.scss +0 -6
- package/src/components/post-saved-state/index.js +30 -47
- package/src/components/post-schedule/check.js +10 -14
- package/src/components/post-schedule/test/check.js +24 -9
- package/src/components/preferences-modal/enable-panel.js +30 -0
- package/src/components/preferences-modal/enable-plugin-document-setting-panel.js +23 -0
- package/src/components/preferences-modal/index.js +269 -0
- package/src/components/preferences-modal/test/index.js +28 -0
- package/src/components/provider/disable-non-page-content-blocks.js +3 -3
- package/src/components/provider/use-block-editor-settings.js +45 -17
- package/src/hooks/pattern-partial-syncing.js +26 -22
- package/src/index.js +1 -0
- package/src/private-apis.js +6 -2
- package/src/store/defaults.js +2 -0
- package/src/store/private-actions.js +49 -0
- package/src/store/private-selectors.js +1 -1
- package/src/style.scss +1 -1
- package/src/components/editor-canvas/style.scss +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
5
|
+
var _data = require("@wordpress/data");
|
|
6
|
+
var _lockUnlock = require("../lock-unlock");
|
|
7
|
+
var _postMeta = _interopRequireDefault(require("./post-meta"));
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
registerBlockBindingsSource
|
|
18
|
+
} = (0, _lockUnlock.unlock)((0, _data.dispatch)(_blockEditor.store));
|
|
19
|
+
registerBlockBindingsSource(_postMeta.default);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_data","_lockUnlock","_postMeta","_interopRequireDefault","registerBlockBindingsSource","unlock","dispatch","blockEditorStore","postMeta"],"sources":["@wordpress/editor/src/bindings/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { dispatch } from '@wordpress/data';\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport postMeta from './post-meta';\n\nconst { registerBlockBindingsSource } = unlock( dispatch( blockEditorStore ) );\nregisterBlockBindingsSource( postMeta );\n"],"mappings":";;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAIA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAC,sBAAA,CAAAJ,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA,MAAM;EAAEK;AAA4B,CAAC,GAAG,IAAAC,kBAAM,EAAE,IAAAC,cAAQ,EAAEC,kBAAiB,CAAE,CAAC;AAC9EH,2BAA2B,CAAEI,iBAAS,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _coreData = require("@wordpress/core-data");
|
|
8
|
+
var _data = require("@wordpress/data");
|
|
9
|
+
var _i18n = require("@wordpress/i18n");
|
|
10
|
+
var _store = require("../store");
|
|
11
|
+
/**
|
|
12
|
+
* WordPress dependencies
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
var _default = {
|
|
18
|
+
name: 'post_meta',
|
|
19
|
+
label: (0, _i18n.__)('Post Meta'),
|
|
20
|
+
useSource(props, sourceAttributes) {
|
|
21
|
+
const {
|
|
22
|
+
getCurrentPostType
|
|
23
|
+
} = (0, _data.useSelect)(_store.store);
|
|
24
|
+
const {
|
|
25
|
+
context
|
|
26
|
+
} = props;
|
|
27
|
+
const {
|
|
28
|
+
value: metaKey
|
|
29
|
+
} = sourceAttributes;
|
|
30
|
+
const postType = context.postType ? context.postType : getCurrentPostType();
|
|
31
|
+
const [meta, setMeta] = (0, _coreData.useEntityProp)('postType', context.postType, 'meta', context.postId);
|
|
32
|
+
if (postType === 'wp_template') {
|
|
33
|
+
return {
|
|
34
|
+
placeholder: metaKey
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const metaValue = meta[metaKey];
|
|
38
|
+
const updateMetaValue = newValue => {
|
|
39
|
+
setMeta({
|
|
40
|
+
...meta,
|
|
41
|
+
[metaKey]: newValue
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
placeholder: metaKey,
|
|
46
|
+
useValue: [metaValue, updateMetaValue]
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
lockAttributesEditing: true
|
|
50
|
+
};
|
|
51
|
+
exports.default = _default;
|
|
52
|
+
//# sourceMappingURL=post-meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_coreData","require","_data","_i18n","_store","_default","name","label","__","useSource","props","sourceAttributes","getCurrentPostType","useSelect","editorStore","context","value","metaKey","postType","meta","setMeta","useEntityProp","postId","placeholder","metaValue","updateMetaValue","newValue","useValue","lockAttributesEditing","exports","default"],"sources":["@wordpress/editor/src/bindings/post-meta.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\nexport default {\n\tname: 'post_meta',\n\tlabel: __( 'Post Meta' ),\n\tuseSource( props, sourceAttributes ) {\n\t\tconst { getCurrentPostType } = useSelect( editorStore );\n\t\tconst { context } = props;\n\t\tconst { value: metaKey } = sourceAttributes;\n\t\tconst postType = context.postType\n\t\t\t? context.postType\n\t\t\t: getCurrentPostType();\n\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t'postType',\n\t\t\tcontext.postType,\n\t\t\t'meta',\n\t\t\tcontext.postId\n\t\t);\n\n\t\tif ( postType === 'wp_template' ) {\n\t\t\treturn { placeholder: metaKey };\n\t\t}\n\t\tconst metaValue = meta[ metaKey ];\n\t\tconst updateMetaValue = ( newValue ) => {\n\t\t\tsetMeta( { ...meta, [ metaKey ]: newValue } );\n\t\t};\n\t\treturn {\n\t\t\t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EAAE;AACxB,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAzB,QAAA"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _element = require("@wordpress/element");
|
|
10
|
+
var _data = require("@wordpress/data");
|
|
11
|
+
var _compose = require("@wordpress/compose");
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
var _preferences = require("@wordpress/preferences");
|
|
14
|
+
var _checklist = _interopRequireDefault(require("./checklist"));
|
|
15
|
+
var _store = require("../../store");
|
|
16
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
17
|
+
/**
|
|
18
|
+
* WordPress dependencies
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Internal dependencies
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
function BlockManagerCategory({
|
|
26
|
+
title,
|
|
27
|
+
blockTypes
|
|
28
|
+
}) {
|
|
29
|
+
const instanceId = (0, _compose.useInstanceId)(BlockManagerCategory);
|
|
30
|
+
const {
|
|
31
|
+
allowedBlockTypes,
|
|
32
|
+
hiddenBlockTypes
|
|
33
|
+
} = (0, _data.useSelect)(select => {
|
|
34
|
+
const {
|
|
35
|
+
getEditorSettings
|
|
36
|
+
} = select(_store.store);
|
|
37
|
+
const {
|
|
38
|
+
get
|
|
39
|
+
} = select(_preferences.store);
|
|
40
|
+
return {
|
|
41
|
+
allowedBlockTypes: getEditorSettings().allowedBlockTypes,
|
|
42
|
+
hiddenBlockTypes: get('core', 'hiddenBlockTypes')
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
const filteredBlockTypes = (0, _element.useMemo)(() => {
|
|
46
|
+
if (allowedBlockTypes === true) {
|
|
47
|
+
return blockTypes;
|
|
48
|
+
}
|
|
49
|
+
return blockTypes.filter(({
|
|
50
|
+
name
|
|
51
|
+
}) => {
|
|
52
|
+
return allowedBlockTypes?.includes(name);
|
|
53
|
+
});
|
|
54
|
+
}, [allowedBlockTypes, blockTypes]);
|
|
55
|
+
const {
|
|
56
|
+
showBlockTypes,
|
|
57
|
+
hideBlockTypes
|
|
58
|
+
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
59
|
+
const toggleVisible = (0, _element.useCallback)((blockName, nextIsChecked) => {
|
|
60
|
+
if (nextIsChecked) {
|
|
61
|
+
showBlockTypes(blockName);
|
|
62
|
+
} else {
|
|
63
|
+
hideBlockTypes(blockName);
|
|
64
|
+
}
|
|
65
|
+
}, [showBlockTypes, hideBlockTypes]);
|
|
66
|
+
const toggleAllVisible = (0, _element.useCallback)(nextIsChecked => {
|
|
67
|
+
const blockNames = blockTypes.map(({
|
|
68
|
+
name
|
|
69
|
+
}) => name);
|
|
70
|
+
if (nextIsChecked) {
|
|
71
|
+
showBlockTypes(blockNames);
|
|
72
|
+
} else {
|
|
73
|
+
hideBlockTypes(blockNames);
|
|
74
|
+
}
|
|
75
|
+
}, [blockTypes, showBlockTypes, hideBlockTypes]);
|
|
76
|
+
if (!filteredBlockTypes.length) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
const checkedBlockNames = filteredBlockTypes.map(({
|
|
80
|
+
name
|
|
81
|
+
}) => name).filter(type => !(hiddenBlockTypes !== null && hiddenBlockTypes !== void 0 ? hiddenBlockTypes : []).includes(type));
|
|
82
|
+
const titleId = 'editor-block-manager__category-title-' + instanceId;
|
|
83
|
+
const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;
|
|
84
|
+
const isIndeterminate = !isAllChecked && checkedBlockNames.length > 0;
|
|
85
|
+
return (0, _react.createElement)("div", {
|
|
86
|
+
role: "group",
|
|
87
|
+
"aria-labelledby": titleId,
|
|
88
|
+
className: "editor-block-manager__category"
|
|
89
|
+
}, (0, _react.createElement)(_components.CheckboxControl, {
|
|
90
|
+
__nextHasNoMarginBottom: true,
|
|
91
|
+
checked: isAllChecked,
|
|
92
|
+
onChange: toggleAllVisible,
|
|
93
|
+
className: "editor-block-manager__category-title",
|
|
94
|
+
indeterminate: isIndeterminate,
|
|
95
|
+
label: (0, _react.createElement)("span", {
|
|
96
|
+
id: titleId
|
|
97
|
+
}, title)
|
|
98
|
+
}), (0, _react.createElement)(_checklist.default, {
|
|
99
|
+
blockTypes: filteredBlockTypes,
|
|
100
|
+
value: checkedBlockNames,
|
|
101
|
+
onItemChange: toggleVisible
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
var _default = BlockManagerCategory;
|
|
105
|
+
exports.default = _default;
|
|
106
|
+
//# sourceMappingURL=category.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_compose","_components","_preferences","_checklist","_interopRequireDefault","_store","_lockUnlock","BlockManagerCategory","title","blockTypes","instanceId","useInstanceId","allowedBlockTypes","hiddenBlockTypes","useSelect","select","getEditorSettings","editorStore","get","preferencesStore","filteredBlockTypes","useMemo","filter","name","includes","showBlockTypes","hideBlockTypes","unlock","useDispatch","toggleVisible","useCallback","blockName","nextIsChecked","toggleAllVisible","blockNames","map","length","checkedBlockNames","type","titleId","isAllChecked","isIndeterminate","_react","createElement","role","className","CheckboxControl","__nextHasNoMarginBottom","checked","onChange","indeterminate","label","id","default","value","onItemChange","_default","exports"],"sources":["@wordpress/editor/src/components/block-manager/category.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { CheckboxControl } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesChecklist from './checklist';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction BlockManagerCategory( { title, blockTypes } ) {\n\tconst instanceId = useInstanceId( BlockManagerCategory );\n\tconst { allowedBlockTypes, hiddenBlockTypes } = useSelect( ( select ) => {\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\tallowedBlockTypes: getEditorSettings().allowedBlockTypes,\n\t\t\thiddenBlockTypes: get( 'core', 'hiddenBlockTypes' ),\n\t\t};\n\t}, [] );\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( allowedBlockTypes === true ) {\n\t\t\treturn blockTypes;\n\t\t}\n\t\treturn blockTypes.filter( ( { name } ) => {\n\t\t\treturn allowedBlockTypes?.includes( name );\n\t\t} );\n\t}, [ allowedBlockTypes, blockTypes ] );\n\tconst { showBlockTypes, hideBlockTypes } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\tconst toggleVisible = useCallback(\n\t\t( blockName, nextIsChecked ) => {\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tshowBlockTypes( blockName );\n\t\t\t} else {\n\t\t\t\thideBlockTypes( blockName );\n\t\t\t}\n\t\t},\n\t\t[ showBlockTypes, hideBlockTypes ]\n\t);\n\tconst toggleAllVisible = useCallback(\n\t\t( nextIsChecked ) => {\n\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t} else {\n\t\t\t\thideBlockTypes( blockNames );\n\t\t\t}\n\t\t},\n\t\t[ blockTypes, showBlockTypes, hideBlockTypes ]\n\t);\n\n\tif ( ! filteredBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\tconst checkedBlockNames = filteredBlockTypes\n\t\t.map( ( { name } ) => name )\n\t\t.filter( ( type ) => ! ( hiddenBlockTypes ?? [] ).includes( type ) );\n\n\tconst titleId = 'editor-block-manager__category-title-' + instanceId;\n\n\tconst isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;\n\tconst isIndeterminate = ! isAllChecked && checkedBlockNames.length > 0;\n\n\treturn (\n\t\t<div\n\t\t\trole=\"group\"\n\t\t\taria-labelledby={ titleId }\n\t\t\tclassName=\"editor-block-manager__category\"\n\t\t>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tchecked={ isAllChecked }\n\t\t\t\tonChange={ toggleAllVisible }\n\t\t\t\tclassName=\"editor-block-manager__category-title\"\n\t\t\t\tindeterminate={ isIndeterminate }\n\t\t\t\tlabel={ <span id={ titleId }>{ title }</span> }\n\t\t\t/>\n\t\t\t<BlockTypesChecklist\n\t\t\t\tblockTypes={ filteredBlockTypes }\n\t\t\t\tvalue={ checkedBlockNames }\n\t\t\t\tonItemChange={ toggleVisible }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default BlockManagerCategory;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,UAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAdA;AACA;AACA;;AAOA;AACA;AACA;;AAKA,SAASS,oBAAoBA,CAAE;EAAEC,KAAK;EAAEC;AAAW,CAAC,EAAG;EACtD,MAAMC,UAAU,GAAG,IAAAC,sBAAa,EAAEJ,oBAAqB,CAAC;EACxD,MAAM;IAAEK,iBAAiB;IAAEC;EAAiB,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACxE,MAAM;MAAEC;IAAkB,CAAC,GAAGD,MAAM,CAAEE,YAAY,CAAC;IACnD,MAAM;MAAEC;IAAI,CAAC,GAAGH,MAAM,CAAEI,kBAAiB,CAAC;IAC1C,OA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
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
9
|
+
var _components = require("@wordpress/components");
|
|
10
|
+
/**
|
|
11
|
+
* WordPress dependencies
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
function BlockTypesChecklist({
|
|
15
|
+
blockTypes,
|
|
16
|
+
value,
|
|
17
|
+
onItemChange
|
|
18
|
+
}) {
|
|
19
|
+
return (0, _react.createElement)("ul", {
|
|
20
|
+
className: "editor-block-manager__checklist"
|
|
21
|
+
}, blockTypes.map(blockType => (0, _react.createElement)("li", {
|
|
22
|
+
key: blockType.name,
|
|
23
|
+
className: "editor-block-manager__checklist-item"
|
|
24
|
+
}, (0, _react.createElement)(_components.CheckboxControl, {
|
|
25
|
+
__nextHasNoMarginBottom: true,
|
|
26
|
+
label: blockType.title,
|
|
27
|
+
checked: value.includes(blockType.name),
|
|
28
|
+
onChange: (...args) => onItemChange(blockType.name, ...args)
|
|
29
|
+
}), (0, _react.createElement)(_blockEditor.BlockIcon, {
|
|
30
|
+
icon: blockType.icon
|
|
31
|
+
}))));
|
|
32
|
+
}
|
|
33
|
+
var _default = BlockTypesChecklist;
|
|
34
|
+
exports.default = _default;
|
|
35
|
+
//# sourceMappingURL=checklist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_components","BlockTypesChecklist","blockTypes","value","onItemChange","_react","createElement","className","map","blockType","key","name","CheckboxControl","__nextHasNoMarginBottom","label","title","checked","includes","onChange","args","BlockIcon","icon","_default","exports","default"],"sources":["@wordpress/editor/src/components/block-manager/checklist.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { CheckboxControl } from '@wordpress/components';\n\nfunction BlockTypesChecklist( { blockTypes, value, onItemChange } ) {\n\treturn (\n\t\t<ul className=\"editor-block-manager__checklist\">\n\t\t\t{ blockTypes.map( ( blockType ) => (\n\t\t\t\t<li\n\t\t\t\t\tkey={ blockType.name }\n\t\t\t\t\tclassName=\"editor-block-manager__checklist-item\"\n\t\t\t\t>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ blockType.title }\n\t\t\t\t\t\tchecked={ value.includes( blockType.name ) }\n\t\t\t\t\t\tonChange={ ( ...args ) =>\n\t\t\t\t\t\t\tonItemChange( blockType.name, ...args )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<BlockIcon icon={ blockType.icon } />\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n\nexport default BlockTypesChecklist;\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,SAASE,mBAAmBA,CAAE;EAAEC,UAAU;EAAEC,KAAK;EAAEC;AAAa,CAAC,EAAG;EACnE,OACC,IAAAC,MAAA,CAAAC,aAAA;IAAIC,SAAS,EAAC;EAAiC,GAC5CL,UAAU,CAACM,GAAG,CAAIC,SAAS,IAC5B,IAAAJ,MAAA,CAAAC,aAAA;IACCI,GAAG,EAAGD,SAAS,CAACE,IAAM;IACtBJ,SAAS,EAAC;EAAsC,GAEhD,IAAAF,MAAA,CAAAC,aAAA,EAACN,WAAA,CAAAY,eAAe;IACfC,uBAAuB;IACvBC,KAAK,EAAGL,SAAS,CAACM,KAAO;IACzBC,OAAO,EAAGb,KAAK,CAACc,QAAQ,CAAER,SAAS,CAACE,IAAK,CAAG;IAC5CO,QAAQ,EAAGA,CAAE,GAAGC,IAAI,KACnBf,YAAY,CAAEK,SAAS,CAACE,IAAI,EAAE,GAAGQ,IAAK;EACtC,CACD,CAAC,EACF,IAAAd,MAAA,CAAAC,aAAA,EAACR,YAAA,CAAAsB,SAAS;IAACC,IAAI,EAAGZ,SAAS,CAACY;EAAM,CAAE,CACjC,CACH,CACC,CAAC;AAEP;AAAC,IAAAC,QAAA,GAEcrB,mBAAmB;AAAAsB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _blocks = require("@wordpress/blocks");
|
|
10
|
+
var _data = require("@wordpress/data");
|
|
11
|
+
var _components = require("@wordpress/components");
|
|
12
|
+
var _i18n = require("@wordpress/i18n");
|
|
13
|
+
var _element = require("@wordpress/element");
|
|
14
|
+
var _compose = require("@wordpress/compose");
|
|
15
|
+
var _a11y = require("@wordpress/a11y");
|
|
16
|
+
var _preferences = require("@wordpress/preferences");
|
|
17
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
18
|
+
var _store = require("../../store");
|
|
19
|
+
var _category = _interopRequireDefault(require("./category"));
|
|
20
|
+
/**
|
|
21
|
+
* WordPress dependencies
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Internal dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
function BlockManager({
|
|
29
|
+
blockTypes,
|
|
30
|
+
categories,
|
|
31
|
+
hasBlockSupport,
|
|
32
|
+
isMatchingSearchTerm,
|
|
33
|
+
numberOfHiddenBlocks,
|
|
34
|
+
enableAllBlockTypes
|
|
35
|
+
}) {
|
|
36
|
+
const debouncedSpeak = (0, _compose.useDebounce)(_a11y.speak, 500);
|
|
37
|
+
const [search, setSearch] = (0, _element.useState)('');
|
|
38
|
+
|
|
39
|
+
// Filtering occurs here (as opposed to `withSelect`) to avoid
|
|
40
|
+
// wasted renders by consequence of `Array#filter` producing
|
|
41
|
+
// a new value reference on each call.
|
|
42
|
+
blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent || blockType.parent.includes('core/post-content')));
|
|
43
|
+
|
|
44
|
+
// Announce search results on change
|
|
45
|
+
(0, _element.useEffect)(() => {
|
|
46
|
+
if (!search) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const count = blockTypes.length;
|
|
50
|
+
const resultsFoundMessage = (0, _i18n.sprintf)( /* translators: %d: number of results. */
|
|
51
|
+
(0, _i18n._n)('%d result found.', '%d results found.', count), count);
|
|
52
|
+
debouncedSpeak(resultsFoundMessage);
|
|
53
|
+
}, [blockTypes.length, search, debouncedSpeak]);
|
|
54
|
+
return (0, _react.createElement)("div", {
|
|
55
|
+
className: "editor-block-manager__content"
|
|
56
|
+
}, !!numberOfHiddenBlocks && (0, _react.createElement)("div", {
|
|
57
|
+
className: "editor-block-manager__disabled-blocks-count"
|
|
58
|
+
}, (0, _i18n.sprintf)( /* translators: %d: number of blocks. */
|
|
59
|
+
(0, _i18n._n)('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks), (0, _react.createElement)(_components.Button, {
|
|
60
|
+
variant: "link",
|
|
61
|
+
onClick: () => enableAllBlockTypes(blockTypes)
|
|
62
|
+
}, (0, _i18n.__)('Reset'))), (0, _react.createElement)(_components.SearchControl, {
|
|
63
|
+
__nextHasNoMarginBottom: true,
|
|
64
|
+
label: (0, _i18n.__)('Search for a block'),
|
|
65
|
+
placeholder: (0, _i18n.__)('Search for a block'),
|
|
66
|
+
value: search,
|
|
67
|
+
onChange: nextSearch => setSearch(nextSearch),
|
|
68
|
+
className: "editor-block-manager__search"
|
|
69
|
+
}), (0, _react.createElement)("div", {
|
|
70
|
+
tabIndex: "0",
|
|
71
|
+
role: "region",
|
|
72
|
+
"aria-label": (0, _i18n.__)('Available block types'),
|
|
73
|
+
className: "editor-block-manager__results"
|
|
74
|
+
}, blockTypes.length === 0 && (0, _react.createElement)("p", {
|
|
75
|
+
className: "editor-block-manager__no-results"
|
|
76
|
+
}, (0, _i18n.__)('No blocks found.')), categories.map(category => (0, _react.createElement)(_category.default, {
|
|
77
|
+
key: category.slug,
|
|
78
|
+
title: category.title,
|
|
79
|
+
blockTypes: blockTypes.filter(blockType => blockType.category === category.slug)
|
|
80
|
+
})), (0, _react.createElement)(_category.default, {
|
|
81
|
+
title: (0, _i18n.__)('Uncategorized'),
|
|
82
|
+
blockTypes: blockTypes.filter(({
|
|
83
|
+
category
|
|
84
|
+
}) => !category)
|
|
85
|
+
})));
|
|
86
|
+
}
|
|
87
|
+
var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
|
|
88
|
+
var _get;
|
|
89
|
+
const {
|
|
90
|
+
getBlockTypes,
|
|
91
|
+
getCategories,
|
|
92
|
+
hasBlockSupport,
|
|
93
|
+
isMatchingSearchTerm
|
|
94
|
+
} = select(_blocks.store);
|
|
95
|
+
const {
|
|
96
|
+
get
|
|
97
|
+
} = select(_preferences.store);
|
|
98
|
+
|
|
99
|
+
// Some hidden blocks become unregistered
|
|
100
|
+
// by removing for instance the plugin that registered them, yet
|
|
101
|
+
// they're still remain as hidden by the user's action.
|
|
102
|
+
// We consider "hidden", blocks which were hidden and
|
|
103
|
+
// are still registered.
|
|
104
|
+
const blockTypes = getBlockTypes();
|
|
105
|
+
const hiddenBlockTypes = ((_get = get('core', 'hiddenBlockTypes')) !== null && _get !== void 0 ? _get : []).filter(hiddenBlock => {
|
|
106
|
+
return blockTypes.some(registeredBlock => registeredBlock.name === hiddenBlock);
|
|
107
|
+
});
|
|
108
|
+
const numberOfHiddenBlocks = Array.isArray(hiddenBlockTypes) && hiddenBlockTypes.length;
|
|
109
|
+
return {
|
|
110
|
+
blockTypes,
|
|
111
|
+
categories: getCategories(),
|
|
112
|
+
hasBlockSupport,
|
|
113
|
+
isMatchingSearchTerm,
|
|
114
|
+
numberOfHiddenBlocks
|
|
115
|
+
};
|
|
116
|
+
}), (0, _data.withDispatch)(dispatch => {
|
|
117
|
+
const {
|
|
118
|
+
showBlockTypes
|
|
119
|
+
} = (0, _lockUnlock.unlock)(dispatch(_store.store));
|
|
120
|
+
return {
|
|
121
|
+
enableAllBlockTypes: blockTypes => {
|
|
122
|
+
const blockNames = blockTypes.map(({
|
|
123
|
+
name
|
|
124
|
+
}) => name);
|
|
125
|
+
showBlockTypes(blockNames);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
})])(BlockManager);
|
|
129
|
+
exports.default = _default;
|
|
130
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_blocks","require","_data","_components","_i18n","_element","_compose","_a11y","_preferences","_lockUnlock","_store","_category","_interopRequireDefault","BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","enableAllBlockTypes","debouncedSpeak","useDebounce","speak","search","setSearch","useState","filter","blockType","parent","includes","useEffect","count","length","resultsFoundMessage","sprintf","_n","_react","createElement","className","Button","variant","onClick","__","SearchControl","__nextHasNoMarginBottom","label","placeholder","value","onChange","nextSearch","tabIndex","role","map","category","default","key","slug","title","_default","compose","withSelect","select","_get","getBlockTypes","getCategories","blocksStore","get","preferencesStore","hiddenBlockTypes","hiddenBlock","some","registeredBlock","name","Array","isArray","withDispatch","dispatch","showBlockTypes","unlock","editorStore","blockNames","exports"],"sources":["@wordpress/editor/src/components/block-manager/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { SearchControl, Button } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce, compose } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport BlockManagerCategory from './category';\n\nfunction BlockManager( {\n\tblockTypes,\n\tcategories,\n\thasBlockSupport,\n\tisMatchingSearchTerm,\n\tnumberOfHiddenBlocks,\n\tenableAllBlockTypes,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ search, setSearch ] = useState( '' );\n\n\t// Filtering occurs here (as opposed to `withSelect`) to avoid\n\t// wasted renders by consequence of `Array#filter` producing\n\t// a new value reference on each call.\n\tblockTypes = blockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! search || isMatchingSearchTerm( blockType, search ) ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tblockType.parent.includes( 'core/post-content' ) )\n\t);\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! search ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = blockTypes.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ blockTypes.length, search, debouncedSpeak ] );\n\n\treturn (\n\t\t<div className=\"editor-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"editor-block-manager__disabled-blocks-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d block is hidden.',\n\t\t\t\t\t\t\t'%d blocks are hidden.',\n\t\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t) }\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => enableAllBlockTypes( blockTypes ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Search for a block' ) }\n\t\t\t\tplaceholder={ __( 'Search for a block' ) }\n\t\t\t\tvalue={ search }\n\t\t\t\tonChange={ ( nextSearch ) => setSearch( nextSearch ) }\n\t\t\t\tclassName=\"editor-block-manager__search\"\n\t\t\t/>\n\t\t\t<div\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"region\"\n\t\t\t\taria-label={ __( 'Available block types' ) }\n\t\t\t\tclassName=\"editor-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ blockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"editor-block-manager__no-results\">\n\t\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<BlockManagerCategory\n\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t\t( blockType ) =>\n\t\t\t\t\t\t\t\tblockType.category === category.slug\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t\t<BlockManagerCategory\n\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t( { category } ) => ! category\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockTypes,\n\t\t\tgetCategories,\n\t\t\thasBlockSupport,\n\t\t\tisMatchingSearchTerm,\n\t\t} = select( blocksStore );\n\t\tconst { get } = select( preferencesStore );\n\n\t\t// Some hidden blocks become unregistered\n\t\t// by removing for instance the plugin that registered them, yet\n\t\t// they're still remain as hidden by the user's action.\n\t\t// We consider \"hidden\", blocks which were hidden and\n\t\t// are still registered.\n\t\tconst blockTypes = getBlockTypes();\n\t\tconst hiddenBlockTypes = (\n\t\t\tget( 'core', 'hiddenBlockTypes' ) ?? []\n\t\t).filter( ( hiddenBlock ) => {\n\t\t\treturn blockTypes.some(\n\t\t\t\t( registeredBlock ) => registeredBlock.name === hiddenBlock\n\t\t\t);\n\t\t} );\n\t\tconst numberOfHiddenBlocks =\n\t\t\tArray.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length;\n\n\t\treturn {\n\t\t\tblockTypes,\n\t\t\tcategories: getCategories(),\n\t\t\thasBlockSupport,\n\t\t\tisMatchingSearchTerm,\n\t\t\tnumberOfHiddenBlocks,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { showBlockTypes } = unlock( dispatch( editorStore ) );\n\t\treturn {\n\t\t\tenableAllBlockTypes: ( blockTypes ) => {\n\t\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t},\n\t\t};\n\t} ),\n] )( BlockManager );\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,SAAA,GAAAC,sBAAA,CAAAX,OAAA;AAjBA;AACA;AACA;;AAUA;AACA;AACA;;AAKA,SAASY,YAAYA,CAAE;EACtBC,UAAU;EACVC,UAAU;EACVC,eAAe;EACfC,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CAAC,CACF,CAAC,CAAEnE,YAAa,CAAC;AAAAoE,OAAA,CAAA3B,OAAA,GAAAI,QAAA"}
|
|
@@ -102,58 +102,64 @@ function DocumentTools({
|
|
|
102
102
|
/* translators: button label text should, if possible, be under 16 characters. */
|
|
103
103
|
const longLabel = (0, _i18n._x)('Toggle block inserter', 'Generic label for block inserter button');
|
|
104
104
|
const shortLabel = !isInserterOpened ? (0, _i18n.__)('Add') : (0, _i18n.__)('Close');
|
|
105
|
-
return (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
105
|
+
return (
|
|
106
|
+
// Some plugins expect and use the `edit-post-header-toolbar` CSS class to
|
|
107
|
+
// find the toolbar and inject UI elements into it. This is not officially
|
|
108
|
+
// supported, but we're keeping it in the list of class names for backwards
|
|
109
|
+
// compatibility.
|
|
110
|
+
(0, _react.createElement)(_blockEditor.NavigableToolbar, {
|
|
111
|
+
className: (0, _classnames.default)('editor-document-tools', 'edit-post-header-toolbar', className),
|
|
112
|
+
"aria-label": toolbarAriaLabel,
|
|
113
|
+
shouldUseKeyboardFocusShortcut: !blockToolbarCanBeFocused,
|
|
114
|
+
variant: "unstyled"
|
|
115
|
+
}, (0, _react.createElement)("div", {
|
|
116
|
+
className: "editor-document-tools__left"
|
|
117
|
+
}, (0, _react.createElement)(_components.ToolbarItem, {
|
|
118
|
+
ref: inserterButton,
|
|
119
|
+
as: _components.Button,
|
|
120
|
+
className: "editor-document-tools__inserter-toggle",
|
|
121
|
+
variant: "primary",
|
|
122
|
+
isPressed: isInserterOpened,
|
|
123
|
+
onMouseDown: preventDefault,
|
|
124
|
+
onClick: toggleInserter,
|
|
125
|
+
disabled: disableBlockTools,
|
|
126
|
+
icon: _icons.plus,
|
|
127
|
+
label: showIconLabels ? shortLabel : longLabel,
|
|
128
|
+
showTooltip: !showIconLabels,
|
|
129
|
+
"aria-expanded": isInserterOpened
|
|
130
|
+
}), (isWideViewport || !showIconLabels) && (0, _react.createElement)(_react.Fragment, null, isLargeViewport && !hasFixedToolbar && (0, _react.createElement)(_components.ToolbarItem, {
|
|
131
|
+
as: _blockEditor.ToolSelector,
|
|
132
|
+
showTooltip: !showIconLabels,
|
|
133
|
+
variant: showIconLabels ? 'tertiary' : undefined,
|
|
134
|
+
disabled: disableBlockTools,
|
|
135
|
+
size: "compact"
|
|
136
|
+
}), (0, _react.createElement)(_components.ToolbarItem, {
|
|
137
|
+
as: _undo.default,
|
|
138
|
+
showTooltip: !showIconLabels,
|
|
139
|
+
variant: showIconLabels ? 'tertiary' : undefined,
|
|
140
|
+
size: "compact"
|
|
141
|
+
}), (0, _react.createElement)(_components.ToolbarItem, {
|
|
142
|
+
as: _redo.default,
|
|
143
|
+
showTooltip: !showIconLabels,
|
|
144
|
+
variant: showIconLabels ? 'tertiary' : undefined,
|
|
145
|
+
size: "compact"
|
|
146
|
+
}), (0, _react.createElement)(_components.ToolbarItem, {
|
|
147
|
+
as: _components.Button,
|
|
148
|
+
className: "editor-document-tools__document-overview-toggle",
|
|
149
|
+
icon: _icons.listView,
|
|
150
|
+
disabled: disableBlockTools,
|
|
151
|
+
isPressed: isListViewOpen
|
|
152
|
+
/* translators: button label text should, if possible, be under 16 characters. */,
|
|
153
|
+
label: listViewLabel,
|
|
154
|
+
onClick: toggleListView,
|
|
155
|
+
shortcut: listViewShortcut,
|
|
156
|
+
showTooltip: !showIconLabels,
|
|
157
|
+
variant: showIconLabels ? 'tertiary' : undefined,
|
|
158
|
+
"aria-expanded": isListViewOpen,
|
|
159
|
+
ref: listViewToggleRef,
|
|
160
|
+
size: "compact"
|
|
161
|
+
})), children))
|
|
162
|
+
);
|
|
157
163
|
}
|
|
158
164
|
var _default = DocumentTools;
|
|
159
165
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_compose","_data","_i18n","_blockEditor","_components","_icons","_element","_keyboardShortcuts","_preferences","_lockUnlock","_store","_redo","_undo","useCanBlockToolbarBeFocused","unlock","blockEditorPrivateApis","preventDefault","event","DocumentTools","className","disableBlockTools","children","listViewLabel","__","inserterButton","useRef","setIsInserterOpened","setIsListViewOpened","useDispatch","editorStore","isInserterOpened","isListViewOpen","listViewShortcut","listViewToggleRef","hasFixedToolbar","showIconLabels","useSelect","select","getSettings","blockEditorStore","get","preferencesStore","isListViewOpened","getListViewToggleRef","getShortcutRepresentation","keyboardShortcutsStore","isLargeViewport","useViewportMatch","isWideViewport","blockToolbarCanBeFocused","toolbarAriaLabel","toggleListView","useCallback","toggleInserter","current","focus","longLabel","_x","shortLabel","_react","createElement","NavigableToolbar","classnames","shouldUseKeyboardFocusShortcut","variant","ToolbarItem","ref","as","Button","isPressed","onMouseDown","onClick","disabled","icon","plus","label","showTooltip","Fragment","ToolSelector","undefined","size","EditorHistoryUndo","EditorHistoryRedo","listView","shortcut","_default","exports","default"],"sources":["@wordpress/editor/src/components/document-tools/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tNavigableToolbar,\n\tToolSelector,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useRef, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport EditorHistoryRedo from '../editor-history/redo';\nimport EditorHistoryUndo from '../editor-history/undo';\n\nconst { useCanBlockToolbarBeFocused } = unlock( blockEditorPrivateApis );\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nfunction DocumentTools( {\n\tclassName,\n\tdisableBlockTools = false,\n\tchildren,\n\t// This is a temporary prop until the list view is fully unified between post and site editors.\n\tlistViewLabel = __( 'Document Overview' ),\n} ) {\n\tconst inserterButton = useRef();\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editorStore );\n\tconst {\n\t\tisInserterOpened,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t\tlistViewToggleRef,\n\t\thasFixedToolbar,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { isListViewOpened, getListViewToggleRef } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\n\t\treturn {\n\t\t\tisInserterOpened: select( editorStore ).isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/editor/toggle-list-view'\n\t\t\t),\n\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t};\n\t}, [] );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\tconst blockToolbarCanBeFocused = useCanBlockToolbarBeFocused();\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst toggleInserter = useCallback( () => {\n\t\tif ( isInserterOpened ) {\n\t\t\t// Focusing the inserter button should close the inserter popover.\n\t\t\t// However, there are some cases it won't close when the focus is lost.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/43090 for more details.\n\t\t\tinserterButton.current.focus();\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpened, setIsInserterOpened ] );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName={ classnames( 'editor-document-tools', className ) }\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tshouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"editor-document-tools__left\">\n\t\t\t\t<ToolbarItem\n\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tclassName=\"editor-document-tools__inserter-toggle\"\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\taria-expanded={ isInserterOpened }\n\t\t\t\t/>\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && ! hasFixedToolbar && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryUndo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryRedo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tclassName=\"editor-document-tools__document-overview-toggle\"\n\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\tlabel={ listViewLabel }\n\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\taria-expanded={ isListViewOpen }\n\t\t\t\t\t\t\tref={ listViewToggleRef }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAMA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AAKA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,KAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,KAAA,GAAAd,sBAAA,CAAAC,OAAA;AA7BA;AACA;AACA;;AAGA;AACA;AACA;;AAgBA;AACA;AACA;;AAMA,MAAM;EAAEc;AAA4B,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAExE,MAAMC,cAAc,GAAKC,KAAK,IAAM;EACnCA,KAAK,CAACD,cAAc,CAAC,CAAC;AACvB,CAAC;AAED,SAASE,aAAaA,CAAE;EACvBC,SAAS;EACTC,iBAAiB,GAAG,KAAK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;IACvBiD,OAAO,EAAGpB,cAAgB;IAC1BiC,QAAQ,EAAGpD,gBAAkB;IAC7B4C,WAAW,EAAG,CAAEzC,cAAgB;IAChC6B,OAAO,EAAG7B,cAAc,GAAG,UAAU,GAAG4C,SAAW;IACnD,iBAAgBhD,cAAgB;IAChCmC,GAAG,EAAGjC,iBAAmB;IACzB+C,IAAI,EAAC;EAAS,CACd,CACA,CACF,EACC3D,QACE,CACY,CAAC;AAErB;AAAC,IAAAgE,QAAA,GAEcnE,aAAa;AAAAoE,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_compose","_data","_i18n","_blockEditor","_components","_icons","_element","_keyboardShortcuts","_preferences","_lockUnlock","_store","_redo","_undo","useCanBlockToolbarBeFocused","unlock","blockEditorPrivateApis","preventDefault","event","DocumentTools","className","disableBlockTools","children","listViewLabel","__","inserterButton","useRef","setIsInserterOpened","setIsListViewOpened","useDispatch","editorStore","isInserterOpened","isListViewOpen","listViewShortcut","listViewToggleRef","hasFixedToolbar","showIconLabels","useSelect","select","getSettings","blockEditorStore","get","preferencesStore","isListViewOpened","getListViewToggleRef","getShortcutRepresentation","keyboardShortcutsStore","isLargeViewport","useViewportMatch","isWideViewport","blockToolbarCanBeFocused","toolbarAriaLabel","toggleListView","useCallback","toggleInserter","current","focus","longLabel","_x","shortLabel","_react","createElement","NavigableToolbar","classnames","shouldUseKeyboardFocusShortcut","variant","ToolbarItem","ref","as","Button","isPressed","onMouseDown","onClick","disabled","icon","plus","label","showTooltip","Fragment","ToolSelector","undefined","size","EditorHistoryUndo","EditorHistoryRedo","listView","shortcut","_default","exports","default"],"sources":["@wordpress/editor/src/components/document-tools/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tNavigableToolbar,\n\tToolSelector,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useRef, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport EditorHistoryRedo from '../editor-history/redo';\nimport EditorHistoryUndo from '../editor-history/undo';\n\nconst { useCanBlockToolbarBeFocused } = unlock( blockEditorPrivateApis );\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nfunction DocumentTools( {\n\tclassName,\n\tdisableBlockTools = false,\n\tchildren,\n\t// This is a temporary prop until the list view is fully unified between post and site editors.\n\tlistViewLabel = __( 'Document Overview' ),\n} ) {\n\tconst inserterButton = useRef();\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editorStore );\n\tconst {\n\t\tisInserterOpened,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t\tlistViewToggleRef,\n\t\thasFixedToolbar,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { isListViewOpened, getListViewToggleRef } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\n\t\treturn {\n\t\t\tisInserterOpened: select( editorStore ).isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/editor/toggle-list-view'\n\t\t\t),\n\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t};\n\t}, [] );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\tconst blockToolbarCanBeFocused = useCanBlockToolbarBeFocused();\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst toggleInserter = useCallback( () => {\n\t\tif ( isInserterOpened ) {\n\t\t\t// Focusing the inserter button should close the inserter popover.\n\t\t\t// However, there are some cases it won't close when the focus is lost.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/43090 for more details.\n\t\t\tinserterButton.current.focus();\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpened, setIsInserterOpened ] );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t// Some plugins expect and use the `edit-post-header-toolbar` CSS class to\n\t\t// find the toolbar and inject UI elements into it. This is not officially\n\t\t// supported, but we're keeping it in the list of class names for backwards\n\t\t// compatibility.\n\t\t<NavigableToolbar\n\t\t\tclassName={ classnames(\n\t\t\t\t'editor-document-tools',\n\t\t\t\t'edit-post-header-toolbar',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tshouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"editor-document-tools__left\">\n\t\t\t\t<ToolbarItem\n\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tclassName=\"editor-document-tools__inserter-toggle\"\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\taria-expanded={ isInserterOpened }\n\t\t\t\t/>\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && ! hasFixedToolbar && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryUndo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryRedo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tclassName=\"editor-document-tools__document-overview-toggle\"\n\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\tlabel={ listViewLabel }\n\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\taria-expanded={ isListViewOpen }\n\t\t\t\t\t\t\tref={ listViewToggleRef }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAMA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AAKA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,KAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,KAAA,GAAAd,sBAAA,CAAAC,OAAA;AA7BA;AACA;AACA;;AAGA;AACA;AACA;;AAgBA;AACA;AACA;;AAMA,MAAM;EAAEc;AAA4B,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAExE,MAAMC,cAAc,GAAKC,KAAK,IAA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;MACbjD,SAAS,EAAC,iDAAiD;MAC3DsD,IAAI,EAAGU,eAAU;MACjBX,QAAQ,EAAGpD,iBAAmB;MAC9BiD,SAAS,EAAGtC;MACZ;MACA4C,KAAK,EAAGrD,aAAe;MACvBiD,OAAO,EAAGpB,cAAgB;MAC1BiC,QAAQ,EAAGpD,gBAAkB;MAC7B4C,WAAW,EAAG,CAAEzC,cAAgB;MAChC6B,OAAO,EAAG7B,cAAc,GAAG,UAAU,GAAG4C,SAAW;MACnD,iBAAgBhD,cAAgB;MAChCmC,GAAG,EAAGjC,iBAAmB;MACzB+C,IAAI,EAAC;IAAS,CACd,CACA,CACF,EACC3D,QACE,CACY;EAAC;AAErB;AAAC,IAAAgE,QAAA,GAEcnE,aAAa;AAAAoE,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -276,13 +276,13 @@ function EditorCanvas({
|
|
|
276
276
|
}
|
|
277
277
|
}, (0, _react.createElement)(_postTitle.default, {
|
|
278
278
|
ref: titleRef
|
|
279
|
-
})), (0, _react.createElement)(_blockEditor.
|
|
279
|
+
})), (0, _react.createElement)(_blockEditor.RecursionProvider, {
|
|
280
280
|
blockName: wrapperBlockName,
|
|
281
281
|
uniqueId: wrapperUniqueId
|
|
282
282
|
}, (0, _react.createElement)(_blockEditor.BlockList, {
|
|
283
|
-
className: (0, _classnames.default)(className, 'is-' + deviceType.toLowerCase() + '-preview', renderingMode !== 'post-only' ? 'wp-site-blocks' : `${blockListLayoutClass} wp-block-post-content
|
|
284
|
-
|
|
285
|
-
|
|
283
|
+
className: (0, _classnames.default)(className, 'is-' + deviceType.toLowerCase() + '-preview', renderingMode !== 'post-only' ? 'wp-site-blocks' : `${blockListLayoutClass} wp-block-post-content`,
|
|
284
|
+
// Ensure root level blocks receive default/flow blockGap styling rules.
|
|
285
|
+
renderingMode !== 'all' && 'is-' + renderingMode),
|
|
286
286
|
layout: blockListLayout,
|
|
287
287
|
dropZoneElement:
|
|
288
288
|
// When iframed, pass in the html element of the iframe to
|