@wordpress/edit-post 7.29.0 → 7.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +1 -58
- package/build/components/editor-initialization/index.js +3 -6
- package/build/components/editor-initialization/index.js.map +1 -1
- package/build/components/editor-initialization/listener-hooks.js +6 -10
- package/build/components/editor-initialization/listener-hooks.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.js +18 -11
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +10 -2
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/init-pattern-modal/index.js +99 -0
- package/build/components/init-pattern-modal/index.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/config.js +6 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/layout/index.js +2 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +3 -1
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +1 -2
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/editor.js +1 -15
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +2 -2
- package/build/editor.native.js.map +1 -1
- package/build/index.js +1 -2
- package/build/index.js.map +1 -1
- package/build/store/selectors.js +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/editor-initialization/index.js +3 -6
- package/build-module/components/editor-initialization/index.js.map +1 -1
- package/build-module/components/editor-initialization/listener-hooks.js +6 -10
- package/build-module/components/editor-initialization/listener-hooks.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/index.js +19 -12
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +12 -4
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/init-pattern-modal/index.js +93 -0
- package/build-module/components/init-pattern-modal/index.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js +6 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/layout/index.js +3 -2
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +4 -2
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +2 -3
- package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build-module/editor.js +1 -15
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +3 -3
- package/build-module/editor.native.js.map +1 -1
- package/build-module/index.js +2 -2
- package/build-module/index.js.map +1 -1
- package/build-module/store/selectors.js +1 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/classic-rtl.css +1 -0
- package/build-style/classic.css +1 -0
- package/build-style/style-rtl.css +5 -32
- package/build-style/style.css +5 -32
- package/package.json +32 -32
- package/src/components/editor-initialization/index.js +3 -4
- package/src/components/editor-initialization/listener-hooks.js +20 -22
- package/src/components/editor-initialization/test/listener-hooks.js +8 -8
- package/src/components/header/header-toolbar/index.native.js +1 -1
- package/src/components/header/index.js +31 -28
- package/src/components/header/more-menu/index.js +13 -9
- package/src/components/header/style.scss +4 -0
- package/src/components/header/test/index.js +4 -14
- package/src/components/init-pattern-modal/index.js +117 -0
- package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/src/components/layout/index.js +2 -2
- package/src/components/sidebar/plugin-post-publish-panel/test/index.js +1 -1
- package/src/components/sidebar/post-status/index.js +2 -0
- package/src/components/sidebar/settings-sidebar/index.js +1 -3
- package/src/editor.js +1 -12
- package/src/editor.native.js +8 -2
- package/src/index.js +2 -1
- package/src/store/selectors.js +1 -1
- package/build/components/sidebar/plugin-document-setting-panel/index.js +0 -126
- package/build/components/sidebar/plugin-document-setting-panel/index.js.map +0 -1
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js +0 -118
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +0 -1
- package/src/components/sidebar/plugin-document-setting-panel/index.js +0 -125
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -99,64 +99,7 @@ _Returns_
|
|
|
99
99
|
|
|
100
100
|
### PluginDocumentSettingPanel
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
_Usage_
|
|
105
|
-
|
|
106
|
-
```js
|
|
107
|
-
// Using ES5 syntax
|
|
108
|
-
var el = React.createElement;
|
|
109
|
-
var __ = wp.i18n.__;
|
|
110
|
-
var registerPlugin = wp.plugins.registerPlugin;
|
|
111
|
-
var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel;
|
|
112
|
-
|
|
113
|
-
function MyDocumentSettingPlugin() {
|
|
114
|
-
return el(
|
|
115
|
-
PluginDocumentSettingPanel,
|
|
116
|
-
{
|
|
117
|
-
className: 'my-document-setting-plugin',
|
|
118
|
-
title: 'My Panel',
|
|
119
|
-
name: 'my-panel',
|
|
120
|
-
},
|
|
121
|
-
__( 'My Document Setting Panel' )
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
registerPlugin( 'my-document-setting-plugin', {
|
|
126
|
-
render: MyDocumentSettingPlugin,
|
|
127
|
-
} );
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
```jsx
|
|
131
|
-
// Using ESNext syntax
|
|
132
|
-
import { registerPlugin } from '@wordpress/plugins';
|
|
133
|
-
import { PluginDocumentSettingPanel } from '@wordpress/edit-post';
|
|
134
|
-
|
|
135
|
-
const MyDocumentSettingTest = () => (
|
|
136
|
-
<PluginDocumentSettingPanel
|
|
137
|
-
className="my-document-setting-plugin"
|
|
138
|
-
title="My Panel"
|
|
139
|
-
name="my-panel"
|
|
140
|
-
>
|
|
141
|
-
<p>My Document Setting Panel</p>
|
|
142
|
-
</PluginDocumentSettingPanel>
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
_Parameters_
|
|
149
|
-
|
|
150
|
-
- _props_ `Object`: Component properties.
|
|
151
|
-
- _props.name_ `string`: Required. A machine-friendly name for the panel.
|
|
152
|
-
- _props.className_ `[string]`: An optional class name added to the row.
|
|
153
|
-
- _props.title_ `[string]`: The title of the panel
|
|
154
|
-
- _props.icon_ `[WPBlockTypeIconRender]`: The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
|
|
155
|
-
- _props.children_ `Element`: Children to be rendered
|
|
156
|
-
|
|
157
|
-
_Returns_
|
|
158
|
-
|
|
159
|
-
- `Component`: The component to be rendered.
|
|
102
|
+
Undocumented declaration.
|
|
160
103
|
|
|
161
104
|
### PluginMoreMenuItem
|
|
162
105
|
|
|
@@ -13,14 +13,11 @@ var _listenerHooks = require("./listener-hooks");
|
|
|
13
13
|
* Data component used for initializing the editor and re-initializes
|
|
14
14
|
* when postId changes or on unmount.
|
|
15
15
|
*
|
|
16
|
-
* @param {number} postId The id of the post.
|
|
17
16
|
* @return {null} This is a data component so does not render any ui.
|
|
18
17
|
*/
|
|
19
|
-
function EditorInitialization({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
(0, _listenerHooks.useBlockSelectionListener)(postId);
|
|
23
|
-
(0, _listenerHooks.useUpdatePostLinkListener)(postId);
|
|
18
|
+
function EditorInitialization() {
|
|
19
|
+
(0, _listenerHooks.useBlockSelectionListener)();
|
|
20
|
+
(0, _listenerHooks.useUpdatePostLinkListener)();
|
|
24
21
|
return null;
|
|
25
22
|
}
|
|
26
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_listenerHooks","require","EditorInitialization","
|
|
1
|
+
{"version":3,"names":["_listenerHooks","require","EditorInitialization","useBlockSelectionListener","useUpdatePostLinkListener"],"sources":["@wordpress/edit-post/src/components/editor-initialization/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tuseBlockSelectionListener,\n\tuseUpdatePostLinkListener,\n} from './listener-hooks';\n\n/**\n * Data component used for initializing the editor and re-initializes\n * when postId changes or on unmount.\n *\n * @return {null} This is a data component so does not render any ui.\n */\nexport default function EditorInitialization() {\n\tuseBlockSelectionListener();\n\tuseUpdatePostLinkListener();\n\treturn null;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,cAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,IAAAC,wCAAyB,EAAC,CAAC;EAC3B,IAAAC,wCAAyB,EAAC,CAAC;EAC3B,OAAO,IAAI;AACZ"}
|
|
@@ -21,10 +21,8 @@ var _constants = require("../../store/constants");
|
|
|
21
21
|
/**
|
|
22
22
|
* This listener hook monitors for block selection and triggers the appropriate
|
|
23
23
|
* sidebar state.
|
|
24
|
-
*
|
|
25
|
-
* @param {number} postId The current post id.
|
|
26
24
|
*/
|
|
27
|
-
const useBlockSelectionListener =
|
|
25
|
+
const useBlockSelectionListener = () => {
|
|
28
26
|
const {
|
|
29
27
|
hasBlockSelection,
|
|
30
28
|
isEditorSidebarOpened,
|
|
@@ -38,7 +36,7 @@ const useBlockSelectionListener = postId => {
|
|
|
38
36
|
isEditorSidebarOpened: select(_constants.STORE_NAME).isEditorSidebarOpened(),
|
|
39
37
|
isDistractionFree: get('core', 'distractionFree')
|
|
40
38
|
};
|
|
41
|
-
}, [
|
|
39
|
+
}, []);
|
|
42
40
|
const {
|
|
43
41
|
openGeneralSidebar
|
|
44
42
|
} = (0, _data.useDispatch)(_constants.STORE_NAME);
|
|
@@ -51,26 +49,24 @@ const useBlockSelectionListener = postId => {
|
|
|
51
49
|
} else {
|
|
52
50
|
openGeneralSidebar('edit-post/document');
|
|
53
51
|
}
|
|
54
|
-
}, [hasBlockSelection, isEditorSidebarOpened]);
|
|
52
|
+
}, [hasBlockSelection, isDistractionFree, isEditorSidebarOpened, openGeneralSidebar]);
|
|
55
53
|
};
|
|
56
54
|
|
|
57
55
|
/**
|
|
58
56
|
* This listener hook monitors any change in permalink and updates the view
|
|
59
57
|
* post link in the admin bar.
|
|
60
|
-
*
|
|
61
|
-
* @param {number} postId
|
|
62
58
|
*/
|
|
63
59
|
exports.useBlockSelectionListener = useBlockSelectionListener;
|
|
64
|
-
const useUpdatePostLinkListener =
|
|
60
|
+
const useUpdatePostLinkListener = () => {
|
|
65
61
|
const {
|
|
66
62
|
newPermalink
|
|
67
63
|
} = (0, _data.useSelect)(select => ({
|
|
68
64
|
newPermalink: select(_editor.store).getCurrentPost().link
|
|
69
|
-
}), [
|
|
65
|
+
}), []);
|
|
70
66
|
const nodeToUpdate = (0, _element.useRef)();
|
|
71
67
|
(0, _element.useEffect)(() => {
|
|
72
68
|
nodeToUpdate.current = document.querySelector(_constants.VIEW_AS_PREVIEW_LINK_SELECTOR) || document.querySelector(_constants.VIEW_AS_LINK_SELECTOR);
|
|
73
|
-
}, [
|
|
69
|
+
}, []);
|
|
74
70
|
(0, _element.useEffect)(() => {
|
|
75
71
|
if (!newPermalink || !nodeToUpdate.current) {
|
|
76
72
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_element","_blockEditor","_editor","_preferences","_constants","useBlockSelectionListener","
|
|
1
|
+
{"version":3,"names":["_data","require","_element","_blockEditor","_editor","_preferences","_constants","useBlockSelectionListener","hasBlockSelection","isEditorSidebarOpened","isDistractionFree","useSelect","select","get","preferencesStore","blockEditorStore","getBlockSelectionStart","STORE_NAME","openGeneralSidebar","useDispatch","useEffect","exports","useUpdatePostLinkListener","newPermalink","editorStore","getCurrentPost","link","nodeToUpdate","useRef","current","document","querySelector","VIEW_AS_PREVIEW_LINK_SELECTOR","VIEW_AS_LINK_SELECTOR","setAttribute"],"sources":["@wordpress/edit-post/src/components/editor-initialization/listener-hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport {\n\tSTORE_NAME,\n\tVIEW_AS_LINK_SELECTOR,\n\tVIEW_AS_PREVIEW_LINK_SELECTOR,\n} from '../../store/constants';\n\n/**\n * This listener hook monitors for block selection and triggers the appropriate\n * sidebar state.\n */\nexport const useBlockSelectionListener = () => {\n\tconst { hasBlockSelection, isEditorSidebarOpened, isDistractionFree } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\treturn {\n\t\t\t\thasBlockSelection:\n\t\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\t\tisEditorSidebarOpened:\n\t\t\t\t\tselect( STORE_NAME ).isEditorSidebarOpened(),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t};\n\t\t}, [] );\n\n\tconst { openGeneralSidebar } = useDispatch( STORE_NAME );\n\n\tuseEffect( () => {\n\t\tif ( ! isEditorSidebarOpened || isDistractionFree ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( hasBlockSelection ) {\n\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t} else {\n\t\t\topenGeneralSidebar( 'edit-post/document' );\n\t\t}\n\t}, [\n\t\thasBlockSelection,\n\t\tisDistractionFree,\n\t\tisEditorSidebarOpened,\n\t\topenGeneralSidebar,\n\t] );\n};\n\n/**\n * This listener hook monitors any change in permalink and updates the view\n * post link in the admin bar.\n */\nexport const useUpdatePostLinkListener = () => {\n\tconst { newPermalink } = useSelect(\n\t\t( select ) => ( {\n\t\t\tnewPermalink: select( editorStore ).getCurrentPost().link,\n\t\t} ),\n\t\t[]\n\t);\n\tconst nodeToUpdate = useRef();\n\n\tuseEffect( () => {\n\t\tnodeToUpdate.current =\n\t\t\tdocument.querySelector( VIEW_AS_PREVIEW_LINK_SELECTOR ) ||\n\t\t\tdocument.querySelector( VIEW_AS_LINK_SELECTOR );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( ! newPermalink || ! nodeToUpdate.current ) {\n\t\t\treturn;\n\t\t}\n\t\tnodeToUpdate.current.setAttribute( 'href', newPermalink );\n\t}, [ newPermalink ] );\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,UAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACO,MAAMM,yBAAyB,GAAGA,CAAA,KAAM;EAC9C,MAAM;IAAEC,iBAAiB;IAAEC,qBAAqB;IAAEC;EAAkB,CAAC,GACpE,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACxB,MAAM;MAAEC;IAAI,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IAC1C,OAAO;MACNN,iBAAiB,EAChB,CAAC,CAAEI,MAAM,CAAEG,kBAAiB,CAAC,CAACC,sBAAsB,CAAC,CAAC;MACvDP,qBAAqB,EACpBG,MAAM,CAAEK,qBAAW,CAAC,CAACR,qBAAqB,CAAC,CAAC;MAC7CC,iBAAiB,EAAEG,GAAG,CAAE,MAAM,EAAE,iBAAkB;IACnD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAER,MAAM;IAAEK;EAAmB,CAAC,GAAG,IAAAC,iBAAW,EAAEF,qBAAW,CAAC;EAExD,IAAAG,kBAAS,EAAE,MAAM;IAChB,IAAK,CAAEX,qBAAqB,IAAIC,iBAAiB,EAAG;MACnD;IACD;IACA,IAAKF,iBAAiB,EAAG;MACxBU,kBAAkB,CAAE,iBAAkB,CAAC;IACxC,CAAC,MAAM;MACNA,kBAAkB,CAAE,oBAAqB,CAAC;IAC3C;EACD,CAAC,EAAE,CACFV,iBAAiB,EACjBE,iBAAiB,EACjBD,qBAAqB,EACrBS,kBAAkB,CACjB,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AAHAG,OAAA,CAAAd,yBAAA,GAAAA,yBAAA;AAIO,MAAMe,yBAAyB,GAAGA,CAAA,KAAM;EAC9C,MAAM;IAAEC;EAAa,CAAC,GAAG,IAAAZ,eAAS,EAC/BC,MAAM,KAAQ;IACfW,YAAY,EAAEX,MAAM,CAAEY,aAAY,CAAC,CAACC,cAAc,CAAC,CAAC,CAACC;EACtD,CAAC,CAAE,EACH,EACD,CAAC;EACD,MAAMC,YAAY,GAAG,IAAAC,eAAM,EAAC,CAAC;EAE7B,IAAAR,kBAAS,EAAE,MAAM;IAChBO,YAAY,CAACE,OAAO,GACnBC,QAAQ,CAACC,aAAa,CAAEC,wCAA8B,CAAC,IACvDF,QAAQ,CAACC,aAAa,CAAEE,gCAAsB,CAAC;EACjD,CAAC,EAAE,EAAG,CAAC;EAEP,IAAAb,kBAAS,EAAE,MAAM;IAChB,IAAK,CAAEG,YAAY,IAAI,CAAEI,YAAY,CAACE,OAAO,EAAG;MAC/C;IACD;IACAF,YAAY,CAACE,OAAO,CAACK,YAAY,CAAE,MAAM,EAAEX,YAAa,CAAC;EAC1D,CAAC,EAAE,CAAEA,YAAY,CAAG,CAAC;AACtB,CAAC;AAACF,OAAA,CAAAC,yBAAA,GAAAA,yBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_element","_compose","_data","_viewport","_i18n","_blockEditor","_components","_icons","_editor","_blocks","_reactNativeBridge","_style","_interopRequireDefault","_store","shadowStyle","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","HeaderToolbar","hasRedo","hasUndo","redo","undo","showInserter","showKeyboardHideButton","insertBlock","onHideKeyboard","isRTL","noContentSelected","anchorNodeRef","useRef","containerStyle","usePreferredColorSchemeStyle","styles","borderTopWidth","StyleSheet","hairlineWidth","useEffect","onUndoSubscription","subscribeOnUndoPressed","onRedoSubscription","subscribeOnRedoPressed","remove","toggleUndoButton","toggleRedoButton","scrollViewRef","scrollToStart","Platform","isAndroid","current","scrollToEnd","scrollTo","x","onInsertBlock","useCallback","blockType","createBlock","undefined","source","inserterMethod","renderMediaButtons","_react","createElement","ToolbarGroup","ToolbarButton","key","title","__","icon","imageIcon","onClick","testID","extraProps","hint","videoIcon","galleryIcon","audioIcon","toolbarAriaLabel","shadowColor","showKeyboardButtonStyles","color","View","ref","accessibilityLabel","style","ScrollView","onContentSizeChange","horizontal","showsHorizontalScrollIndicator","keyboardShouldPersistTaps","alwaysBounceHorizontal","contentContainerStyle","Inserter","disabled","BlockToolbar","passedStyle","keyboardClose","_default","exports","default","compose","withSelect","select","getBlockRootClientId","getBlockSelectionEnd","hasInserterItems","hasSelectedBlock","blockEditorStore","getEditorSettings","editorStore","isAnyBlockSelected","hasEditorRedo","hasEditorUndo","editPostStore","getEditorMode","richEditingEnabled","isTextModeEnabled","getSettings","withDispatch","dispatch","clearSelectedBlock","togglePostTitleSelection","withViewportMatch","isLargeViewport"],"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { ScrollView, StyleSheet, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef, useEffect, Platform } from '@wordpress/element';\nimport { compose, usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { withViewportMatch } from '@wordpress/viewport';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInserter,\n\tBlockToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarGroup, ToolbarButton } from '@wordpress/components';\nimport {\n\tkeyboardClose,\n\taudio as audioIcon,\n\tmedia as imageIcon,\n\tvideo as videoIcon,\n\tgallery as galleryIcon,\n} from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\ttoggleUndoButton,\n\ttoggleRedoButton,\n\tsubscribeOnUndoPressed,\n\tsubscribeOnRedoPressed,\n} from '@wordpress/react-native-bridge';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport { store as editPostStore } from '../../../store';\n\nconst shadowStyle = {\n\tshadowOffset: { width: 2, height: 2 },\n\tshadowOpacity: 1,\n\tshadowRadius: 6,\n\televation: 18,\n};\n\nfunction HeaderToolbar( {\n\thasRedo,\n\thasUndo,\n\tredo,\n\tundo,\n\tshowInserter,\n\tshowKeyboardHideButton,\n\tinsertBlock,\n\tonHideKeyboard,\n\tisRTL,\n\tnoContentSelected,\n} ) {\n\tconst anchorNodeRef = useRef();\n\n\tconst containerStyle = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'header-toolbar__container' ],\n\t\t\tstyles[ 'header-toolbar__container--dark' ]\n\t\t),\n\t\t{ borderTopWidth: StyleSheet.hairlineWidth },\n\t];\n\n\tuseEffect( () => {\n\t\tconst onUndoSubscription = subscribeOnUndoPressed( undo );\n\t\tconst onRedoSubscription = subscribeOnRedoPressed( redo );\n\n\t\treturn () => {\n\t\t\tonUndoSubscription?.remove();\n\t\t\tonRedoSubscription?.remove();\n\t\t};\n\t}, [ undo, redo ] );\n\n\tuseEffect( () => {\n\t\ttoggleUndoButton( ! hasUndo );\n\t}, [ hasUndo ] );\n\n\tuseEffect( () => {\n\t\ttoggleRedoButton( ! hasRedo );\n\t}, [ hasRedo ] );\n\n\tconst scrollViewRef = useRef( null );\n\tconst scrollToStart = () => {\n\t\t// scrollview doesn't seem to automatically adjust to RTL on Android so, scroll to end when Android\n\t\tif ( Platform.isAndroid && isRTL ) {\n\t\t\tscrollViewRef.current.scrollToEnd();\n\t\t} else {\n\t\t\tscrollViewRef.current.scrollTo( { x: 0 } );\n\t\t}\n\t};\n\n\tconst onInsertBlock = useCallback(\n\t\t( blockType ) => () => {\n\t\t\tinsertBlock( createBlock( blockType ), undefined, undefined, true, {\n\t\t\t\tsource: 'inserter_menu',\n\t\t\t\tinserterMethod: 'quick-inserter',\n\t\t\t} );\n\t\t},\n\t\t[ insertBlock ]\n\t);\n\n\tconst renderMediaButtons = (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"imageButton\"\n\t\t\t\ttitle={ __( 'Image' ) }\n\t\t\t\ticon={ imageIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/image' ) }\n\t\t\t\ttestID=\"insert-image-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Image Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"videoButton\"\n\t\t\t\ttitle={ __( 'Video' ) }\n\t\t\t\ticon={ videoIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/video' ) }\n\t\t\t\ttestID=\"insert-video-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Video Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"galleryButton\"\n\t\t\t\ttitle={ __( 'Gallery' ) }\n\t\t\t\ticon={ galleryIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/gallery' ) }\n\t\t\t\ttestID=\"insert-gallery-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Gallery Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"audioButton\"\n\t\t\t\ttitle={ __( 'Audio' ) }\n\t\t\t\ticon={ audioIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/audio' ) }\n\t\t\t\ttestID=\"insert-audio-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Audio Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t</ToolbarGroup>\n\t);\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst shadowColor = usePreferredColorSchemeStyle(\n\t\tstyles[ 'header-toolbar__keyboard-hide-shadow--light' ],\n\t\tstyles[ 'header-toolbar__keyboard-hide-shadow--dark' ]\n\t);\n\tconst showKeyboardButtonStyles = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'header-toolbar__keyboard-hide-container' ],\n\t\t\tstyles[ 'header-toolbar__keyboard-hide-container--dark' ]\n\t\t),\n\t\tshadowStyle,\n\t\t{\n\t\t\tshadowColor: Platform.isAndroid\n\t\t\t\t? styles[ 'header-toolbar__keyboard-hide-shadow--solid' ].color\n\t\t\t\t: shadowColor.color,\n\t\t},\n\t];\n\n\treturn (\n\t\t<View\n\t\t\tref={ anchorNodeRef }\n\t\t\ttestID={ toolbarAriaLabel }\n\t\t\taccessibilityLabel={ toolbarAriaLabel }\n\t\t\tstyle={ containerStyle }\n\t\t>\n\t\t\t<ScrollView\n\t\t\t\tref={ scrollViewRef }\n\t\t\t\tonContentSizeChange={ scrollToStart }\n\t\t\t\thorizontal={ true }\n\t\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\t\talwaysBounceHorizontal={ false }\n\t\t\t\tcontentContainerStyle={\n\t\t\t\t\tstyles[ 'header-toolbar__scrollable-content' ]\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<Inserter disabled={ ! showInserter } />\n\n\t\t\t\t{ noContentSelected && renderMediaButtons }\n\t\t\t\t<BlockToolbar anchorNodeRef={ anchorNodeRef.current } />\n\t\t\t</ScrollView>\n\t\t\t{ showKeyboardHideButton && (\n\t\t\t\t<ToolbarGroup passedStyle={ showKeyboardButtonStyles }>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ttitle={ __( 'Hide keyboard' ) }\n\t\t\t\t\t\ticon={ keyboardClose }\n\t\t\t\t\t\tonClick={ onHideKeyboard }\n\t\t\t\t\t\textraProps={ {\n\t\t\t\t\t\t\thint: __( 'Tap to hide the keyboard' ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\n\t\t</View>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockSelectionEnd,\n\t\t\thasInserterItems,\n\t\t\thasSelectedBlock,\n\t\t} = select( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst isAnyBlockSelected = hasSelectedBlock();\n\t\treturn {\n\t\t\thasRedo: select( editorStore ).hasEditorRedo(),\n\t\t\thasUndo: select( editorStore ).hasEditorUndo(),\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tshowInserter:\n\t\t\t\tselect( editPostStore ).getEditorMode() === '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\tisTextModeEnabled:\n\t\t\t\tselect( editPostStore ).getEditorMode() === 'text',\n\t\t\tisRTL: select( blockEditorStore ).getSettings().isRTL,\n\t\t\tnoContentSelected: ! isAnyBlockSelected,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { clearSelectedBlock, insertBlock } =\n\t\t\tdispatch( blockEditorStore );\n\t\tconst { togglePostTitleSelection } = dispatch( editorStore );\n\n\t\treturn {\n\t\t\tredo: dispatch( editorStore ).redo,\n\t\t\tundo: dispatch( editorStore ).undo,\n\t\t\tonHideKeyboard() {\n\t\t\t\tclearSelectedBlock();\n\t\t\t\ttogglePostTitleSelection( false );\n\t\t\t},\n\t\t\tinsertBlock,\n\t\t};\n\t} ),\n\twithViewportMatch( { isLargeViewport: 'medium' } ),\n] )( HeaderToolbar );\n"],"mappings":";;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,CAAE,CAAC,EACH,IAAAQ,kBAAY,EAAIC,QAAQ,IAAM;EAC7B,MAAM;IAAEC,kBAAkB;IAAE/F;EAAY,CAAC,GACxC8F,QAAQ,CAAEZ,kBAAiB,CAAC;EAC7B,MAAM;IAAEc;EAAyB,CAAC,GAAGF,QAAQ,CAAEV,aAAY,CAAC;EAE5D,OAAO;IACNxF,IAAI,EAAEkG,QAAQ,CAAEV,aAAY,CAAC,CAACxF,IAAI;IAClCC,IAAI,EAAEiG,QAAQ,CAAEV,aAAY,CAAC,CAACvF,IAAI;IAClCI,cAAcA,CAAA,EAAG;MAChB8F,kBAAkB,CAAC,CAAC;MACpBC,wBAAwB,CAAE,KAAM,CAAC;IAClC,CAAC;IACDhG;EACD,CAAC;AACF,CAAE,CAAC,EACH,IAAAiG,2BAAiB,EAAE;EAAEC,eAAe,EAAE;AAAS,CAAE,CAAC,CACjD,CAAC,CAAEzG,aAAc,CAAC"}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_element","_compose","_data","_viewport","_i18n","_blockEditor","_components","_icons","_editor","_blocks","_reactNativeBridge","_style","_interopRequireDefault","_store","shadowStyle","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","HeaderToolbar","hasRedo","hasUndo","redo","undo","showInserter","showKeyboardHideButton","insertBlock","onHideKeyboard","isRTL","noContentSelected","anchorNodeRef","useRef","containerStyle","usePreferredColorSchemeStyle","styles","borderTopWidth","StyleSheet","hairlineWidth","useEffect","onUndoSubscription","subscribeOnUndoPressed","onRedoSubscription","subscribeOnRedoPressed","remove","toggleUndoButton","toggleRedoButton","scrollViewRef","scrollToStart","Platform","isAndroid","current","scrollToEnd","scrollTo","x","onInsertBlock","useCallback","blockType","createBlock","undefined","source","inserterMethod","renderMediaButtons","_react","createElement","ToolbarGroup","ToolbarButton","key","title","__","icon","imageIcon","onClick","testID","extraProps","hint","videoIcon","galleryIcon","audioIcon","toolbarAriaLabel","shadowColor","showKeyboardButtonStyles","color","View","ref","accessibilityLabel","style","ScrollView","onContentSizeChange","horizontal","showsHorizontalScrollIndicator","keyboardShouldPersistTaps","alwaysBounceHorizontal","contentContainerStyle","Inserter","disabled","BlockToolbar","passedStyle","keyboardClose","_default","exports","default","compose","withSelect","select","getBlockRootClientId","getBlockSelectionEnd","hasInserterItems","hasSelectedBlock","blockEditorStore","getEditorSettings","editorStore","isAnyBlockSelected","hasEditorRedo","hasEditorUndo","editPostStore","getEditorMode","richEditingEnabled","isTextModeEnabled","getSettings","withDispatch","dispatch","clearSelectedBlock","togglePostTitleSelection","withViewportMatch","isLargeViewport"],"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { ScrollView, StyleSheet, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef, useEffect, Platform } from '@wordpress/element';\nimport { compose, usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { withViewportMatch } from '@wordpress/viewport';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInserter,\n\tBlockToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarGroup, ToolbarButton } from '@wordpress/components';\nimport {\n\tkeyboardClose,\n\taudio as audioIcon,\n\tmedia as imageIcon,\n\tvideo as videoIcon,\n\tgallery as galleryIcon,\n} from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\ttoggleUndoButton,\n\ttoggleRedoButton,\n\tsubscribeOnUndoPressed,\n\tsubscribeOnRedoPressed,\n} from '@wordpress/react-native-bridge';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport { store as editPostStore } from '../../../store';\n\nconst shadowStyle = {\n\tshadowOffset: { width: 2, height: 2 },\n\tshadowOpacity: 1,\n\tshadowRadius: 6,\n\televation: 18,\n};\n\nfunction HeaderToolbar( {\n\thasRedo,\n\thasUndo,\n\tredo,\n\tundo,\n\tshowInserter,\n\tshowKeyboardHideButton,\n\tinsertBlock,\n\tonHideKeyboard,\n\tisRTL,\n\tnoContentSelected,\n} ) {\n\tconst anchorNodeRef = useRef();\n\n\tconst containerStyle = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'header-toolbar__container' ],\n\t\t\tstyles[ 'header-toolbar__container--dark' ]\n\t\t),\n\t\t{ borderTopWidth: StyleSheet.hairlineWidth },\n\t];\n\n\tuseEffect( () => {\n\t\tconst onUndoSubscription = subscribeOnUndoPressed( undo );\n\t\tconst onRedoSubscription = subscribeOnRedoPressed( redo );\n\n\t\treturn () => {\n\t\t\tonUndoSubscription?.remove();\n\t\t\tonRedoSubscription?.remove();\n\t\t};\n\t}, [ undo, redo ] );\n\n\tuseEffect( () => {\n\t\ttoggleUndoButton( ! hasUndo );\n\t}, [ hasUndo ] );\n\n\tuseEffect( () => {\n\t\ttoggleRedoButton( ! hasRedo );\n\t}, [ hasRedo ] );\n\n\tconst scrollViewRef = useRef( null );\n\tconst scrollToStart = () => {\n\t\t// scrollview doesn't seem to automatically adjust to RTL on Android so, scroll to end when Android\n\t\tif ( Platform.isAndroid && isRTL ) {\n\t\t\tscrollViewRef.current.scrollToEnd();\n\t\t} else {\n\t\t\tscrollViewRef.current.scrollTo( { x: 0 } );\n\t\t}\n\t};\n\n\tconst onInsertBlock = useCallback(\n\t\t( blockType ) => () => {\n\t\t\tinsertBlock( createBlock( blockType ), undefined, undefined, true, {\n\t\t\t\tsource: 'inserter_menu',\n\t\t\t\tinserterMethod: 'quick-inserter',\n\t\t\t} );\n\t\t},\n\t\t[ insertBlock ]\n\t);\n\n\tconst renderMediaButtons = (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"imageButton\"\n\t\t\t\ttitle={ __( 'Image' ) }\n\t\t\t\ticon={ imageIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/image' ) }\n\t\t\t\ttestID=\"insert-image-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Image Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"videoButton\"\n\t\t\t\ttitle={ __( 'Video' ) }\n\t\t\t\ticon={ videoIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/video' ) }\n\t\t\t\ttestID=\"insert-video-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Video Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"galleryButton\"\n\t\t\t\ttitle={ __( 'Gallery' ) }\n\t\t\t\ticon={ galleryIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/gallery' ) }\n\t\t\t\ttestID=\"insert-gallery-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Gallery Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"audioButton\"\n\t\t\t\ttitle={ __( 'Audio' ) }\n\t\t\t\ticon={ audioIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/audio' ) }\n\t\t\t\ttestID=\"insert-audio-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Audio Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t</ToolbarGroup>\n\t);\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst shadowColor = usePreferredColorSchemeStyle(\n\t\tstyles[ 'header-toolbar__keyboard-hide-shadow--light' ],\n\t\tstyles[ 'header-toolbar__keyboard-hide-shadow--dark' ]\n\t);\n\tconst showKeyboardButtonStyles = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'header-toolbar__keyboard-hide-container' ],\n\t\t\tstyles[ 'header-toolbar__keyboard-hide-container--dark' ]\n\t\t),\n\t\tshadowStyle,\n\t\t{\n\t\t\tshadowColor: Platform.isAndroid\n\t\t\t\t? styles[ 'header-toolbar__keyboard-hide-shadow--solid' ].color\n\t\t\t\t: shadowColor.color,\n\t\t},\n\t];\n\n\treturn (\n\t\t<View\n\t\t\tref={ anchorNodeRef }\n\t\t\ttestID={ toolbarAriaLabel }\n\t\t\taccessibilityLabel={ toolbarAriaLabel }\n\t\t\tstyle={ containerStyle }\n\t\t>\n\t\t\t<ScrollView\n\t\t\t\tref={ scrollViewRef }\n\t\t\t\tonContentSizeChange={ scrollToStart }\n\t\t\t\thorizontal\n\t\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\t\talwaysBounceHorizontal={ false }\n\t\t\t\tcontentContainerStyle={\n\t\t\t\t\tstyles[ 'header-toolbar__scrollable-content' ]\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<Inserter disabled={ ! showInserter } />\n\n\t\t\t\t{ noContentSelected && renderMediaButtons }\n\t\t\t\t<BlockToolbar anchorNodeRef={ anchorNodeRef.current } />\n\t\t\t</ScrollView>\n\t\t\t{ showKeyboardHideButton && (\n\t\t\t\t<ToolbarGroup passedStyle={ showKeyboardButtonStyles }>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ttitle={ __( 'Hide keyboard' ) }\n\t\t\t\t\t\ticon={ keyboardClose }\n\t\t\t\t\t\tonClick={ onHideKeyboard }\n\t\t\t\t\t\textraProps={ {\n\t\t\t\t\t\t\thint: __( 'Tap to hide the keyboard' ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\n\t\t</View>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockSelectionEnd,\n\t\t\thasInserterItems,\n\t\t\thasSelectedBlock,\n\t\t} = select( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst isAnyBlockSelected = hasSelectedBlock();\n\t\treturn {\n\t\t\thasRedo: select( editorStore ).hasEditorRedo(),\n\t\t\thasUndo: select( editorStore ).hasEditorUndo(),\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tshowInserter:\n\t\t\t\tselect( editPostStore ).getEditorMode() === '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\tisTextModeEnabled:\n\t\t\t\tselect( editPostStore ).getEditorMode() === 'text',\n\t\t\tisRTL: select( blockEditorStore ).getSettings().isRTL,\n\t\t\tnoContentSelected: ! isAnyBlockSelected,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { clearSelectedBlock, insertBlock } =\n\t\t\tdispatch( blockEditorStore );\n\t\tconst { togglePostTitleSelection } = dispatch( editorStore );\n\n\t\treturn {\n\t\t\tredo: dispatch( editorStore ).redo,\n\t\t\tundo: dispatch( editorStore ).undo,\n\t\t\tonHideKeyboard() {\n\t\t\t\tclearSelectedBlock();\n\t\t\t\ttogglePostTitleSelection( false );\n\t\t\t},\n\t\t\tinsertBlock,\n\t\t};\n\t} ),\n\twithViewportMatch( { isLargeViewport: 'medium' } ),\n] )( HeaderToolbar );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAOA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,kBAAA,GAAAX,OAAA;AAUA,IAAAY,MAAA,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AAM,CAAC;IAClC,CAAC;IACDhG;EACD,CAAC;AACF,CAAE,CAAC,EACH,IAAAiG,2BAAiB,EAAE;EAAEC,eAAe,EAAE;AAAS,CAAE,CAAC,CACjD,CAAC,CAAEzG,aAAc,CAAC"}
|
|
@@ -35,6 +35,9 @@ var _lockUnlock = require("../../lock-unlock");
|
|
|
35
35
|
* Internal dependencies
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
|
+
const {
|
|
39
|
+
useShowBlockTools
|
|
40
|
+
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
38
41
|
const {
|
|
39
42
|
DocumentTools,
|
|
40
43
|
PostViewLink,
|
|
@@ -79,9 +82,8 @@ function Header({
|
|
|
79
82
|
const blockToolbarRef = (0, _element.useRef)();
|
|
80
83
|
const {
|
|
81
84
|
isTextEditor,
|
|
82
|
-
|
|
85
|
+
blockSelectionStart,
|
|
83
86
|
hasActiveMetaboxes,
|
|
84
|
-
hasFixedToolbar,
|
|
85
87
|
isPublishSidebarOpened,
|
|
86
88
|
showIconLabels,
|
|
87
89
|
hasHistory
|
|
@@ -94,21 +96,25 @@ function Header({
|
|
|
94
96
|
} = select(_editor.store);
|
|
95
97
|
return {
|
|
96
98
|
isTextEditor: getEditorMode() === 'text',
|
|
97
|
-
|
|
99
|
+
blockSelectionStart: select(_blockEditor.store).getBlockSelectionStart(),
|
|
98
100
|
hasActiveMetaboxes: select(_store.store).hasMetaBoxes(),
|
|
99
101
|
hasHistory: !!select(_editor.store).getEditorSettings().onNavigateToPreviousEntityRecord,
|
|
100
102
|
isPublishSidebarOpened: select(_store.store).isPublishSidebarOpened(),
|
|
101
|
-
hasFixedToolbar: getPreference('core', 'fixedToolbar'),
|
|
102
103
|
showIconLabels: getPreference('core', 'showIconLabels')
|
|
103
104
|
};
|
|
104
105
|
}, []);
|
|
106
|
+
const {
|
|
107
|
+
showFixedToolbar
|
|
108
|
+
} = useShowBlockTools();
|
|
109
|
+
const showTopToolbar = isLargeViewport && showFixedToolbar;
|
|
105
110
|
const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = (0, _element.useState)(true);
|
|
111
|
+
const hasBlockSelection = !!blockSelectionStart;
|
|
106
112
|
(0, _element.useEffect)(() => {
|
|
107
113
|
// If we have a new block selection, show the block tools
|
|
108
|
-
if (
|
|
114
|
+
if (blockSelectionStart) {
|
|
109
115
|
setIsBlockToolsCollapsed(false);
|
|
110
116
|
}
|
|
111
|
-
}, [
|
|
117
|
+
}, [blockSelectionStart]);
|
|
112
118
|
return (0, _react.createElement)("div", {
|
|
113
119
|
className: "edit-post-header"
|
|
114
120
|
}, (0, _react.createElement)(_mainDashboardButton.default.Slot, null, (0, _react.createElement)(_components.__unstableMotion.div, {
|
|
@@ -129,25 +135,26 @@ function Header({
|
|
|
129
135
|
className: "edit-post-header__toolbar"
|
|
130
136
|
}, (0, _react.createElement)(DocumentTools, {
|
|
131
137
|
disableBlockTools: isTextEditor
|
|
132
|
-
}),
|
|
138
|
+
}), showTopToolbar && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
|
|
133
139
|
className: (0, _classnames.default)('selected-block-tools-wrapper', {
|
|
134
|
-
'is-collapsed': isBlockToolsCollapsed
|
|
140
|
+
'is-collapsed': isBlockToolsCollapsed || !hasBlockSelection
|
|
135
141
|
})
|
|
136
142
|
}, (0, _react.createElement)(_blockEditor.BlockToolbar, {
|
|
137
143
|
hideDragHandle: true
|
|
138
144
|
})), (0, _react.createElement)(_components.Popover.Slot, {
|
|
139
145
|
ref: blockToolbarRef,
|
|
140
146
|
name: "block-toolbar"
|
|
141
|
-
}),
|
|
147
|
+
}), (0, _react.createElement)(_components.Button, {
|
|
142
148
|
className: "edit-post-header__block-tools-toggle",
|
|
143
149
|
icon: isBlockToolsCollapsed ? _icons.next : _icons.previous,
|
|
144
150
|
onClick: () => {
|
|
145
151
|
setIsBlockToolsCollapsed(collapsed => !collapsed);
|
|
146
152
|
},
|
|
147
|
-
label: isBlockToolsCollapsed ? (0, _i18n.__)('Show block tools') : (0, _i18n.__)('Hide block tools')
|
|
153
|
+
label: isBlockToolsCollapsed ? (0, _i18n.__)('Show block tools') : (0, _i18n.__)('Hide block tools'),
|
|
154
|
+
size: "compact"
|
|
148
155
|
})), (0, _react.createElement)("div", {
|
|
149
156
|
className: (0, _classnames.default)('edit-post-header__center', {
|
|
150
|
-
'is-collapsed': hasHistory &&
|
|
157
|
+
'is-collapsed': hasHistory && !isBlockToolsCollapsed && showTopToolbar
|
|
151
158
|
})
|
|
152
159
|
}, hasHistory && (0, _react.createElement)(_editor.DocumentBar, null))), (0, _react.createElement)(_components.__unstableMotion.div, {
|
|
153
160
|
variants: slideY,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_blockEditor","_editor","_element","_data","_i18n","_icons","_interface","_compose","_components","_preferences","_fullscreenModeClose","_moreMenu","_postPublishButtonOrToggle","_mainDashboardButton","_store","_lockUnlock","DocumentTools","PostViewLink","PreviewDropdown","unlock","editorPrivateApis","slideY","hidden","y","distractionFreeInactive","hover","transition","type","delay","slideX","x","Header","setEntitiesSavedStatesCallback","initialPost","isWideViewport","useViewportMatch","isLargeViewport","blockToolbarRef","useRef","isTextEditor","hasBlockSelection","hasActiveMetaboxes","hasFixedToolbar","isPublishSidebarOpened","showIconLabels","hasHistory","useSelect","select","get","getPreference","preferencesStore","getEditorMode","editorStore","blockEditorStore","getBlockSelectionStart","editPostStore","hasMetaBoxes","getEditorSettings","onNavigateToPreviousEntityRecord","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","useEffect","_react","createElement","className","default","Slot","__unstableMotion","div","variants","showTooltip","disableBlockTools","Fragment","classnames","BlockToolbar","hideDragHandle","Popover","ref","name","Button","icon","next","previous","onClick","collapsed","label","__","DocumentBar","PostSavedState","forceIsDirty","forceIsAutosaveable","PostPreviewButton","PinnedItems","scope","_default","exports"],"sources":["@wordpress/edit-post/src/components/header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tPostSavedState,\n\tPostPreviewButton,\n\tstore as editorStore,\n\tDocumentBar,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { next, previous } from '@wordpress/icons';\nimport { PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\tPopover,\n} from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport FullscreenModeClose from './fullscreen-mode-close';\nimport MoreMenu from './more-menu';\nimport PostPublishButtonOrToggle from './post-publish-button-or-toggle';\nimport MainDashboardButton from './main-dashboard-button';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { DocumentTools, PostViewLink, PreviewDropdown } =\n\tunlock( editorPrivateApis );\n\nconst slideY = {\n\thidden: { y: '-50px' },\n\tdistractionFreeInactive: { y: 0 },\n\thover: { y: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nconst slideX = {\n\thidden: { x: '-100%' },\n\tdistractionFreeInactive: { x: 0 },\n\thover: { x: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nfunction Header( { setEntitiesSavedStatesCallback, initialPost } ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst blockToolbarRef = useRef();\n\tconst {\n\t\tisTextEditor,\n\t\thasBlockSelection,\n\t\thasActiveMetaboxes,\n\t\thasFixedToolbar,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasHistory,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst { getEditorMode } = select( editorStore );\n\n\t\treturn {\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\thasBlockSelection:\n\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\thasHistory:\n\t\t\t\t!! select( editorStore ).getEditorSettings()\n\t\t\t\t\t.onNavigateToPreviousEntityRecord,\n\t\t\tisPublishSidebarOpened:\n\t\t\t\tselect( editPostStore ).isPublishSidebarOpened(),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t};\n\t}, [] );\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tuseEffect( () => {\n\t\t// If we have a new block selection, show the block tools\n\t\tif ( hasBlockSelection ) {\n\t\t\tsetIsBlockToolsCollapsed( false );\n\t\t}\n\t}, [ hasBlockSelection ] );\n\n\treturn (\n\t\t<div className=\"edit-post-header\">\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\n\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\tinitialPost={ initialPost }\n\t\t\t\t\t/>\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<DocumentTools disableBlockTools={ isTextEditor } />\n\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'selected-block-tools-wrapper',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-collapsed': isBlockToolsCollapsed,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ hasBlockSelection && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"edit-post-header__block-tools-toggle\"\n\t\t\t\t\t\t\t\ticon={ isBlockToolsCollapsed ? next : previous }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsBlockToolsCollapsed(\n\t\t\t\t\t\t\t\t\t\t( collapsed ) => ! collapsed\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\tisBlockToolsCollapsed\n\t\t\t\t\t\t\t\t\t\t? __( 'Show block tools' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Hide block tools' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames( 'edit-post-header__center', {\n\t\t\t\t\t\t'is-collapsed':\n\t\t\t\t\t\t\thasHistory &&\n\t\t\t\t\t\t\thasBlockSelection &&\n\t\t\t\t\t\t\t! isBlockToolsCollapsed &&\n\t\t\t\t\t\t\thasFixedToolbar &&\n\t\t\t\t\t\t\tisLargeViewport,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ hasHistory && <DocumentBar /> }\n\t\t\t\t</div>\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 forceIsDirty={ hasActiveMetaboxes } />\n\t\t\t\t) }\n\t\t\t\t<PreviewDropdown forceIsAutosaveable={ hasActiveMetaboxes } />\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"edit-post-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ hasActiveMetaboxes }\n\t\t\t\t/>\n\t\t\t\t<PostViewLink />\n\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\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{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-post\" />\n\t\t\t\t) }\n\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,OAAA,GAAAF,OAAA;AAOA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAA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A,CAAAsD,OAAyB;IACzBwB,YAAY,EAAGjD,kBAAoB;IACnCT,8BAA8B,EAC7BA;EACA,CACD,CAAC,EACA,CAAEE,cAAc,IAAI,CAAEU,cAAc,KACrC,IAAAmB,MAAA,CAAAC,aAAA,EAAC1D,UAAA,CAAAuF,WAAW,CAAC1B,IAAI;IAAC2B,KAAK,EAAC;EAAgB,CAAE,CAC1C,EACD,IAAA/B,MAAA,CAAAC,aAAA,EAACrD,SAAA,CAAAuD,OAAQ;IAACtB,cAAc,EAAGA;EAAgB,CAAE,CAClC,CACR,CAAC;AAER;AAAC,IAAAmD,QAAA,GAAAC,OAAA,CAAA9B,OAAA,GAEcnC,MAAM"}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_blockEditor","_editor","_element","_data","_i18n","_icons","_interface","_compose","_components","_preferences","_fullscreenModeClose","_moreMenu","_postPublishButtonOrToggle","_mainDashboardButton","_store","_lockUnlock","useShowBlockTools","unlock","blockEditorPrivateApis","DocumentTools","PostViewLink","PreviewDropdown","editorPrivateApis","slideY","hidden","y","distractionFreeInactive","hover","transition","type","delay","slideX","x","Header","setEntitiesSavedStatesCallback","initialPost","isWideViewport","useViewportMatch","isLargeViewport","blockToolbarRef","useRef","isTextEditor","blockSelectionStart","hasActiveMetaboxes","isPublishSidebarOpened","showIconLabels","hasHistory","useSelect","select","get","getPreference","preferencesStore","getEditorMode","editorStore","blockEditorStore","getBlockSelectionStart","editPostStore","hasMetaBoxes","getEditorSettings","onNavigateToPreviousEntityRecord","showFixedToolbar","showTopToolbar","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","hasBlockSelection","useEffect","_react","createElement","className","default","Slot","__unstableMotion","div","variants","showTooltip","disableBlockTools","Fragment","classnames","BlockToolbar","hideDragHandle","Popover","ref","name","Button","icon","next","previous","onClick","collapsed","label","__","size","DocumentBar","PostSavedState","forceIsDirty","forceIsAutosaveable","PostPreviewButton","PinnedItems","scope","_default","exports"],"sources":["@wordpress/edit-post/src/components/header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockToolbar,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tPostSavedState,\n\tPostPreviewButton,\n\tstore as editorStore,\n\tDocumentBar,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { next, previous } from '@wordpress/icons';\nimport { PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\tPopover,\n} from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport FullscreenModeClose from './fullscreen-mode-close';\nimport MoreMenu from './more-menu';\nimport PostPublishButtonOrToggle from './post-publish-button-or-toggle';\nimport MainDashboardButton from './main-dashboard-button';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { useShowBlockTools } = unlock( blockEditorPrivateApis );\nconst { DocumentTools, PostViewLink, PreviewDropdown } =\n\tunlock( editorPrivateApis );\n\nconst slideY = {\n\thidden: { y: '-50px' },\n\tdistractionFreeInactive: { y: 0 },\n\thover: { y: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nconst slideX = {\n\thidden: { x: '-100%' },\n\tdistractionFreeInactive: { x: 0 },\n\thover: { x: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nfunction Header( { setEntitiesSavedStatesCallback, initialPost } ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst blockToolbarRef = useRef();\n\tconst {\n\t\tisTextEditor,\n\t\tblockSelectionStart,\n\t\thasActiveMetaboxes,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasHistory,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst { getEditorMode } = select( editorStore );\n\n\t\treturn {\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\tblockSelectionStart:\n\t\t\t\tselect( blockEditorStore ).getBlockSelectionStart(),\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\thasHistory:\n\t\t\t\t!! select( editorStore ).getEditorSettings()\n\t\t\t\t\t.onNavigateToPreviousEntityRecord,\n\t\t\tisPublishSidebarOpened:\n\t\t\t\tselect( editPostStore ).isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t};\n\t}, [] );\n\n\tconst { showFixedToolbar } = useShowBlockTools();\n\tconst showTopToolbar = isLargeViewport && showFixedToolbar;\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\tconst hasBlockSelection = !! blockSelectionStart;\n\n\tuseEffect( () => {\n\t\t// If we have a new block selection, show the block tools\n\t\tif ( blockSelectionStart ) {\n\t\t\tsetIsBlockToolsCollapsed( false );\n\t\t}\n\t}, [ blockSelectionStart ] );\n\n\treturn (\n\t\t<div className=\"edit-post-header\">\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\n\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\tinitialPost={ initialPost }\n\t\t\t\t\t/>\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<DocumentTools disableBlockTools={ isTextEditor } />\n\t\t\t\t{ showTopToolbar && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'selected-block-tools-wrapper',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-collapsed':\n\t\t\t\t\t\t\t\t\t\tisBlockToolsCollapsed ||\n\t\t\t\t\t\t\t\t\t\t! hasBlockSelection,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-post-header__block-tools-toggle\"\n\t\t\t\t\t\t\ticon={ isBlockToolsCollapsed ? next : previous }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetIsBlockToolsCollapsed(\n\t\t\t\t\t\t\t\t\t( collapsed ) => ! collapsed\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisBlockToolsCollapsed\n\t\t\t\t\t\t\t\t\t? __( 'Show block tools' )\n\t\t\t\t\t\t\t\t\t: __( 'Hide block tools' )\n\t\t\t\t\t\t\t}\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<div\n\t\t\t\t\tclassName={ classnames( 'edit-post-header__center', {\n\t\t\t\t\t\t'is-collapsed':\n\t\t\t\t\t\t\thasHistory &&\n\t\t\t\t\t\t\t! isBlockToolsCollapsed &&\n\t\t\t\t\t\t\tshowTopToolbar,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ hasHistory && <DocumentBar /> }\n\t\t\t\t</div>\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 forceIsDirty={ hasActiveMetaboxes } />\n\t\t\t\t) }\n\t\t\t\t<PreviewDropdown forceIsAutosaveable={ hasActiveMetaboxes } />\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"edit-post-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ hasActiveMetaboxes }\n\t\t\t\t/>\n\t\t\t\t<PostViewLink />\n\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\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{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-post\" />\n\t\t\t\t) }\n\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAF,OAAA;AAOA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,O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AwB,MAAA,CAAAC,aAAA,EAACnE,OAAA,CAAAgG,iBAAiB;IACjB5B,SAAS,EAAC,uCAAuC;IACjD2B,mBAAmB,EAAGrD;EAAoB,CAC1C,CAAC,EACF,IAAAwB,MAAA,CAAAC,aAAA,EAAChD,YAAY,MAAE,CAAC,EAChB,IAAA+C,MAAA,CAAAC,aAAA,EAACxD,0BAAA,CAAA0D,OAAyB;IACzByB,YAAY,EAAGpD,kBAAoB;IACnCT,8BAA8B,EAC7BA;EACA,CACD,CAAC,EACA,CAAEE,cAAc,IAAI,CAAES,cAAc,KACrC,IAAAsB,MAAA,CAAAC,aAAA,EAAC9D,UAAA,CAAA4F,WAAW,CAAC3B,IAAI;IAAC4B,KAAK,EAAC;EAAgB,CAAE,CAC1C,EACD,IAAAhC,MAAA,CAAAC,aAAA,EAACzD,SAAA,CAAA2D,OAAQ;IAACzB,cAAc,EAAGA;EAAgB,CAAE,CAClC,CACR,CAAC;AAER;AAAC,IAAAuD,QAAA,GAAAC,OAAA,CAAA/B,OAAA,GAEcrC,MAAM"}
|
|
@@ -11,6 +11,7 @@ var _components = require("@wordpress/components");
|
|
|
11
11
|
var _interface = require("@wordpress/interface");
|
|
12
12
|
var _compose = require("@wordpress/compose");
|
|
13
13
|
var _editor = require("@wordpress/editor");
|
|
14
|
+
var _icons = require("@wordpress/icons");
|
|
14
15
|
var _preferencesMenuItem = _interopRequireDefault(require("../preferences-menu-item"));
|
|
15
16
|
var _toolsMoreMenuGroup = _interopRequireDefault(require("../tools-more-menu-group"));
|
|
16
17
|
var _writingMenu = _interopRequireDefault(require("../writing-menu"));
|
|
@@ -30,12 +31,19 @@ const MoreMenu = ({
|
|
|
30
31
|
showIconLabels
|
|
31
32
|
}) => {
|
|
32
33
|
const isLargeViewport = (0, _compose.useViewportMatch)('large');
|
|
33
|
-
return (0, _react.createElement)(
|
|
34
|
+
return (0, _react.createElement)(_components.DropdownMenu, {
|
|
35
|
+
icon: _icons.moreVertical,
|
|
36
|
+
label: (0, _i18n.__)('Options'),
|
|
37
|
+
popoverProps: {
|
|
38
|
+
placement: 'bottom-end',
|
|
39
|
+
className: 'more-menu-dropdown__content'
|
|
40
|
+
},
|
|
34
41
|
toggleProps: {
|
|
35
|
-
showTooltip: !showIconLabels,
|
|
36
42
|
...(showIconLabels && {
|
|
37
43
|
variant: 'tertiary'
|
|
38
44
|
}),
|
|
45
|
+
tooltipPosition: 'bottom',
|
|
46
|
+
showTooltip: !showIconLabels,
|
|
39
47
|
size: 'compact'
|
|
40
48
|
}
|
|
41
49
|
}, ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_interface","_compose","_editor","_preferencesMenuItem","_interopRequireDefault","_toolsMoreMenuGroup","_writingMenu","_lockUnlock","ModeSwitcher","unlock","editorPrivateApis","MoreMenu","showIconLabels","isLargeViewport","useViewportMatch","_react","createElement","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_interface","_compose","_editor","_icons","_preferencesMenuItem","_interopRequireDefault","_toolsMoreMenuGroup","_writingMenu","_lockUnlock","ModeSwitcher","unlock","editorPrivateApis","MoreMenu","showIconLabels","isLargeViewport","useViewportMatch","_react","createElement","DropdownMenu","icon","moreVertical","label","__","popoverProps","placement","className","toggleProps","variant","tooltipPosition","showTooltip","size","onClose","Fragment","PinnedItems","Slot","scope","default","ActionItem","name","as","MenuGroup","fillProps","onClick","_default","exports"],"sources":["@wordpress/edit-post/src/components/header/more-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuGroup, DropdownMenu } from '@wordpress/components';\nimport { ActionItem, PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport PreferencesMenuItem from '../preferences-menu-item';\nimport ToolsMoreMenuGroup from '../tools-more-menu-group';\nimport WritingMenu from '../writing-menu';\nimport { unlock } from '../../../lock-unlock';\n\nconst { ModeSwitcher } = unlock( editorPrivateApis );\n\nconst MoreMenu = ( { showIconLabels } ) => {\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Options' ) }\n\t\t\tpopoverProps={ {\n\t\t\t\tplacement: 'bottom-end',\n\t\t\t\tclassName: 'more-menu-dropdown__content',\n\t\t\t} }\n\t\t\ttoggleProps={ {\n\t\t\t\t...( showIconLabels && { variant: 'tertiary' } ),\n\t\t\t\ttooltipPosition: 'bottom',\n\t\t\t\tshowTooltip: ! showIconLabels,\n\t\t\t\tsize: 'compact',\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</DropdownMenu>\n\t);\n};\n\nexport default MoreMenu;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,U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B,OAAW,MAAE,CAAC,EACf,IAAApB,MAAA,CAAAC,aAAA,EAACR,YAAY,MAAE,CAAC,EAChB,IAAAO,MAAA,CAAAC,aAAA,EAACjB,UAAA,CAAAqC,UAAU,CAACH,IAAI;IACfI,IAAI,EAAC,iCAAiC;IACtCjB,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;IACzBiB,EAAE,EAAGC,qBAAW;IAChBC,SAAS,EAAG;MAAEC,OAAO,EAAEX;IAAQ;EAAG,CAClC,CAAC,EACF,IAAAf,MAAA,CAAAC,aAAA,EAACX,mBAAA,CAAA8B,OAAkB,CAACF,IAAI;IAACO,SAAS,EAAG;MAAEV;IAAQ;EAAG,CAAE,CAAC,EACrD,IAAAf,MAAA,CAAAC,aAAA,EAAClB,WAAA,CAAAyC,SAAS,QACT,IAAAxB,MAAA,CAAAC,aAAA,EAACb,oBAAA,CAAAgC,OAAmB,MAAE,CACZ,CACV,CAEU,CAAC;AAEjB,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAEaxB,QAAQ"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = InitPatternModal;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _data = require("@wordpress/data");
|
|
9
|
+
var _i18n = require("@wordpress/i18n");
|
|
10
|
+
var _components = require("@wordpress/components");
|
|
11
|
+
var _element = require("@wordpress/element");
|
|
12
|
+
var _editor = require("@wordpress/editor");
|
|
13
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
14
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
15
|
+
/**
|
|
16
|
+
* WordPress dependencies
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Internal dependencies
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
ReusableBlocksRenameHint
|
|
25
|
+
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
26
|
+
function InitPatternModal() {
|
|
27
|
+
const {
|
|
28
|
+
editPost
|
|
29
|
+
} = (0, _data.useDispatch)(_editor.store);
|
|
30
|
+
const [isModalOpen, setIsModalOpen] = (0, _element.useState)(false);
|
|
31
|
+
const [syncType, setSyncType] = (0, _element.useState)(undefined);
|
|
32
|
+
const [title, setTitle] = (0, _element.useState)('');
|
|
33
|
+
const {
|
|
34
|
+
postType,
|
|
35
|
+
isNewPost
|
|
36
|
+
} = (0, _data.useSelect)(select => {
|
|
37
|
+
const {
|
|
38
|
+
getEditedPostAttribute,
|
|
39
|
+
isCleanNewPost
|
|
40
|
+
} = select(_editor.store);
|
|
41
|
+
return {
|
|
42
|
+
postType: getEditedPostAttribute('type'),
|
|
43
|
+
isNewPost: isCleanNewPost()
|
|
44
|
+
};
|
|
45
|
+
}, []);
|
|
46
|
+
(0, _element.useEffect)(() => {
|
|
47
|
+
if (isNewPost && postType === 'wp_block') {
|
|
48
|
+
setIsModalOpen(true);
|
|
49
|
+
}
|
|
50
|
+
// We only want the modal to open when the page is first loaded.
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
}, []);
|
|
53
|
+
if (postType !== 'wp_block' || !isNewPost) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return (0, _react.createElement)(_react.Fragment, null, isModalOpen && (0, _react.createElement)(_components.Modal, {
|
|
57
|
+
title: (0, _i18n.__)('Create pattern'),
|
|
58
|
+
onRequestClose: () => {
|
|
59
|
+
setIsModalOpen(false);
|
|
60
|
+
},
|
|
61
|
+
overlayClassName: "reusable-blocks-menu-items__convert-modal"
|
|
62
|
+
}, (0, _react.createElement)("form", {
|
|
63
|
+
onSubmit: event => {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
setIsModalOpen(false);
|
|
66
|
+
editPost({
|
|
67
|
+
title,
|
|
68
|
+
meta: {
|
|
69
|
+
wp_pattern_sync_status: syncType
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}, (0, _react.createElement)(_components.__experimentalVStack, {
|
|
74
|
+
spacing: "5"
|
|
75
|
+
}, (0, _react.createElement)(_components.TextControl, {
|
|
76
|
+
label: (0, _i18n.__)('Name'),
|
|
77
|
+
value: title,
|
|
78
|
+
onChange: setTitle,
|
|
79
|
+
placeholder: (0, _i18n.__)('My pattern'),
|
|
80
|
+
className: "patterns-create-modal__name-input",
|
|
81
|
+
__nextHasNoMarginBottom: true,
|
|
82
|
+
__next40pxDefaultSize: true
|
|
83
|
+
}), (0, _react.createElement)(ReusableBlocksRenameHint, null), (0, _react.createElement)(_components.ToggleControl, {
|
|
84
|
+
label: (0, _i18n._x)('Synced', 'Option that makes an individual pattern synchronized'),
|
|
85
|
+
help: (0, _i18n.__)('Sync this pattern across multiple locations.'),
|
|
86
|
+
checked: !syncType,
|
|
87
|
+
onChange: () => {
|
|
88
|
+
setSyncType(!syncType ? 'unsynced' : undefined);
|
|
89
|
+
}
|
|
90
|
+
}), (0, _react.createElement)(_components.__experimentalHStack, {
|
|
91
|
+
justify: "right"
|
|
92
|
+
}, (0, _react.createElement)(_components.Button, {
|
|
93
|
+
variant: "primary",
|
|
94
|
+
type: "submit",
|
|
95
|
+
disabled: !title,
|
|
96
|
+
__experimentalIsFocusable: true
|
|
97
|
+
}, (0, _i18n.__)('Create')))))));
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_data","require","_i18n","_components","_element","_editor","_blockEditor","_lockUnlock","ReusableBlocksRenameHint","unlock","blockEditorPrivateApis","InitPatternModal","editPost","useDispatch","editorStore","isModalOpen","setIsModalOpen","useState","syncType","setSyncType","undefined","title","setTitle","postType","isNewPost","useSelect","select","getEditedPostAttribute","isCleanNewPost","useEffect","_react","createElement","Fragment","Modal","__","onRequestClose","overlayClassName","onSubmit","event","preventDefault","meta","wp_pattern_sync_status","__experimentalVStack","spacing","TextControl","label","value","onChange","placeholder","className","__nextHasNoMarginBottom","__next40pxDefaultSize","ToggleControl","_x","help","checked","__experimentalHStack","justify","Button","variant","type","disabled","__experimentalIsFocusable"],"sources":["@wordpress/edit-post/src/components/init-pattern-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n\tTextControl,\n} from '@wordpress/components';\nimport { useEffect, useState } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\n\nimport { unlock } from '../../lock-unlock';\n\nconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\nexport default function InitPatternModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { postType, isNewPost } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, isCleanNewPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisNewPost: isCleanNewPost(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( isNewPost && postType === 'wp_block' ) {\n\t\t\tsetIsModalOpen( true );\n\t\t}\n\t\t// We only want the modal to open when the page is first loaded.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tif ( postType !== 'wp_block' || ! isNewPost ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Create pattern' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t\t\tplaceholder={ __( 'My pattern' ) }\n\t\t\t\t\t\t\t\tclassName=\"patterns-create-modal__name-input\"\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ReusableBlocksRenameHint />\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t\t\t'Option that makes an individual pattern synchronized'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Sync this pattern across multiple locations.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\t\t\t! syncType ? 'unsynced' : undefined\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\tdisabled={ ! title }\n\t\t\t\t\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAQA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAMA,IAAAM,WAAA,GAAAN,OAAA;AArBA;AACA;AACA;;AAeA;AACA;AACA;;AAIA,MAAM;EAAEO;AAAyB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAEtD,SAASC,gBAAgBA,CAAA,EAAG;EAC1C,MAAM;IAAEC;EAAS,CAAC,GAAG,IAAAC,iBAAW,EAAEC,aAAY,CAAC;EAC/C,MAAM,CAAEC,WAAW,EAAEC,cAAc,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACzD,MAAM,CAAEC,QAAQ,EAAEC,WAAW,CAAE,GAAG,IAAAF,iBAAQ,EAAEG,SAAU,CAAC;EACvD,MAAM,CAAEC,KAAK,EAAEC,QAAQ,CAAE,GAAG,IAAAL,iBAAQ,EAAE,EAAG,CAAC;EAE1C,M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C,KAAK,EAAG,IAAAX,QAAE,EAAE,MAAO,CAAG;IACtBY,KAAK,EAAGzB,KAAO;IACf0B,QAAQ,EAAGzB,QAAU;IACrB0B,WAAW,EAAG,IAAAd,QAAE,EAAE,YAAa,CAAG;IAClCe,SAAS,EAAC,mCAAmC;IAC7CC,uBAAuB;IACvBC,qBAAqB;EAAA,CACrB,CAAC,EACF,IAAArB,MAAA,CAAAC,aAAA,EAACvB,wBAAwB,MAAE,CAAC,EAC5B,IAAAsB,MAAA,CAAAC,aAAA,EAAC5B,WAAA,CAAAiD,aAAa;IACbP,KAAK,EAAG,IAAAQ,QAAE,EACT,QAAQ,EACR,sDACD,CAAG;IACHC,IAAI,EAAG,IAAApB,QAAE,EACR,8CACD,CAAG;IACHqB,OAAO,EAAG,CAAErC,QAAU;IACtB6B,QAAQ,EAAGA,CAAA,KAAM;MAChB5B,WAAW,CACV,CAAED,QAAQ,GAAG,UAAU,GAAGE,SAC3B,CAAC;IACF;EAAG,CACH,CAAC,EACF,IAAAU,MAAA,CAAAC,aAAA,EAAC5B,WAAA,CAAAqD,oBAAM;IAACC,OAAO,EAAC;EAAO,GACtB,IAAA3B,MAAA,CAAAC,aAAA,EAAC5B,WAAA,CAAAuD,MAAM;IACNC,OAAO,EAAC,SAAS;IACjBC,IAAI,EAAC,QAAQ;IACbC,QAAQ,EAAG,CAAExC,KAAO;IACpByC,yBAAyB;EAAA,GAEvB,IAAA5B,QAAE,EAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAEP,CAAC;AAEL"}
|
|
@@ -68,5 +68,11 @@ const textFormattingShortcuts = exports.textFormattingShortcuts = [{
|
|
|
68
68
|
character: '1-6'
|
|
69
69
|
},
|
|
70
70
|
description: (0, _i18n.__)('Convert the current paragraph or heading to a heading of level 1 to 6.')
|
|
71
|
+
}, {
|
|
72
|
+
keyCombination: {
|
|
73
|
+
modifier: 'primaryShift',
|
|
74
|
+
character: '\u00a0'
|
|
75
|
+
},
|
|
76
|
+
description: (0, _i18n.__)('Add non breaking space.')
|
|
71
77
|
}];
|
|
72
78
|
//# sourceMappingURL=config.js.map
|