@wordpress/edit-post 6.17.0 → 6.19.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 +8 -0
- package/build/components/block-manager/category.js +4 -12
- package/build/components/block-manager/category.js.map +1 -1
- package/build/components/block-manager/checklist.js +4 -3
- package/build/components/block-manager/checklist.js.map +1 -1
- package/build/components/block-manager/index.js +1 -1
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.js +2 -8
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/index.js +5 -4
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +1 -3
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js +13 -14
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -7
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +71 -5
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +2 -7
- package/build/components/layout/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +1 -1
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-outline.js +119 -0
- package/build/components/secondary-sidebar/list-view-outline.js.map +1 -0
- package/build/components/secondary-sidebar/list-view-sidebar.js +38 -13
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/visual-editor/index.js +4 -1
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/store/actions.js +24 -41
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +29 -8
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/block-manager/category.js +5 -13
- package/build-module/components/block-manager/category.js.map +1 -1
- package/build-module/components/block-manager/checklist.js +5 -4
- package/build-module/components/block-manager/checklist.js.map +1 -1
- package/build-module/components/block-manager/index.js +2 -2
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.js +3 -9
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/index.js +5 -4
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +1 -3
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js +13 -14
- package/build-module/components/header/writing-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -6
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +71 -6
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +2 -7
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +1 -1
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-outline.js +108 -0
- package/build-module/components/secondary-sidebar/list-view-outline.js.map +1 -0
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +36 -14
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/visual-editor/index.js +3 -1
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/store/actions.js +22 -37
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +30 -7
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +96 -40
- package/build-style/style.css +96 -40
- package/package.json +27 -27
- package/src/components/block-manager/category.js +5 -12
- package/src/components/block-manager/checklist.js +3 -6
- package/src/components/block-manager/index.js +2 -2
- package/src/components/block-manager/style.scss +4 -15
- package/src/components/header/fullscreen-mode-close/test/__snapshots__/index.js.snap +26 -0
- package/src/components/header/fullscreen-mode-close/test/index.js +10 -12
- package/src/components/header/header-toolbar/index.js +2 -10
- package/src/components/header/index.js +4 -1
- package/src/components/header/more-menu/index.js +1 -1
- package/src/components/header/style.scss +3 -9
- package/src/components/header/writing-menu/index.js +13 -11
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -0
- package/src/components/keyboard-shortcut-help-modal/shortcut.js +15 -18
- package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +70 -0
- package/src/components/keyboard-shortcuts/index.js +77 -8
- package/src/components/layout/index.js +2 -9
- package/src/components/layout/style.scss +12 -1
- package/src/components/preferences-modal/index.js +1 -1
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +52 -47
- package/src/components/secondary-sidebar/list-view-outline.js +98 -0
- package/src/components/secondary-sidebar/list-view-sidebar.js +49 -10
- package/src/components/secondary-sidebar/style.scss +67 -11
- package/src/components/sidebar/plugin-post-status-info/test/__snapshots__/index.js.snap +6 -4
- package/src/components/sidebar/plugin-post-status-info/test/index.js +1 -1
- package/src/components/sidebar/plugin-pre-publish-panel/test/index.js +8 -6
- package/src/components/visual-editor/index.js +9 -3
- package/src/components/visual-editor/test/index.native.js +13 -13
- package/src/store/actions.js +21 -35
- package/src/store/reducer.js +28 -8
- package/src/store/test/reducer.js +32 -2
- package/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap +0 -3
package/build/store/reducer.js
CHANGED
|
@@ -13,14 +13,8 @@ exports.metaBoxLocations = metaBoxLocations;
|
|
|
13
13
|
exports.publishSidebarActive = publishSidebarActive;
|
|
14
14
|
exports.removedPanels = removedPanels;
|
|
15
15
|
|
|
16
|
-
var _lodash = require("lodash");
|
|
17
|
-
|
|
18
16
|
var _data = require("@wordpress/data");
|
|
19
17
|
|
|
20
|
-
/**
|
|
21
|
-
* External dependencies
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
18
|
/**
|
|
25
19
|
* WordPress dependencies
|
|
26
20
|
*/
|
|
@@ -39,7 +33,7 @@ function removedPanels() {
|
|
|
39
33
|
|
|
40
34
|
switch (action.type) {
|
|
41
35
|
case 'REMOVE_PANEL':
|
|
42
|
-
if (!
|
|
36
|
+
if (!state.includes(action.panelName)) {
|
|
43
37
|
return [...state, action.panelName];
|
|
44
38
|
}
|
|
45
39
|
|
|
@@ -117,6 +111,24 @@ function isSavingMetaBoxes() {
|
|
|
117
111
|
return state;
|
|
118
112
|
}
|
|
119
113
|
}
|
|
114
|
+
|
|
115
|
+
function mergeMetaboxes() {
|
|
116
|
+
let metaboxes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
117
|
+
let newMetaboxes = arguments.length > 1 ? arguments[1] : undefined;
|
|
118
|
+
const mergedMetaboxes = [...metaboxes];
|
|
119
|
+
|
|
120
|
+
for (const metabox of newMetaboxes) {
|
|
121
|
+
const existing = mergedMetaboxes.findIndex(box => box.id === metabox.id);
|
|
122
|
+
|
|
123
|
+
if (existing !== -1) {
|
|
124
|
+
mergedMetaboxes[existing] = metabox;
|
|
125
|
+
} else {
|
|
126
|
+
mergedMetaboxes.push(metabox);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return mergedMetaboxes;
|
|
131
|
+
}
|
|
120
132
|
/**
|
|
121
133
|
* Reducer keeping track of the meta boxes per location.
|
|
122
134
|
*
|
|
@@ -133,7 +145,16 @@ function metaBoxLocations() {
|
|
|
133
145
|
|
|
134
146
|
switch (action.type) {
|
|
135
147
|
case 'SET_META_BOXES_PER_LOCATIONS':
|
|
136
|
-
|
|
148
|
+
{
|
|
149
|
+
const newState = { ...state
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
for (const [location, metaboxes] of Object.entries(action.metaBoxesPerLocation)) {
|
|
153
|
+
newState[location] = mergeMetaboxes(newState[location], metaboxes);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return newState;
|
|
157
|
+
}
|
|
137
158
|
}
|
|
138
159
|
|
|
139
160
|
return state;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/store/reducer.js"],"names":["removedPanels","state","action","type","panelName","activeModal","name","publishSidebarActive","isSavingMetaBoxes","metaBoxLocations","metaBoxesPerLocation","deviceType","blockInserterPanel","isOpen","value","listViewPanel","isEditingTemplate","metaBoxesInitialized","metaBoxes","isSaving","locations","initialized"],"mappings":";;;;;;;;;;;;;;;AAGA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/store/reducer.js"],"names":["removedPanels","state","action","type","includes","panelName","activeModal","name","publishSidebarActive","isSavingMetaBoxes","mergeMetaboxes","metaboxes","newMetaboxes","mergedMetaboxes","metabox","existing","findIndex","box","id","push","metaBoxLocations","newState","location","Object","entries","metaBoxesPerLocation","deviceType","blockInserterPanel","isOpen","value","listViewPanel","isEditingTemplate","metaBoxesInitialized","metaBoxes","isSaving","locations","initialized"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,GAA6C;AAAA,MAArBC,KAAqB,uEAAb,EAAa;AAAA,MAATC,MAAS;;AACnD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,cAAL;AACC,UAAK,CAAEF,KAAK,CAACG,QAAN,CAAgBF,MAAM,CAACG,SAAvB,CAAP,EAA4C;AAC3C,eAAO,CAAE,GAAGJ,KAAL,EAAYC,MAAM,CAACG,SAAnB,CAAP;AACA;;AAJH;;AAOA,SAAOJ,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASK,WAAT,GAA6C;AAAA,MAAvBL,KAAuB,uEAAf,IAAe;AAAA,MAATC,MAAS;;AACnD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,YAAL;AACC,aAAOD,MAAM,CAACK,IAAd;;AACD,SAAK,aAAL;AACC,aAAO,IAAP;AAJF;;AAOA,SAAON,KAAP;AAC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B,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS8B,iBAAT,GAAoD;AAAA,MAAxB9B,KAAwB,uEAAhB,KAAgB;AAAA,MAATC,MAAS;;AACnD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,yBAAL;AACC,aAAOD,MAAM,CAAC2B,KAAd;AAFF;;AAIA,SAAO5B,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS+B,oBAAT,GAAuD;AAAA,MAAxB/B,KAAwB,uEAAhB,KAAgB;AAAA,MAATC,MAAS;;AACtD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,wBAAL;AACC,aAAO,IAAP;AAFF;;AAIA,SAAOF,KAAP;AACA;;AAED,MAAMgC,SAAS,GAAG,2BAAiB;AAClCC,EAAAA,QAAQ,EAAEzB,iBADwB;AAElC0B,EAAAA,SAAS,EAAEf,gBAFuB;AAGlCgB,EAAAA,WAAW,EAAEJ;AAHqB,CAAjB,CAAlB;;eAMe,2BAAiB;AAC/B1B,EAAAA,WAD+B;AAE/B2B,EAAAA,SAF+B;AAG/BzB,EAAAA,oBAH+B;AAI/BR,EAAAA,aAJ+B;AAK/B0B,EAAAA,UAL+B;AAM/BC,EAAAA,kBAN+B;AAO/BG,EAAAA,aAP+B;AAQ/BC,EAAAA;AAR+B,CAAjB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer storing the list of all programmatically removed panels.\n *\n * @param {Array} state Current state.\n * @param {Object} action Action object.\n *\n * @return {Array} Updated state.\n */\nexport function removedPanels( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REMOVE_PANEL':\n\t\t\tif ( ! state.includes( action.panelName ) ) {\n\t\t\t\treturn [ ...state, action.panelName ];\n\t\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for storing the name of the open modal, or null if no modal is open.\n *\n * @param {Object} state Previous state.\n * @param {Object} action Action object containing the `name` of the modal\n *\n * @return {Object} Updated state\n */\nexport function activeModal( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_MODAL':\n\t\t\treturn action.name;\n\t\tcase 'CLOSE_MODAL':\n\t\t\treturn null;\n\t}\n\n\treturn state;\n}\n\nexport function publishSidebarActive( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_PUBLISH_SIDEBAR':\n\t\t\treturn true;\n\t\tcase 'CLOSE_PUBLISH_SIDEBAR':\n\t\t\treturn false;\n\t\tcase 'TOGGLE_PUBLISH_SIDEBAR':\n\t\t\treturn ! state;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the meta boxes isSaving state.\n * A \"true\" value means the meta boxes saving request is in-flight.\n *\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function isSavingMetaBoxes( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_META_BOX_UPDATES':\n\t\t\treturn true;\n\t\tcase 'META_BOX_UPDATES_SUCCESS':\n\t\tcase 'META_BOX_UPDATES_FAILURE':\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn state;\n\t}\n}\n\nfunction mergeMetaboxes( metaboxes = [], newMetaboxes ) {\n\tconst mergedMetaboxes = [ ...metaboxes ];\n\tfor ( const metabox of newMetaboxes ) {\n\t\tconst existing = mergedMetaboxes.findIndex(\n\t\t\t( box ) => box.id === metabox.id\n\t\t);\n\t\tif ( existing !== -1 ) {\n\t\t\tmergedMetaboxes[ existing ] = metabox;\n\t\t} else {\n\t\t\tmergedMetaboxes.push( metabox );\n\t\t}\n\t}\n\treturn mergedMetaboxes;\n}\n\n/**\n * Reducer keeping track of the meta boxes per location.\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function metaBoxLocations( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_META_BOXES_PER_LOCATIONS': {\n\t\t\tconst newState = { ...state };\n\t\t\tfor ( const [ location, metaboxes ] of Object.entries(\n\t\t\t\taction.metaBoxesPerLocation\n\t\t\t) ) {\n\t\t\t\tnewState[ location ] = mergeMetaboxes(\n\t\t\t\t\tnewState[ location ],\n\t\t\t\t\tmetaboxes\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn newState;\n\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the inserter panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking whether template editing is on or off.\n *\n * @param {boolean} state\n * @param {Object} action\n */\nfunction isEditingTemplate( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_EDITING_TEMPLATE':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking whether meta boxes are initialized.\n *\n * @param {boolean} state\n * @param {Object} action\n *\n * @return {boolean} Updated state.\n */\nfunction metaBoxesInitialized( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'META_BOXES_INITIALIZED':\n\t\t\treturn true;\n\t}\n\treturn state;\n}\n\nconst metaBoxes = combineReducers( {\n\tisSaving: isSavingMetaBoxes,\n\tlocations: metaBoxLocations,\n\tinitialized: metaBoxesInitialized,\n} );\n\nexport default combineReducers( {\n\tactiveModal,\n\tmetaBoxes,\n\tpublishSidebarActive,\n\tremovedPanels,\n\tdeviceType,\n\tblockInserterPanel,\n\tlistViewPanel,\n\tisEditingTemplate,\n} );\n"]}
|
|
@@ -3,7 +3,7 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { map } from 'lodash';
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
@@ -50,7 +50,7 @@ function BlockManagerCategory(_ref) {
|
|
|
50
50
|
let {
|
|
51
51
|
name
|
|
52
52
|
} = _ref2;
|
|
53
|
-
return
|
|
53
|
+
return defaultAllowedBlockTypes === null || defaultAllowedBlockTypes === void 0 ? void 0 : defaultAllowedBlockTypes.includes(name);
|
|
54
54
|
});
|
|
55
55
|
}, [defaultAllowedBlockTypes, blockTypes]);
|
|
56
56
|
const {
|
|
@@ -81,25 +81,17 @@ function BlockManagerCategory(_ref) {
|
|
|
81
81
|
const checkedBlockNames = map(filteredBlockTypes, 'name').filter(type => !hiddenBlockTypes.includes(type));
|
|
82
82
|
const titleId = 'edit-post-block-manager__category-title-' + instanceId;
|
|
83
83
|
const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (isAllChecked) {
|
|
87
|
-
ariaChecked = 'true';
|
|
88
|
-
} else if (checkedBlockNames.length > 0) {
|
|
89
|
-
ariaChecked = 'mixed';
|
|
90
|
-
} else {
|
|
91
|
-
ariaChecked = 'false';
|
|
92
|
-
}
|
|
93
|
-
|
|
84
|
+
const isIndeterminate = !isAllChecked && checkedBlockNames.length > 0;
|
|
94
85
|
return createElement("div", {
|
|
95
86
|
role: "group",
|
|
96
87
|
"aria-labelledby": titleId,
|
|
97
88
|
className: "edit-post-block-manager__category"
|
|
98
89
|
}, createElement(CheckboxControl, {
|
|
90
|
+
__nextHasNoMarginBottom: true,
|
|
99
91
|
checked: isAllChecked,
|
|
100
92
|
onChange: toggleAllVisible,
|
|
101
93
|
className: "edit-post-block-manager__category-title",
|
|
102
|
-
|
|
94
|
+
indeterminate: isIndeterminate,
|
|
103
95
|
label: createElement("span", {
|
|
104
96
|
id: titleId
|
|
105
97
|
}, title)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/category.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/category.js"],"names":["map","useMemo","useCallback","useDispatch","useSelect","useInstanceId","CheckboxControl","store","editorStore","BlockTypesChecklist","editPostStore","BlockManagerCategory","title","blockTypes","instanceId","defaultAllowedBlockTypes","hiddenBlockTypes","select","getEditorSettings","getHiddenBlockTypes","filteredBlockTypes","filter","name","includes","showBlockTypes","hideBlockTypes","toggleVisible","blockName","nextIsChecked","toggleAllVisible","blockNames","length","checkedBlockNames","type","titleId","isAllChecked","isIndeterminate"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,OAAT,EAAkBC,WAAlB,QAAqC,oBAArC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,KAAK,IAAIC,WA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AK,EAAGY,iBAFT;AAGC,IAAA,YAAY,EAAGN;AAHhB,IAbD,CADD;AAqBA;;AAED,eAAef,oBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { map } from 'lodash';\n\n/**\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 editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesChecklist from './checklist';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManagerCategory( { title, blockTypes } ) {\n\tconst instanceId = useInstanceId( BlockManagerCategory );\n\tconst { defaultAllowedBlockTypes, hiddenBlockTypes } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getHiddenBlockTypes } = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tdefaultAllowedBlockTypes:\n\t\t\t\t\tgetEditorSettings().defaultAllowedBlockTypes,\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( defaultAllowedBlockTypes === true ) {\n\t\t\treturn blockTypes;\n\t\t}\n\t\treturn blockTypes.filter( ( { name } ) => {\n\t\t\treturn defaultAllowedBlockTypes?.includes( name );\n\t\t} );\n\t}, [ defaultAllowedBlockTypes, blockTypes ] );\n\tconst { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore );\n\tconst toggleVisible = useCallback( ( blockName, nextIsChecked ) => {\n\t\tif ( nextIsChecked ) {\n\t\t\tshowBlockTypes( blockName );\n\t\t} else {\n\t\t\thideBlockTypes( blockName );\n\t\t}\n\t}, [] );\n\tconst toggleAllVisible = useCallback(\n\t\t( nextIsChecked ) => {\n\t\t\tconst blockNames = map( blockTypes, '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 ]\n\t);\n\n\tif ( ! filteredBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\tconst checkedBlockNames = map( filteredBlockTypes, 'name' ).filter(\n\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t);\n\n\tconst titleId = 'edit-post-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=\"edit-post-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=\"edit-post-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"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createElement
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
@@ -18,9 +18,8 @@ function BlockTypesChecklist(_ref) {
|
|
|
18
18
|
key: blockType.name,
|
|
19
19
|
className: "edit-post-block-manager__checklist-item"
|
|
20
20
|
}, createElement(CheckboxControl, {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})),
|
|
21
|
+
__nextHasNoMarginBottom: true,
|
|
22
|
+
label: blockType.title,
|
|
24
23
|
checked: value.includes(blockType.name),
|
|
25
24
|
onChange: function () {
|
|
26
25
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -29,6 +28,8 @@ function BlockTypesChecklist(_ref) {
|
|
|
29
28
|
|
|
30
29
|
return onItemChange(blockType.name, ...args);
|
|
31
30
|
}
|
|
31
|
+
}), createElement(BlockIcon, {
|
|
32
|
+
icon: blockType.icon
|
|
32
33
|
}))));
|
|
33
34
|
}
|
|
34
35
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/checklist.js"],"names":["BlockIcon","CheckboxControl","BlockTypesChecklist","blockTypes","value","onItemChange","map","blockType","name","title","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/checklist.js"],"names":["BlockIcon","CheckboxControl","BlockTypesChecklist","blockTypes","value","onItemChange","map","blockType","name","title","includes","args","icon"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,yBAA1B;AACA,SAASC,eAAT,QAAgC,uBAAhC;;AAEA,SAASC,mBAAT,OAAoE;AAAA,MAAtC;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,KAAd;AAAqBC,IAAAA;AAArB,GAAsC;AACnE,SACC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGF,UAAU,CAACG,GAAX,CAAkBC,SAAF,IACjB;AACC,IAAA,GAAG,EAAGA,SAAS,CAACC,IADjB;AAEC,IAAA,SAAS,EAAC;AAFX,KAIC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGD,SAAS,CAACE,KAFnB;AAGC,IAAA,OAAO,EAAGL,KAAK,CAACM,QAAN,CAAgBH,SAAS,CAACC,IAA1B,CAHX;AAIC,IAAA,QAAQ,EAAG;AAAA,wCAAKG,IAAL;AAAKA,QAAAA,IAAL;AAAA;;AAAA,aACVN,YAAY,CAAEE,SAAS,CAACC,IAAZ,EAAkB,GAAGG,IAArB,CADF;AAAA;AAJZ,IAJD,EAYC,cAAC,SAAD;AAAW,IAAA,IAAI,EAAGJ,SAAS,CAACK;AAA5B,IAZD,CADC,CADH,CADD;AAoBA;;AAED,eAAeV,mBAAf","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=\"edit-post-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=\"edit-post-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"]}
|
|
@@ -3,7 +3,7 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { filter
|
|
6
|
+
import { filter } from 'lodash';
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
@@ -35,7 +35,7 @@ function BlockManager(_ref) {
|
|
|
35
35
|
// wasted renders by consequence of `Array#filter` producing
|
|
36
36
|
// a new value reference on each call.
|
|
37
37
|
|
|
38
|
-
blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent ||
|
|
38
|
+
blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent || blockType.parent.includes('core/post-content'))); // Announce search results on change
|
|
39
39
|
|
|
40
40
|
useEffect(() => {
|
|
41
41
|
if (!search) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/index.js"],"names":["filter","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/index.js"],"names":["filter","store","blocksStore","withSelect","SearchControl","__","_n","sprintf","useEffect","useState","useDebounce","speak","BlockManagerCategory","editPostStore","BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","debouncedSpeak","search","setSearch","blockType","parent","includes","count","length","resultsFoundMessage","nextSearch","map","category","slug","title","select","getBlockTypes","getCategories","getHiddenBlockTypes","hiddenBlockTypes","hiddenBlock","some","registeredBlock","name","Array","isArray"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,QAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,YAAjC;AACA,SAASX,KAAK,IAAIY,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,YAAT,OAMI;AAAA,MANmB;AACtBC,IAAAA,UADsB;AAEtBC,IAAAA,UAFsB;AAGtBC,IAAAA,eAHsB;AAItBC,IAAAA,oBAJsB;AAKtBC,IAAAA;AALsB,GAMnB;AACH,QAA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JC,eAAF,IAAuBA,eAAe,CAACC,IAAhB,KAAyBH,WAD1C,CAAP;AAGA,GAJwB,CAAzB;AAKA,QAAMpB,oBAAoB,GACzBwB,KAAK,CAACC,OAAN,CAAeN,gBAAf,KAAqCA,gBAAgB,CAACX,MADvD;AAGA,SAAO;AACNZ,IAAAA,UADM;AAENC,IAAAA,UAAU,EAAEoB,aAAa,EAFnB;AAGNnB,IAAAA,eAHM;AAINC,IAAAA,oBAJM;AAKNC,IAAAA;AALM,GAAP;AAOA,CA9BwB,CAAV,CA8BVL,YA9BU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { filter } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { withSelect } from '@wordpress/data';\nimport { SearchControl } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockManagerCategory from './category';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManager( {\n\tblockTypes,\n\tcategories,\n\thasBlockSupport,\n\tisMatchingSearchTerm,\n\tnumberOfHiddenBlocks,\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=\"edit-post-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"edit-post-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</div>\n\t\t\t) }\n\t\t\t<SearchControl\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=\"edit-post-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=\"edit-post-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ blockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"edit-post-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={ filter( blockTypes, {\n\t\t\t\t\t\t\tcategory: 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={ filter(\n\t\t\t\t\t\tblockTypes,\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 withSelect( ( select ) => {\n\tconst {\n\t\tgetBlockTypes,\n\t\tgetCategories,\n\t\thasBlockSupport,\n\t\tisMatchingSearchTerm,\n\t} = select( blocksStore );\n\tconst { getHiddenBlockTypes } = select( editPostStore );\n\n\t// Some hidden blocks become unregistered\n\t// by removing for instance the plugin that registered them, yet\n\t// they're still remain as hidden by the user's action.\n\t// We consider \"hidden\", blocks which were hidden and\n\t// are still registered.\n\tconst blockTypes = getBlockTypes();\n\tconst hiddenBlockTypes = getHiddenBlockTypes().filter( ( hiddenBlock ) => {\n\t\treturn blockTypes.some(\n\t\t\t( registeredBlock ) => registeredBlock.name === hiddenBlock\n\t\t);\n\t} );\n\tconst numberOfHiddenBlocks =\n\t\tArray.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length;\n\n\treturn {\n\t\tblockTypes,\n\t\tcategories: getCategories(),\n\t\thasBlockSupport,\n\t\tisMatchingSearchTerm,\n\t\tnumberOfHiddenBlocks,\n\t};\n} )( BlockManager );\n"]}
|
|
@@ -7,7 +7,7 @@ import { useViewportMatch } from '@wordpress/compose';
|
|
|
7
7
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
8
|
import { __, _x } from '@wordpress/i18n';
|
|
9
9
|
import { NavigableToolbar, ToolSelector, store as blockEditorStore } from '@wordpress/block-editor';
|
|
10
|
-
import {
|
|
10
|
+
import { EditorHistoryRedo, EditorHistoryUndo, store as editorStore } from '@wordpress/editor';
|
|
11
11
|
import { Button, ToolbarItem } from '@wordpress/components';
|
|
12
12
|
import { listView, plus } from '@wordpress/icons';
|
|
13
13
|
import { useRef, useCallback } from '@wordpress/element';
|
|
@@ -70,20 +70,14 @@ function HeaderToolbar() {
|
|
|
70
70
|
|
|
71
71
|
const toggleListView = useCallback(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
|
|
72
72
|
const overflowItems = createElement(Fragment, null, createElement(ToolbarItem, {
|
|
73
|
-
as: TableOfContents,
|
|
74
|
-
hasOutlineItemsDisabled: isTextModeEnabled,
|
|
75
|
-
repositionDropdown: showIconLabels && !isWideViewport,
|
|
76
|
-
showTooltip: !showIconLabels,
|
|
77
|
-
variant: showIconLabels ? 'tertiary' : undefined
|
|
78
|
-
}), createElement(ToolbarItem, {
|
|
79
73
|
as: Button,
|
|
80
|
-
className: "edit-post-header-
|
|
74
|
+
className: "edit-post-header-toolbar__document-overview-toggle",
|
|
81
75
|
icon: listView,
|
|
82
76
|
disabled: isTextModeEnabled,
|
|
83
77
|
isPressed: isListViewOpen
|
|
84
78
|
/* translators: button label text should, if possible, be under 16 characters. */
|
|
85
79
|
,
|
|
86
|
-
label: __('
|
|
80
|
+
label: __('Document Overview'),
|
|
87
81
|
onClick: toggleListView,
|
|
88
82
|
shortcut: listViewShortcut,
|
|
89
83
|
showTooltip: !showIconLabels,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.js"],"names":["useViewportMatch","useSelect","useDispatch","__","_x","NavigableToolbar","ToolSelector","store","blockEditorStore","TableOfContents","EditorHistoryRedo","EditorHistoryUndo","editorStore","Button","ToolbarItem","listView","plus","useRef","useCallback","keyboardShortcutsStore","editPostStore","preventDefault","event","HeaderToolbar","inserterButton","setIsInserterOpened","setIsListViewOpened","isInserterEnabled","isInserterOpened","isTextModeEnabled","showIconLabels","isListViewOpen","listViewShortcut","select","hasInserterItems","getBlockRootClientId","getBlockSelectionEnd","getEditorSettings","getEditorMode","isFeatureActive","isListViewOpened","getShortcutRepresentation","richEditingEnabled","isLargeViewport","isWideViewport","toolbarAriaLabel","toggleListView","overflowItems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AAGc,cAAc,GAAGuB,UAAH,GAAgBD,SAVvC;AAWC,IAAA,WAAW,EAAG,CAAEtB;AAXjB,IADD,EAcG,CAAEc,cAAc,IAAI,CAAEd,cAAtB,KACD,8BACGa,eAAe,IAChB,cAAC,WAAD;AACC,IAAA,EAAE,EAAGrC,YADN;AAEC,IAAA,WAAW,EAAG,CAAEwB,cAFjB;AAGC,IAAA,OAAO,EACNA,cAAc,GAAG,UAAH,GAAgBkB,SAJhC;AAMC,IAAA,QAAQ,EAAGnB;AANZ,IAFF,EAWC,cAAC,WAAD;AACC,IAAA,EAAE,EAAGlB,iBADN;AAEC,IAAA,WAAW,EAAG,CAAEmB,cAFjB;AAGC,IAAA,OAAO,EAAGA,cAAc,GAAG,UAAH,GAAgBkB;AAHzC,IAXD,EAgBC,cAAC,WAAD;AACC,IAAA,EAAE,EAAGtC,iBADN;AAEC,IAAA,WAAW,EAAG,CAAEoB,cAFjB;AAGC,IAAA,OAAO,EAAGA,cAAc,GAAG,UAAH,GAAgBkB;AAHzC,IAhBD,EAqBGD,aArBH,CAfF,CAJD,CADD;AA+CA;;AAED,eAAexB,aAAf","sourcesContent":["/**\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} from '@wordpress/block-editor';\nimport {\n\tTableOfContents,\n\tEditorHistoryRedo,\n\tEditorHistoryUndo,\n\tstore as editorStore,\n} from '@wordpress/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';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nfunction HeaderToolbar() {\n\tconst inserterButton = useRef();\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editPostStore );\n\tconst {\n\t\tisInserterEnabled,\n\t\tisInserterOpened,\n\t\tisTextModeEnabled,\n\t\tshowIconLabels,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t} = useSelect( ( select ) => {\n\t\tconst { hasInserterItems, getBlockRootClientId, getBlockSelectionEnd } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst { getEditorMode, isFeatureActive, isListViewOpened } =\n\t\t\tselect( editPostStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\n\t\treturn {\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tisInserterEnabled:\n\t\t\t\tgetEditorMode() === 'visual' &&\n\t\t\t\tgetEditorSettings().richEditingEnabled &&\n\t\t\t\thasInserterItems(\n\t\t\t\t\tgetBlockRootClientId( getBlockSelectionEnd() )\n\t\t\t\t),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisTextModeEnabled: getEditorMode() === 'text',\n\t\t\tshowIconLabels: isFeatureActive( 'showIconLabels' ),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/edit-post/toggle-list-view'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\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\tconst overflowItems = (\n\t\t<>\n\t\t\t<ToolbarItem\n\t\t\t\tas={ TableOfContents }\n\t\t\t\thasOutlineItemsDisabled={ isTextModeEnabled }\n\t\t\t\trepositionDropdown={ showIconLabels && ! isWideViewport }\n\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t/>\n\t\t\t<ToolbarItem\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-post-header-toolbar__list-view-toggle\"\n\t\t\t\ticon={ listView }\n\t\t\t\tdisabled={ isTextModeEnabled }\n\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\tonClick={ toggleListView }\n\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t/>\n\t\t</>\n\t);\n\tconst openInserter = useCallback( () => {\n\t\tif ( isInserterOpened ) {\n\t\t\t// Focusing the inserter button closes the inserter popover.\n\t\t\tinserterButton.current.focus();\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=\"edit-post-header-toolbar\"\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t>\n\t\t\t<div className=\"edit-post-header-toolbar__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=\"edit-post-header-toolbar__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={ openInserter }\n\t\t\t\t\tdisabled={ ! isInserterEnabled }\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/>\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && (\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={ isTextModeEnabled }\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/>\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/>\n\t\t\t\t\t\t{ overflowItems }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default HeaderToolbar;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.js"],"names":["useViewportMatch","useSelect","useDispatch","__","_x","NavigableToolbar","ToolSelector","store","blockEditorStore","EditorHistoryRedo","EditorHistoryUndo","editorStore","Button","ToolbarItem","listView","plus","useRef","useCallback","keyboardShortcutsStore","editPostStore","preventDefault","event","HeaderToolbar","inserterButton","setIsInserterOpened","setIsListViewOpened","isInserterEnabled","isInserterOpened","isTextModeEnabled","showIconLabels","isListViewOpen","listViewShortcut","select","hasInserterItems","getBlockRootClientId","getBlockSelectionEnd","getEditorSettings","getEditorMode","isFeatureActive","isListViewOpened","getShortcutRepresentation","richEditingEnabled","isLargeViewport","isWideViewport","toolbarAriaLabel","toggleListView","overflowItems","undefined","openInserter","current","focus","longLabel","shortLabel"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,gBAAT,QAAiC,oBAAjC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SACCC,gBADD,EAECC,YAFD,EAGCC,KAAK,IAAIC,gBAHV,QAIO,yBAJP;AAKA,SACCC,iBADD,EAECC,iBAFD,EAGCH,KAAK,IAAII,WAHV,QAIO,mBAJP;AAKA,SAASC,MAAT,EAAiBC,WAAjB,QAAoC,uBAApC;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA+B,kBAA/B;AACA,SAASC,MAAT,EAAiBC,WAAjB,QAAoC,oBAApC;AACA,SAASV,KAAK,IAAIW,sBAAlB,QAAgD,+BAAhD;AAEA;AACA;AACA;;AACA,SAASX,KAAK,IAAIY,aAAlB,QAAuC,gBAAvC;;AAEA,MAAMC,cAAc,GAAKC,KAAF,IAAa;AACnCA,EAAAA,KAAK,CAACD,cAAN;AACA,CAFD;;AAIA,SAASE,aAAT,GAAyB;AACxB,QAAMC,cAAc,GAAGP,MAAM,EAA7B;AACA,QAAM;AAAEQ,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MACLvB,WAAW,CAAEiB,aAAF,CADZ;AAEA,QAAM;AACLO,IAAAA,iBADK;AAELC,IAAAA,gBAFK;AAGLC,IAAAA,iBAHK;AAILC,IAAAA,cAJK;AAKLC,IAAAA,cALK;AAMLC,IAAAA;AANK,MAOF9B,SAAS,CAAI+B,MAAF,IAAc;AAC5B,UAAM;AAAEC,MAAAA,gBAAF;AAAoBC,MAAAA,oBAApB;AAA0CC,MAAAA;AAA1C,QAC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,CAAEc,cAAc,IAAI,CAAEd,cAAtB,KACD,8BACGa,eAAe,IAChB,cAAC,WAAD;AACC,IAAA,EAAE,EAAGpC,YADN;AAEC,IAAA,WAAW,EAAG,CAAEuB,cAFjB;AAGC,IAAA,OAAO,EACNA,cAAc,GAAG,UAAH,GAAgBkB,SAJhC;AAMC,IAAA,QAAQ,EAAGnB;AANZ,IAFF,EAWC,cAAC,WAAD;AACC,IAAA,EAAE,EAAGlB,iBADN;AAEC,IAAA,WAAW,EAAG,CAAEmB,cAFjB;AAGC,IAAA,OAAO,EAAGA,cAAc,GAAG,UAAH,GAAgBkB;AAHzC,IAXD,EAgBC,cAAC,WAAD;AACC,IAAA,EAAE,EAAGtC,iBADN;AAEC,IAAA,WAAW,EAAG,CAAEoB,cAFjB;AAGC,IAAA,OAAO,EAAGA,cAAc,GAAG,UAAH,GAAgBkB;AAHzC,IAhBD,EAqBGD,aArBH,CAfF,CAJD,CADD;AA+CA;;AAED,eAAexB,aAAf","sourcesContent":["/**\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} from '@wordpress/block-editor';\nimport {\n\tEditorHistoryRedo,\n\tEditorHistoryUndo,\n\tstore as editorStore,\n} from '@wordpress/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';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nfunction HeaderToolbar() {\n\tconst inserterButton = useRef();\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editPostStore );\n\tconst {\n\t\tisInserterEnabled,\n\t\tisInserterOpened,\n\t\tisTextModeEnabled,\n\t\tshowIconLabels,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t} = useSelect( ( select ) => {\n\t\tconst { hasInserterItems, getBlockRootClientId, getBlockSelectionEnd } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst { getEditorMode, isFeatureActive, isListViewOpened } =\n\t\t\tselect( editPostStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\n\t\treturn {\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tisInserterEnabled:\n\t\t\t\tgetEditorMode() === 'visual' &&\n\t\t\t\tgetEditorSettings().richEditingEnabled &&\n\t\t\t\thasInserterItems(\n\t\t\t\t\tgetBlockRootClientId( getBlockSelectionEnd() )\n\t\t\t\t),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisTextModeEnabled: getEditorMode() === 'text',\n\t\t\tshowIconLabels: isFeatureActive( 'showIconLabels' ),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/edit-post/toggle-list-view'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\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\tconst overflowItems = (\n\t\t<>\n\t\t\t<ToolbarItem\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-post-header-toolbar__document-overview-toggle\"\n\t\t\t\ticon={ listView }\n\t\t\t\tdisabled={ isTextModeEnabled }\n\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\tlabel={ __( 'Document Overview' ) }\n\t\t\t\tonClick={ toggleListView }\n\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t/>\n\t\t</>\n\t);\n\tconst openInserter = useCallback( () => {\n\t\tif ( isInserterOpened ) {\n\t\t\t// Focusing the inserter button closes the inserter popover.\n\t\t\tinserterButton.current.focus();\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=\"edit-post-header-toolbar\"\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t>\n\t\t\t<div className=\"edit-post-header-toolbar__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=\"edit-post-header-toolbar__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={ openInserter }\n\t\t\t\t\tdisabled={ ! isInserterEnabled }\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/>\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && (\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={ isTextModeEnabled }\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/>\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/>\n\t\t\t\t\t\t{ overflowItems }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default HeaderToolbar;\n"]}
|
|
@@ -28,19 +28,20 @@ import TemplateTitle from './template-title';
|
|
|
28
28
|
|
|
29
29
|
function Header(_ref) {
|
|
30
30
|
let {
|
|
31
|
-
setEntitiesSavedStatesCallback
|
|
32
|
-
isDistractionFree
|
|
31
|
+
setEntitiesSavedStatesCallback
|
|
33
32
|
} = _ref;
|
|
34
33
|
const {
|
|
35
34
|
hasActiveMetaboxes,
|
|
36
35
|
isPublishSidebarOpened,
|
|
37
36
|
isSaving,
|
|
38
|
-
showIconLabels
|
|
37
|
+
showIconLabels,
|
|
38
|
+
isDistractionFree
|
|
39
39
|
} = useSelect(select => ({
|
|
40
40
|
hasActiveMetaboxes: select(editPostStore).hasMetaBoxes(),
|
|
41
41
|
isPublishSidebarOpened: select(editPostStore).isPublishSidebarOpened(),
|
|
42
42
|
isSaving: select(editPostStore).isSavingMetaBoxes(),
|
|
43
|
-
showIconLabels: select(editPostStore).isFeatureActive('showIconLabels')
|
|
43
|
+
showIconLabels: select(editPostStore).isFeatureActive('showIconLabels'),
|
|
44
|
+
isDistractionFree: select(editPostStore).isFeatureActive('distractionFree')
|
|
44
45
|
}), []);
|
|
45
46
|
const isLargeViewport = useViewportMatch('large');
|
|
46
47
|
const classes = classnames('edit-post-header');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/index.js"],"names":["classnames","PostSavedState","PostPreviewButton","useSelect","PinnedItems","useViewportMatch","__unstableMotion","motion","FullscreenModeClose","HeaderToolbar","MoreMenu","PostPublishButtonOrToggle","default","DevicePreview","MainDashboardButton","store","editPostStore","TemplateTitle","Header","setEntitiesSavedStatesCallback","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/index.js"],"names":["classnames","PostSavedState","PostPreviewButton","useSelect","PinnedItems","useViewportMatch","__unstableMotion","motion","FullscreenModeClose","HeaderToolbar","MoreMenu","PostPublishButtonOrToggle","default","DevicePreview","MainDashboardButton","store","editPostStore","TemplateTitle","Header","setEntitiesSavedStatesCallback","hasActiveMetaboxes","isPublishSidebarOpened","isSaving","showIconLabels","isDistractionFree","select","hasMetaBoxes","isSavingMetaBoxes","isFeatureActive","isLargeViewport","classes","slideY","hidden","y","hover","transition","type","delay","slideX","x","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,cAAT,EAAyBC,iBAAzB,QAAkD,mBAAlD;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,WAAT,QAA4B,sBAA5B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,gBAAgB,IAAIC,MAA7B,QAA2C,uBAA3C;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AACA,OAAOC,QAAP,MAAqB,aAArB;AACA,OAAOC,yBAAP,MAAsC,iCAAtC;AACA,SAASC,OAAO,IAAIC,aAApB,QAA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AD;AACC,IAAA,mBAAmB,EAAGH,kBADvB;AAEC,IAAA,gBAAgB,EAAGE,QAAQ,GAAG,IAAH,GAAUkB;AAFtC,IAlBD,EAsBC,cAAC,yBAAD;AACC,IAAA,YAAY,EAAGpB,kBADhB;AAEC,IAAA,aAAa,EAAGE,QAFjB;AAGC,IAAA,8BAA8B,EAC7BH;AAJF,IAtBD,EA6BG,CAAEU,eAAe,IAAI,CAAEN,cAAvB,KACD,8BACC,cAAC,WAAD,CAAa,IAAb;AAAkB,IAAA,KAAK,EAAC;AAAxB,IADD,EAEC,cAAC,QAAD;AAAU,IAAA,cAAc,EAAGA;AAA3B,IAFD,CA9BF,EAmCGA,cAAc,IAAI,CAAEM,eAApB,IACD,cAAC,QAAD;AAAU,IAAA,cAAc,EAAGN;AAA3B,IApCF,CAjBD,CADD;AA2DA;;AAED,eAAeL,MAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { PostSavedState, PostPreviewButton } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport FullscreenModeClose from './fullscreen-mode-close';\nimport HeaderToolbar from './header-toolbar';\nimport MoreMenu from './more-menu';\nimport PostPublishButtonOrToggle from './post-publish-button-or-toggle';\nimport { default as DevicePreview } from '../device-preview';\nimport MainDashboardButton from './main-dashboard-button';\nimport { store as editPostStore } from '../../store';\nimport TemplateTitle from './template-title';\n\nfunction Header( { setEntitiesSavedStatesCallback } ) {\n\tconst {\n\t\thasActiveMetaboxes,\n\t\tisPublishSidebarOpened,\n\t\tisSaving,\n\t\tshowIconLabels,\n\t\tisDistractionFree,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\tisPublishSidebarOpened:\n\t\t\t\tselect( editPostStore ).isPublishSidebarOpened(),\n\t\t\tisSaving: select( editPostStore ).isSavingMetaBoxes(),\n\t\t\tshowIconLabels:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'showIconLabels' ),\n\t\t\tisDistractionFree:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'distractionFree' ),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\n\tconst classes = classnames( 'edit-post-header' );\n\n\tconst slideY = {\n\t\thidden: isDistractionFree ? { y: '-50' } : { y: 0 },\n\t\thover: { y: 0, transition: { type: 'tween', delay: 0.2 } },\n\t};\n\n\tconst slideX = {\n\t\thidden: isDistractionFree ? { x: '-100%' } : { x: 0 },\n\t\thover: { x: 0, transition: { type: 'tween', delay: 0.2 } },\n\t};\n\n\treturn (\n\t\t<div className={ classes }>\n\t\t\t<MainDashboardButton.Slot>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ slideX }\n\t\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\t>\n\t\t\t\t\t<FullscreenModeClose showTooltip />\n\t\t\t\t</motion.div>\n\t\t\t</MainDashboardButton.Slot>\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"edit-post-header__toolbar\"\n\t\t\t>\n\t\t\t\t<HeaderToolbar />\n\t\t\t\t<TemplateTitle />\n\t\t\t</motion.div>\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"edit-post-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! isPublishSidebarOpened && (\n\t\t\t\t\t// This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t// We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t// We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t// when the publish sidebar has been closed.\n\t\t\t\t\t<PostSavedState\n\t\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\t\t\t\tforceIsSaving={ isSaving }\n\t\t\t\t\t\tshowIconLabels={ showIconLabels }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<DevicePreview />\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tforceIsAutosaveable={ hasActiveMetaboxes }\n\t\t\t\t\tforcePreviewLink={ isSaving ? null : undefined }\n\t\t\t\t/>\n\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\t\t\tforceIsSaving={ isSaving }\n\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ ( isLargeViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-post\" />\n\t\t\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ showIconLabels && ! isLargeViewport && (\n\t\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"]}
|
|
@@ -35,9 +35,7 @@ const MoreMenu = _ref => {
|
|
|
35
35
|
return createElement(Fragment, null, showIconLabels && !isLargeViewport && createElement(PinnedItems.Slot, {
|
|
36
36
|
className: showIconLabels && 'show-icon-labels',
|
|
37
37
|
scope: "core/edit-post"
|
|
38
|
-
}), createElement(WritingMenu, {
|
|
39
|
-
onClose: onClose
|
|
40
|
-
}), createElement(ModeSwitcher, null), createElement(ActionItem.Slot, {
|
|
38
|
+
}), createElement(WritingMenu, null), createElement(ModeSwitcher, null), createElement(ActionItem.Slot, {
|
|
41
39
|
name: "core/edit-post/plugin-more-menu",
|
|
42
40
|
label: __('Plugins'),
|
|
43
41
|
as: MenuGroup,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/more-menu/index.js"],"names":["__","MenuGroup","ActionItem","MoreMenuDropdown","PinnedItems","useViewportMatch","ModeSwitcher","PreferencesMenuItem","ToolsMoreMenuGroup","WritingMenu","MoreMenu","showIconLabels","isLargeViewport","showTooltip","variant","onClose","onClick"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,uBAA1B;AACA,SACCC,UADD,EAECC,gBAFD,EAGCC,WAHD,QAIO,sBAJP;AAKA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,mBAAP,MAAgC,0BAAhC;AACA,OAAOC,kBAAP,MAA+B,0BAA/B;AACA,OAAOC,WAAP,MAAwB,iBAAxB;;AAEA,MAAMC,QAAQ,GAAG,QAA0B;AAAA,MAAxB;AAAEC,IAAAA;AAAF,GAAwB;AAC1C,QAAMC,eAAe,GAAGP,gBAAgB,CAAE,OAAF,CAAxC;AAEA,SACC,cAAC,gBAAD;AACC,IAAA,WAAW,EAAG;AACbQ,MAAAA,WAAW,EAAE,CAAEF,cADF;AAEb,UAAKA,cAAc,IAAI;AAAEG,QAAAA,OAAO,EAAE;AAAX,OAAvB;AAFa;AADf,KAMG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,8BACGJ,cAAc,IAAI,CAAEC,eAApB,IACD,cAAC,WAAD,CAAa,IAAb;AACC,MAAA,SAAS,EAAGD,cAAc,IAAI,kBAD/B;AAEC,MAAA,KAAK,EAAC;AAFP,MAFF,EAOC,cAAC,WAAD
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/more-menu/index.js"],"names":["__","MenuGroup","ActionItem","MoreMenuDropdown","PinnedItems","useViewportMatch","ModeSwitcher","PreferencesMenuItem","ToolsMoreMenuGroup","WritingMenu","MoreMenu","showIconLabels","isLargeViewport","showTooltip","variant","onClose","onClick"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,uBAA1B;AACA,SACCC,UADD,EAECC,gBAFD,EAGCC,WAHD,QAIO,sBAJP;AAKA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,mBAAP,MAAgC,0BAAhC;AACA,OAAOC,kBAAP,MAA+B,0BAA/B;AACA,OAAOC,WAAP,MAAwB,iBAAxB;;AAEA,MAAMC,QAAQ,GAAG,QAA0B;AAAA,MAAxB;AAAEC,IAAAA;AAAF,GAAwB;AAC1C,QAAMC,eAAe,GAAGP,gBAAgB,CAAE,OAAF,CAAxC;AAEA,SACC,cAAC,gBAAD;AACC,IAAA,WAAW,EAAG;AACbQ,MAAAA,WAAW,EAAE,CAAEF,cADF;AAEb,UAAKA,cAAc,IAAI;AAAEG,QAAAA,OAAO,EAAE;AAAX,OAAvB;AAFa;AADf,KAMG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,8BACGJ,cAAc,IAAI,CAAEC,eAApB,IACD,cAAC,WAAD,CAAa,IAAb;AACC,MAAA,SAAS,EAAGD,cAAc,IAAI,kBAD/B;AAEC,MAAA,KAAK,EAAC;AAFP,MAFF,EAOC,cAAC,WAAD,OAPD,EAQC,cAAC,YAAD,OARD,EASC,cAAC,UAAD,CAAY,IAAZ;AACC,MAAA,IAAI,EAAC,iCADN;AAEC,MAAA,KAAK,EAAGX,EAAE,CAAE,SAAF,CAFX;AAGC,MAAA,EAAE,EAAGC,SAHN;AAIC,MAAA,SAAS,EAAG;AAAEe,QAAAA,OAAO,EAAED;AAAX;AAJb,MATD,EAeC,cAAC,kBAAD,CAAoB,IAApB;AAAyB,MAAA,SAAS,EAAG;AAAEA,QAAAA;AAAF;AAArC,MAfD,EAgBC,cAAC,SAAD,QACC,cAAC,mBAAD,OADD,CAhBD,CADC;AAAA,GANH,CADD;AA+BA,CAlCD;;AAoCA,eAAeL,QAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuGroup } from '@wordpress/components';\nimport {\n\tActionItem,\n\tMoreMenuDropdown,\n\tPinnedItems,\n} from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport ModeSwitcher from '../mode-switcher';\nimport PreferencesMenuItem from '../preferences-menu-item';\nimport ToolsMoreMenuGroup from '../tools-more-menu-group';\nimport WritingMenu from '../writing-menu';\n\nconst MoreMenu = ( { showIconLabels } ) => {\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\n\treturn (\n\t\t<MoreMenuDropdown\n\t\t\ttoggleProps={ {\n\t\t\t\tshowTooltip: ! showIconLabels,\n\t\t\t\t...( showIconLabels && { variant: 'tertiary' } ),\n\t\t\t} }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t{ showIconLabels && ! isLargeViewport && (\n\t\t\t\t\t\t<PinnedItems.Slot\n\t\t\t\t\t\t\tclassName={ showIconLabels && 'show-icon-labels' }\n\t\t\t\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<WritingMenu />\n\t\t\t\t\t<ModeSwitcher />\n\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\tname=\"core/edit-post/plugin-more-menu\"\n\t\t\t\t\t\tlabel={ __( 'Plugins' ) }\n\t\t\t\t\t\tas={ MenuGroup }\n\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsMoreMenuGroup.Slot fillProps={ { onClose } } />\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<PreferencesMenuItem />\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</MoreMenuDropdown>\n\t);\n};\n\nexport default MoreMenu;\n"]}
|
|
@@ -3,7 +3,7 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
+
import { useSelect, useDispatch, useRegistry } from '@wordpress/data';
|
|
7
7
|
import { MenuGroup } from '@wordpress/components';
|
|
8
8
|
import { __, _x } from '@wordpress/i18n';
|
|
9
9
|
import { useViewportMatch } from '@wordpress/compose';
|
|
@@ -16,10 +16,8 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
|
16
16
|
|
|
17
17
|
import { store as postEditorStore } from '../../../store';
|
|
18
18
|
|
|
19
|
-
function WritingMenu(
|
|
20
|
-
|
|
21
|
-
onClose
|
|
22
|
-
} = _ref;
|
|
19
|
+
function WritingMenu() {
|
|
20
|
+
const registry = useRegistry();
|
|
23
21
|
const isDistractionFree = useSelect(select => select(blockEditorStore).getSettings().isDistractionFree, []);
|
|
24
22
|
const blocks = useSelect(select => select(blockEditorStore).getBlocks(), []);
|
|
25
23
|
const {
|
|
@@ -35,15 +33,16 @@ function WritingMenu(_ref) {
|
|
|
35
33
|
} = useDispatch(blockEditorStore);
|
|
36
34
|
|
|
37
35
|
const toggleDistractionFree = () => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
registry.batch(() => {
|
|
37
|
+
setPreference('core/edit-post', 'fixedToolbar', false);
|
|
38
|
+
setIsInserterOpened(false);
|
|
39
|
+
setIsListViewOpened(false);
|
|
40
|
+
closeGeneralSidebar();
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
if (!isDistractionFree && !!blocks.length) {
|
|
43
|
+
selectBlock(blocks[0].clientId);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
47
46
|
};
|
|
48
47
|
|
|
49
48
|
const isLargeViewport = useViewportMatch('medium');
|
|
@@ -80,7 +79,7 @@ function WritingMenu(_ref) {
|
|
|
80
79
|
}), createElement(PreferenceToggleMenuItem, {
|
|
81
80
|
scope: "core/edit-post",
|
|
82
81
|
name: "distractionFree",
|
|
83
|
-
|
|
82
|
+
onToggle: toggleDistractionFree,
|
|
84
83
|
label: __('Distraction free'),
|
|
85
84
|
info: __('Write with calmness'),
|
|
86
85
|
messageActivated: __('Distraction free mode activated'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/writing-menu/index.js"],"names":["useSelect","useDispatch","MenuGroup","__","_x","useViewportMatch","displayShortcut","PreferenceToggleMenuItem","store","preferencesStore","blockEditorStore","postEditorStore","WritingMenu","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/writing-menu/index.js"],"names":["useSelect","useDispatch","useRegistry","MenuGroup","__","_x","useViewportMatch","displayShortcut","PreferenceToggleMenuItem","store","preferencesStore","blockEditorStore","postEditorStore","WritingMenu","registry","isDistractionFree","select","getSettings","blocks","getBlocks","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","set","setPreference","selectBlock","toggleDistractionFree","batch","length","clientId","isLargeViewport","secondary","primaryShift"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,EAAiCC,WAAjC,QAAoD,iBAApD;AACA,SAASC,SAAT,QAA0B,uBAA1B;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,eAAT,QAAgC,qBAAhC;AACA,SACCC,wBADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,wBAHP;AAIA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,yBAA1C;AAEA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AAMC,IAAA,gBAAgB,EAAGA,EAAE,CAAE,iCAAF,CANtB;AAOC,IAAA,kBAAkB,EAAGA,EAAE,CAAE,mCAAF,CAPxB;AAQC,IAAA,QAAQ,EAAGG,eAAe,CAACyB,YAAhB,CAA8B,IAA9B;AARZ,IA7BD,CADD;AA0CA;;AAED,eAAenB,WAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch, useRegistry } from '@wordpress/data';\nimport { MenuGroup } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport {\n\tPreferenceToggleMenuItem,\n\tstore as preferencesStore,\n} from '@wordpress/preferences';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as postEditorStore } from '../../../store';\n\nfunction WritingMenu() {\n\tconst registry = useRegistry();\n\tconst isDistractionFree = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().isDistractionFree,\n\t\t[]\n\t);\n\n\tconst blocks = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlocks(),\n\t\t[]\n\t);\n\n\tconst { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } =\n\t\tuseDispatch( postEditorStore );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst toggleDistractionFree = () => {\n\t\tregistry.batch( () => {\n\t\t\tsetPreference( 'core/edit-post', 'fixedToolbar', false );\n\t\t\tsetIsInserterOpened( false );\n\t\t\tsetIsListViewOpened( false );\n\t\t\tcloseGeneralSidebar();\n\t\t\tif ( ! isDistractionFree && !! blocks.length ) {\n\t\t\t\tselectBlock( blocks[ 0 ].clientId );\n\t\t\t}\n\t\t} );\n\t};\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tif ( ! isLargeViewport ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t<PreferenceToggleMenuItem\n\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\tdisabled={ isDistractionFree }\n\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\tinfo={ __(\n\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t) }\n\t\t\t\tmessageActivated={ __( 'Top toolbar activated' ) }\n\t\t\t\tmessageDeactivated={ __( 'Top toolbar deactivated' ) }\n\t\t\t/>\n\t\t\t<PreferenceToggleMenuItem\n\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\tname=\"focusMode\"\n\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\tinfo={ __( 'Focus on one block at a time' ) }\n\t\t\t\tmessageActivated={ __( 'Spotlight mode activated' ) }\n\t\t\t\tmessageDeactivated={ __( 'Spotlight mode deactivated' ) }\n\t\t\t/>\n\t\t\t<PreferenceToggleMenuItem\n\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\tname=\"fullscreenMode\"\n\t\t\t\tlabel={ __( 'Fullscreen mode' ) }\n\t\t\t\tinfo={ __( 'Show and hide admin UI' ) }\n\t\t\t\tmessageActivated={ __( 'Fullscreen mode activated' ) }\n\t\t\t\tmessageDeactivated={ __( 'Fullscreen mode deactivated' ) }\n\t\t\t\tshortcut={ displayShortcut.secondary( 'f' ) }\n\t\t\t/>\n\t\t\t<PreferenceToggleMenuItem\n\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\tname=\"distractionFree\"\n\t\t\t\tonToggle={ toggleDistractionFree }\n\t\t\t\tlabel={ __( 'Distraction free' ) }\n\t\t\t\tinfo={ __( 'Write with calmness' ) }\n\t\t\t\tmessageActivated={ __( 'Distraction free mode activated' ) }\n\t\t\t\tmessageDeactivated={ __( 'Distraction free mode deactivated' ) }\n\t\t\t\tshortcut={ displayShortcut.primaryShift( '\\\\' ) }\n\t\t\t/>\n\t\t</MenuGroup>\n\t);\n}\n\nexport default WritingMenu;\n"]}
|
|
@@ -49,5 +49,17 @@ export const textFormattingShortcuts = [{
|
|
|
49
49
|
character: 'x'
|
|
50
50
|
},
|
|
51
51
|
description: __('Make the selected text inline code.')
|
|
52
|
+
}, {
|
|
53
|
+
keyCombination: {
|
|
54
|
+
modifier: 'access',
|
|
55
|
+
character: '0'
|
|
56
|
+
},
|
|
57
|
+
description: __('Convert the current heading to a paragraph.')
|
|
58
|
+
}, {
|
|
59
|
+
keyCombination: {
|
|
60
|
+
modifier: 'access',
|
|
61
|
+
character: '1-6'
|
|
62
|
+
},
|
|
63
|
+
description: __('Convert the current paragraph or heading to a heading of level 1 to 6.')
|
|
52
64
|
}];
|
|
53
65
|
//# sourceMappingURL=config.js.map
|