@wordpress/edit-post 7.22.0 → 7.23.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 +2 -0
- package/build/components/header/document-actions/index.js +3 -7
- package/build/components/header/document-actions/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.js +3 -8
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/index.js +65 -11
- package/build/components/header/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +2 -4
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/sidebar/post-schedule/index.js +1 -0
- package/build/components/sidebar/post-schedule/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +1 -2
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/start-page-options/index.js +11 -13
- package/build/components/start-page-options/index.js.map +1 -1
- package/build-module/components/header/document-actions/index.js +3 -7
- package/build-module/components/header/document-actions/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.js +3 -8
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/index.js +66 -12
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +2 -4
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/sidebar/post-schedule/index.js +1 -0
- package/build-module/components/sidebar/post-schedule/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +2 -3
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/start-page-options/index.js +12 -14
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-style/style-rtl.css +34 -133
- package/build-style/style.css +34 -133
- package/package.json +32 -32
- package/src/components/header/document-actions/index.js +4 -7
- package/src/components/header/header-toolbar/index.js +1 -5
- package/src/components/header/index.js +104 -17
- package/src/components/header/style.scss +31 -2
- package/src/components/keyboard-shortcuts/index.js +6 -3
- package/src/components/layout/style.scss +0 -11
- package/src/components/sidebar/post-schedule/index.js +1 -0
- package/src/components/sidebar/post-schedule/style.scss +6 -4
- package/src/components/sidebar/post-status/index.js +6 -3
- package/src/components/sidebar/post-template/style.scss +2 -3
- package/src/components/sidebar/post-visibility/style.scss +2 -3
- package/src/components/start-page-options/index.js +8 -15
- package/src/components/visual-editor/style.scss +0 -90
- package/src/style.scss +0 -1
- package/build/components/sidebar/post-url/index.js +0 -62
- package/build/components/sidebar/post-url/index.js.map +0 -1
- package/build-module/components/sidebar/post-url/index.js +0 -55
- package/build-module/components/sidebar/post-url/index.js.map +0 -1
- package/src/components/sidebar/post-url/index.js +0 -58
- package/src/components/sidebar/post-url/style.scss +0 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_element","_blockEditor","_data","_compose","_editor","_store","useStartPatterns","blockPatternsWithPostContentBlockType","postType","useSelect","select","getPatternsByBlockTypes","blockEditorStore","getCurrentPostType","editorStore","useMemo","filter","pattern","postTypes","Array","isArray","includes","PatternSelection","blockPatterns","onChoosePattern","shownBlockPatterns","useAsyncList","resetEditorBlocks","useDispatch","_react","createElement","__experimentalBlockPatternsList","shownPatterns","onClickPattern","_pattern","blocks","StartPageOptionsModal","
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_element","_blockEditor","_data","_compose","_editor","_store","useStartPatterns","blockPatternsWithPostContentBlockType","postType","useSelect","select","getPatternsByBlockTypes","blockEditorStore","getCurrentPostType","editorStore","useMemo","filter","pattern","postTypes","Array","isArray","includes","PatternSelection","blockPatterns","onChoosePattern","shownBlockPatterns","useAsyncList","resetEditorBlocks","useDispatch","_react","createElement","__experimentalBlockPatternsList","shownPatterns","onClickPattern","_pattern","blocks","StartPageOptionsModal","onClose","startPatterns","hasStartPattern","length","Modal","className","title","__","isFullScreen","onRequestClose","StartPageOptions","isClosed","setIsClosed","useState","shouldEnableModal","isCleanNewPost","isEditingTemplate","isFeatureActive","editPostStore"],"sources":["@wordpress/edit-post/src/components/start-page-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction useStartPatterns() {\n\t// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,\n\t// and it has no postTypes declared and the current post type is page or if\n\t// the current post type is part of the postTypes declared.\n\tconst { blockPatternsWithPostContentBlockType, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPatternsByBlockTypes } = select( blockEditorStore );\n\t\t\tconst { getCurrentPostType } = select( editorStore );\n\t\t\treturn {\n\t\t\t\tblockPatternsWithPostContentBlockType:\n\t\t\t\t\tgetPatternsByBlockTypes( 'core/post-content' ),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\treturn useMemo( () => {\n\t\t// filter patterns without postTypes declared if the current postType is page\n\t\t// or patterns that declare the current postType in its post type array.\n\t\treturn blockPatternsWithPostContentBlockType.filter( ( pattern ) => {\n\t\t\treturn (\n\t\t\t\t( postType === 'page' && ! pattern.postTypes ) ||\n\t\t\t\t( Array.isArray( pattern.postTypes ) &&\n\t\t\t\t\tpattern.postTypes.includes( postType ) )\n\t\t\t);\n\t\t} );\n\t}, [ postType, blockPatternsWithPostContentBlockType ] );\n}\n\nfunction PatternSelection( { blockPatterns, onChoosePattern } ) {\n\tconst shownBlockPatterns = useAsyncList( blockPatterns );\n\tconst { resetEditorBlocks } = useDispatch( editorStore );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\tonClickPattern={ ( _pattern, blocks ) => {\n\t\t\t\tresetEditorBlocks( blocks );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartPageOptionsModal( { onClose } ) {\n\tconst startPatterns = useStartPatterns();\n\tconst hasStartPattern = startPatterns.length > 0;\n\n\tif ( ! hasStartPattern ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-post-start-page-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tisFullScreen\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t<div className=\"edit-post-start-page-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tblockPatterns={ startPatterns }\n\t\t\t\t\tonChoosePattern={ onClose }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartPageOptions() {\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst shouldEnableModal = useSelect( ( select ) => {\n\t\tconst { isCleanNewPost } = select( editorStore );\n\t\tconst { isEditingTemplate, isFeatureActive } = select( editPostStore );\n\n\t\treturn (\n\t\t\t! isEditingTemplate() &&\n\t\t\t! isFeatureActive( 'welcomeGuide' ) &&\n\t\t\tisCleanNewPost()\n\t\t);\n\t}, [] );\n\n\tif ( ! shouldEnableModal || isClosed ) {\n\t\treturn null;\n\t}\n\n\treturn <StartPageOptionsModal onClose={ () => setIsClosed( true ) } />;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAIA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AAjBA;AACA;AACA;;AAYA;AACA;AACA;;AAGA,SAAS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AK;EAAG,CAAE,CAAC;AACvE"}
|
|
@@ -16,17 +16,13 @@ import { displayShortcut } from '@wordpress/keycodes';
|
|
|
16
16
|
import { store as editPostStore } from '../../../store';
|
|
17
17
|
function DocumentActions() {
|
|
18
18
|
const {
|
|
19
|
-
template
|
|
20
|
-
isEditing
|
|
19
|
+
template
|
|
21
20
|
} = useSelect(select => {
|
|
22
21
|
const {
|
|
23
|
-
isEditingTemplate,
|
|
24
22
|
getEditedPostTemplate
|
|
25
23
|
} = select(editPostStore);
|
|
26
|
-
const _isEditing = isEditingTemplate();
|
|
27
24
|
return {
|
|
28
|
-
template:
|
|
29
|
-
isEditing: _isEditing
|
|
25
|
+
template: getEditedPostTemplate()
|
|
30
26
|
};
|
|
31
27
|
}, []);
|
|
32
28
|
const {
|
|
@@ -38,7 +34,7 @@ function DocumentActions() {
|
|
|
38
34
|
const {
|
|
39
35
|
open: openCommandCenter
|
|
40
36
|
} = useDispatch(commandsStore);
|
|
41
|
-
if (!
|
|
37
|
+
if (!template) {
|
|
42
38
|
return null;
|
|
43
39
|
}
|
|
44
40
|
let templateTitle = __('Default');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","isRTL","useSelect","useDispatch","BlockIcon","store","blockEditorStore","Button","VisuallyHidden","__experimentalHStack","HStack","__experimentalText","Text","layout","chevronLeftSmall","chevronRightSmall","commandsStore","displayShortcut","editPostStore","DocumentActions","template","
|
|
1
|
+
{"version":3,"names":["__","isRTL","useSelect","useDispatch","BlockIcon","store","blockEditorStore","Button","VisuallyHidden","__experimentalHStack","HStack","__experimentalText","Text","layout","chevronLeftSmall","chevronRightSmall","commandsStore","displayShortcut","editPostStore","DocumentActions","template","select","getEditedPostTemplate","clearSelectedBlock","setIsEditingTemplate","open","openCommandCenter","templateTitle","title","slug","createElement","className","onClick","icon","spacing","justify","size","as","primary"],"sources":["@wordpress/edit-post/src/components/header/document-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { BlockIcon, store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\tButton,\n\tVisuallyHidden,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { layout, chevronLeftSmall, chevronRightSmall } from '@wordpress/icons';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nfunction DocumentActions() {\n\tconst { template } = useSelect( ( select ) => {\n\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\n\t\treturn {\n\t\t\ttemplate: getEditedPostTemplate(),\n\t\t};\n\t}, [] );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tlet templateTitle = __( 'Default' );\n\tif ( template?.title ) {\n\t\ttemplateTitle = template.title;\n\t} else if ( !! template ) {\n\t\ttemplateTitle = template.slug;\n\t}\n\n\treturn (\n\t\t<div className=\"edit-post-document-actions\">\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-post-document-actions__back\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t} }\n\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t>\n\t\t\t\t{ __( 'Back' ) }\n\t\t\t</Button>\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-post-document-actions__command\"\n\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tclassName=\"edit-post-document-actions__title\"\n\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\tjustify=\"center\"\n\t\t\t\t>\n\t\t\t\t\t<BlockIcon icon={ layout } />\n\t\t\t\t\t<Text size=\"body\" as=\"h1\">\n\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t{ __( 'Editing template: ' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t{ templateTitle }\n\t\t\t\t\t</Text>\n\t\t\t\t</HStack>\n\t\t\t\t<span className=\"edit-post-document-actions__shortcut\">\n\t\t\t\t\t{ displayShortcut.primary( 'k' ) }\n\t\t\t\t</span>\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n\nexport default DocumentActions;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,SAAS,EAAEC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AAC9E,SACCC,MAAM,EACNC,cAAc,EACdC,oBAAoB,IAAIC,MAAM,EAC9BC,kBAAkB,IAAIC,IAAI,QACpB,uBAAuB;AAC9B,SAASC,MAAM,EAAEC,gBAAgB,EAAEC,iBAAiB,QAAQ,kBAAkB;AAC9E,SAASV,KAAK,IAAIW,aAAa,QAAQ,qBAAqB;AAC5D,SAASC,eAAe,QAAQ,qBAAqB;;AAErD;AACA;AACA;AACA,SAASZ,KAAK,IAAIa,aAAa,QAAQ,gBAAgB;AAEvD,SAASC,eAAeA,CAAA,EAAG;EAC1B,MAAM;IAAEC;EAAS,CAAC,GAAGlB,SAAS,CAAImB,MAAM,IAAM;IAC7C,MAAM;MAAEC;IAAsB,CAAC,GAAGD,MAAM,CAAEH,aAAc,CAAC;IAEzD,OAAO;MACNE,QAAQ,EAAEE,qBAAqB,CAAC;IACjC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEC;EAAmB,CAAC,GAAGpB,WAAW,CAAEG,gBAAiB,CAAC;EAC9D,MAAM;IAAEkB;EAAqB,CAAC,GAAGrB,WAAW,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e,CAACqB,OAAO,CAAE,GAAI,CAC1B,CACC,CACJ,CAAC;AAER;AAEA,eAAenB,eAAe"}
|
|
@@ -11,7 +11,6 @@ import { Button, ToolbarItem } from '@wordpress/components';
|
|
|
11
11
|
import { listView, plus } from '@wordpress/icons';
|
|
12
12
|
import { useRef, useCallback } from '@wordpress/element';
|
|
13
13
|
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
14
|
-
import { store as preferencesStore } from '@wordpress/preferences';
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* Internal dependencies
|
|
@@ -25,6 +24,7 @@ const preventDefault = event => {
|
|
|
25
24
|
event.preventDefault();
|
|
26
25
|
};
|
|
27
26
|
function HeaderToolbar({
|
|
27
|
+
hasFixedToolbar,
|
|
28
28
|
setListViewToggleElement
|
|
29
29
|
}) {
|
|
30
30
|
const inserterButton = useRef();
|
|
@@ -38,8 +38,7 @@ function HeaderToolbar({
|
|
|
38
38
|
isTextModeEnabled,
|
|
39
39
|
showIconLabels,
|
|
40
40
|
isListViewOpen,
|
|
41
|
-
listViewShortcut
|
|
42
|
-
hasFixedToolbar
|
|
41
|
+
listViewShortcut
|
|
43
42
|
} = useSelect(select => {
|
|
44
43
|
const {
|
|
45
44
|
hasInserterItems,
|
|
@@ -57,9 +56,6 @@ function HeaderToolbar({
|
|
|
57
56
|
const {
|
|
58
57
|
getShortcutRepresentation
|
|
59
58
|
} = select(keyboardShortcutsStore);
|
|
60
|
-
const {
|
|
61
|
-
get: getPreference
|
|
62
|
-
} = select(preferencesStore);
|
|
63
59
|
return {
|
|
64
60
|
// This setting (richEditingEnabled) should not live in the block editor's setting.
|
|
65
61
|
isInserterEnabled: getEditorMode() === 'visual' && getEditorSettings().richEditingEnabled && hasInserterItems(getBlockRootClientId(getBlockSelectionEnd())),
|
|
@@ -67,8 +63,7 @@ function HeaderToolbar({
|
|
|
67
63
|
isTextModeEnabled: getEditorMode() === 'text',
|
|
68
64
|
showIconLabels: isFeatureActive('showIconLabels'),
|
|
69
65
|
isListViewOpen: isListViewOpened(),
|
|
70
|
-
listViewShortcut: getShortcutRepresentation('core/edit-post/toggle-list-view')
|
|
71
|
-
hasFixedToolbar: getPreference('core/edit-post', 'fixedToolbar')
|
|
66
|
+
listViewShortcut: getShortcutRepresentation('core/edit-post/toggle-list-view')
|
|
72
67
|
};
|
|
73
68
|
}, []);
|
|
74
69
|
const isLargeViewport = useViewportMatch('medium');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useViewportMatch","useSelect","useDispatch","__","_x","NavigableToolbar","ToolSelector","store","blockEditorStore","privateApis","blockEditorPrivateApis","EditorHistoryRedo","EditorHistoryUndo","editorStore","Button","ToolbarItem","listView","plus","useRef","useCallback","keyboardShortcutsStore","preferencesStore","editPostStore","unlock","useShouldContextualToolbarShow","preventDefault","event","HeaderToolbar","setListViewToggleElement","inserterButton","setIsInserterOpened","setIsListViewOpened","isInserterEnabled","isInserterOpened","isTextModeEnabled","showIconLabels","isListViewOpen","listViewShortcut","hasFixedToolbar","select","hasInserterItems","getBlockRootClientId","getBlockSelectionEnd","getEditorSettings","getEditorMode","isFeatureActive","isListViewOpened","getShortcutRepresentation","get","getPreference","richEditingEnabled","isLargeViewport","isWideViewport","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","toolbarAriaLabel","toggleListView","overflowItems","createElement","Fragment","as","className","icon","disabled","isPressed","label","onClick","shortcut","showTooltip","variant","undefined","ref","toggleInserter","current","focus","longLabel","shortLabel","shouldUseKeyboardFocusShortcut","onMouseDown"],"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.js"],"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\tprivateApis as blockEditorPrivateApis,\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';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nfunction HeaderToolbar( { setListViewToggleElement } ) {\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\thasFixedToolbar,\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\t\tconst { get: getPreference } = select( preferencesStore );\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\thasFixedToolbar: getPreference( 'core/edit-post', 'fixedToolbar' ),\n\t\t};\n\t}, [] );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\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\taria-expanded={ isListViewOpen }\n\t\t\t\tref={ setListViewToggleElement }\n\t\t\t/>\n\t\t</>\n\t);\n\tconst toggleInserter = useCallback( () => {\n\t\tif ( isInserterOpened ) {\n\t\t\t// Focusing the inserter button should close the inserter popover.\n\t\t\t// However, there are some cases it won't close when the focus is lost.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/43090 for more details.\n\t\t\tinserterButton.current.focus();\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpened, setIsInserterOpened ] );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-post-header-toolbar\"\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tshouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"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={ toggleInserter }\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\taria-expanded={ isInserterOpened }\n\t\t\t\t/>\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && ! hasFixedToolbar && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ 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"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SACCC,gBAAgB,EAChBC,YAAY,EACZC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SACCC,iBAAiB,EACjBC,iBAAiB,EACjBL,KAAK,IAAIM,WAAW,QACd,mBAAmB;AAC1B,SAASC,MAAM,EAAEC,WAAW,QAAQ,uBAAuB;AAC3D,SAASC,QAAQ,EAAEC,IAAI,QAAQ,kBAAkB;AACjD,SAASC,MAAM,EAAEC,WAAW,QAAQ,oBAAoB;AACxD,SAASZ,KAAK,IAAIa,sBAAsB,QAAQ,+BAA+B;AAC/E,SAASb,KAAK,IAAIc,gBAAgB,QAAQ,wBAAwB;;AAElE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Ae,IACrCsB,aAAA,CAAC7C,WAAW;IACX+C,EAAE,EAAGxD,YAAc;IACnBgE,WAAW,EAAG,CAAEnC,cAAgB;IAChCoC,OAAO,EACNpC,cAAc,GAAG,UAAU,GAAGqC,SAC9B;IACDP,QAAQ,EAAG/B;EAAmB,CAC9B,CACD,EACD0B,aAAA,CAAC7C,WAAW;IACX+C,EAAE,EAAGlD,iBAAmB;IACxB0D,WAAW,EAAG,CAAEnC,cAAgB;IAChCoC,OAAO,EAAGpC,cAAc,GAAG,UAAU,GAAGqC;EAAW,CACnD,CAAC,EACFZ,aAAA,CAAC7C,WAAW;IACX+C,EAAE,EAAGnD,iBAAmB;IACxB2D,WAAW,EAAG,CAAEnC,cAAgB;IAChCoC,OAAO,EAAGpC,cAAc,GAAG,UAAU,GAAGqC;EAAW,CACnD,CAAC,EACAb,aACD,CAEC,CACY,CAAC;AAErB;AAEA,eAAehC,aAAa"}
|
|
1
|
+
{"version":3,"names":["useViewportMatch","useSelect","useDispatch","__","_x","NavigableToolbar","ToolSelector","store","blockEditorStore","privateApis","blockEditorPrivateApis","EditorHistoryRedo","EditorHistoryUndo","editorStore","Button","ToolbarItem","listView","plus","useRef","useCallback","keyboardShortcutsStore","editPostStore","unlock","useShouldContextualToolbarShow","preventDefault","event","HeaderToolbar","hasFixedToolbar","setListViewToggleElement","inserterButton","setIsInserterOpened","setIsListViewOpened","isInserterEnabled","isInserterOpened","isTextModeEnabled","showIconLabels","isListViewOpen","listViewShortcut","select","hasInserterItems","getBlockRootClientId","getBlockSelectionEnd","getEditorSettings","getEditorMode","isFeatureActive","isListViewOpened","getShortcutRepresentation","richEditingEnabled","isLargeViewport","isWideViewport","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","toolbarAriaLabel","toggleListView","overflowItems","createElement","Fragment","as","className","icon","disabled","isPressed","label","onClick","shortcut","showTooltip","variant","undefined","ref","toggleInserter","current","focus","longLabel","shortLabel","shouldUseKeyboardFocusShortcut","onMouseDown"],"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.js"],"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\tprivateApis as blockEditorPrivateApis,\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';\nimport { unlock } from '../../../lock-unlock';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nfunction HeaderToolbar( { hasFixedToolbar, setListViewToggleElement } ) {\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\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\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\taria-expanded={ isListViewOpen }\n\t\t\t\tref={ setListViewToggleElement }\n\t\t\t/>\n\t\t</>\n\t);\n\tconst toggleInserter = useCallback( () => {\n\t\tif ( isInserterOpened ) {\n\t\t\t// Focusing the inserter button should close the inserter popover.\n\t\t\t// However, there are some cases it won't close when the focus is lost.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/43090 for more details.\n\t\t\tinserterButton.current.focus();\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpened, setIsInserterOpened ] );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-post-header-toolbar\"\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tshouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"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={ toggleInserter }\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\taria-expanded={ isInserterOpened }\n\t\t\t\t/>\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && ! hasFixedToolbar && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ 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"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SACCC,gBAAgB,EAChBC,YAAY,EACZC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SACCC,iBAAiB,EACjBC,iBAAiB,EACjBL,KAAK,IAAIM,WAAW,QACd,mBAAmB;AAC1B,SAASC,MAAM,EAAEC,WAAW,QAAQ,uBAAuB;AAC3D,SAASC,QAAQ,EAAEC,IAAI,QAAQ,kBAAkB;AACjD,SAASC,MAAM,E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nB6D,WAAW,EAAG,CAAEhC,cAAgB;IAChCiC,OAAO,EACNjC,cAAc,GAAG,UAAU,GAAGkC,SAC9B;IACDP,QAAQ,EAAG5B;EAAmB,CAC9B,CACD,EACDuB,aAAA,CAAC1C,WAAW;IACX4C,EAAE,EAAG/C,iBAAmB;IACxBuD,WAAW,EAAG,CAAEhC,cAAgB;IAChCiC,OAAO,EAAGjC,cAAc,GAAG,UAAU,GAAGkC;EAAW,CACnD,CAAC,EACFZ,aAAA,CAAC1C,WAAW;IACX4C,EAAE,EAAGhD,iBAAmB;IACxBwD,WAAW,EAAG,CAAEhC,cAAgB;IAChCiC,OAAO,EAAGjC,cAAc,GAAG,UAAU,GAAGkC;EAAW,CACnD,CAAC,EACAb,aACD,CAEC,CACY,CAAC;AAErB;AAEA,eAAe9B,aAAa"}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { createElement, Fragment } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
5
|
+
import classnames from 'classnames';
|
|
6
|
+
|
|
2
7
|
/**
|
|
3
8
|
* WordPress dependencies
|
|
4
9
|
*/
|
|
10
|
+
import { privateApis as blockEditorPrivateApis, store as blockEditorStore } from '@wordpress/block-editor';
|
|
5
11
|
import { PostSavedState, PostPreviewButton } from '@wordpress/editor';
|
|
12
|
+
import { useEffect, useRef, useState } from '@wordpress/element';
|
|
6
13
|
import { useSelect } from '@wordpress/data';
|
|
14
|
+
import { __ } from '@wordpress/i18n';
|
|
15
|
+
import { next, previous } from '@wordpress/icons';
|
|
7
16
|
import { PinnedItems } from '@wordpress/interface';
|
|
8
17
|
import { useViewportMatch } from '@wordpress/compose';
|
|
9
|
-
import { __unstableMotion as motion } from '@wordpress/components';
|
|
18
|
+
import { Button, __unstableMotion as motion, Popover } from '@wordpress/components';
|
|
19
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
10
20
|
|
|
11
21
|
/**
|
|
12
22
|
* Internal dependencies
|
|
@@ -20,6 +30,10 @@ import ViewLink from '../view-link';
|
|
|
20
30
|
import MainDashboardButton from './main-dashboard-button';
|
|
21
31
|
import { store as editPostStore } from '../../store';
|
|
22
32
|
import DocumentActions from './document-actions';
|
|
33
|
+
import { unlock } from '../../lock-unlock';
|
|
34
|
+
const {
|
|
35
|
+
BlockContextualToolbar
|
|
36
|
+
} = unlock(blockEditorPrivateApis);
|
|
23
37
|
const slideY = {
|
|
24
38
|
hidden: {
|
|
25
39
|
y: '-50px'
|
|
@@ -54,16 +68,37 @@ function Header({
|
|
|
54
68
|
setEntitiesSavedStatesCallback,
|
|
55
69
|
setListViewToggleElement
|
|
56
70
|
}) {
|
|
57
|
-
const
|
|
71
|
+
const isWideViewport = useViewportMatch('large');
|
|
72
|
+
const isLargeViewport = useViewportMatch('medium');
|
|
73
|
+
const blockToolbarRef = useRef();
|
|
58
74
|
const {
|
|
75
|
+
blockSelectionStart,
|
|
59
76
|
hasActiveMetaboxes,
|
|
77
|
+
hasFixedToolbar,
|
|
78
|
+
isEditingTemplate,
|
|
60
79
|
isPublishSidebarOpened,
|
|
61
80
|
showIconLabels
|
|
62
|
-
} = useSelect(select =>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
81
|
+
} = useSelect(select => {
|
|
82
|
+
const {
|
|
83
|
+
get: getPreference
|
|
84
|
+
} = select(preferencesStore);
|
|
85
|
+
return {
|
|
86
|
+
blockSelectionStart: select(blockEditorStore).getBlockSelectionStart(),
|
|
87
|
+
hasActiveMetaboxes: select(editPostStore).hasMetaBoxes(),
|
|
88
|
+
isEditingTemplate: select(editPostStore).isEditingTemplate(),
|
|
89
|
+
isPublishSidebarOpened: select(editPostStore).isPublishSidebarOpened(),
|
|
90
|
+
hasFixedToolbar: getPreference('core/edit-post', 'fixedToolbar'),
|
|
91
|
+
showIconLabels: select(editPostStore).isFeatureActive('showIconLabels')
|
|
92
|
+
};
|
|
93
|
+
}, []);
|
|
94
|
+
const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = useState(true);
|
|
95
|
+
const hasBlockSelected = !!blockSelectionStart;
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
// If we have a new block selection, show the block tools
|
|
98
|
+
if (blockSelectionStart) {
|
|
99
|
+
setIsBlockToolsCollapsed(false);
|
|
100
|
+
}
|
|
101
|
+
}, [blockSelectionStart]);
|
|
67
102
|
return createElement("div", {
|
|
68
103
|
className: "edit-post-header"
|
|
69
104
|
}, createElement(MainDashboardButton.Slot, null, createElement(motion.div, {
|
|
@@ -82,10 +117,29 @@ function Header({
|
|
|
82
117
|
},
|
|
83
118
|
className: "edit-post-header__toolbar"
|
|
84
119
|
}, createElement(HeaderToolbar, {
|
|
120
|
+
hasFixedToolbar: hasFixedToolbar,
|
|
85
121
|
setListViewToggleElement: setListViewToggleElement
|
|
86
|
-
}), createElement("div", {
|
|
87
|
-
className:
|
|
88
|
-
|
|
122
|
+
}), hasFixedToolbar && isLargeViewport && createElement(Fragment, null, createElement("div", {
|
|
123
|
+
className: classnames('selected-block-tools-wrapper', {
|
|
124
|
+
'is-collapsed': isBlockToolsCollapsed
|
|
125
|
+
})
|
|
126
|
+
}, createElement(BlockContextualToolbar, {
|
|
127
|
+
isFixed: true
|
|
128
|
+
})), createElement(Popover.Slot, {
|
|
129
|
+
ref: blockToolbarRef,
|
|
130
|
+
name: "block-toolbar"
|
|
131
|
+
}), isEditingTemplate && hasBlockSelected && createElement(Button, {
|
|
132
|
+
className: "edit-post-header__block-tools-toggle",
|
|
133
|
+
icon: isBlockToolsCollapsed ? next : previous,
|
|
134
|
+
onClick: () => {
|
|
135
|
+
setIsBlockToolsCollapsed(collapsed => !collapsed);
|
|
136
|
+
},
|
|
137
|
+
label: isBlockToolsCollapsed ? __('Show block tools') : __('Hide block tools')
|
|
138
|
+
})), createElement("div", {
|
|
139
|
+
className: classnames('edit-post-header__center', {
|
|
140
|
+
'is-collapsed': !isBlockToolsCollapsed && isLargeViewport && isEditingTemplate
|
|
141
|
+
})
|
|
142
|
+
}, isEditingTemplate && createElement(DocumentActions, null))), createElement(motion.div, {
|
|
89
143
|
variants: slideY,
|
|
90
144
|
transition: {
|
|
91
145
|
type: 'tween',
|
|
@@ -106,11 +160,11 @@ function Header({
|
|
|
106
160
|
}), createElement(ViewLink, null), createElement(PostPublishButtonOrToggle, {
|
|
107
161
|
forceIsDirty: hasActiveMetaboxes,
|
|
108
162
|
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
|
|
109
|
-
}), (
|
|
163
|
+
}), (isWideViewport || !showIconLabels) && createElement(Fragment, null, createElement(PinnedItems.Slot, {
|
|
110
164
|
scope: "core/edit-post"
|
|
111
165
|
}), createElement(MoreMenu, {
|
|
112
166
|
showIconLabels: showIconLabels
|
|
113
|
-
})), showIconLabels && !
|
|
167
|
+
})), showIconLabels && !isWideViewport && createElement(MoreMenu, {
|
|
114
168
|
showIconLabels: showIconLabels
|
|
115
169
|
})));
|
|
116
170
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PostSavedState","PostPreviewButton","useSelect","PinnedItems","useViewportMatch","__unstableMotion","motion","FullscreenModeClose","HeaderToolbar","MoreMenu","PostPublishButtonOrToggle","default","DevicePreview","ViewLink","MainDashboardButton","store","editPostStore","DocumentActions","slideY","hidden","y","distractionFreeInactive","hover","transition","type","delay","slideX","x","Header","setEntitiesSavedStatesCallback","setListViewToggleElement","isLargeViewport","hasActiveMetaboxes","isPublishSidebarOpened","showIconLabels","select","hasMetaBoxes","isFeatureActive","createElement","className","Slot","div","variants","showTooltip","forceIsDirty","forceIsAutosaveable","Fragment","scope"],"sources":["@wordpress/edit-post/src/components/header/index.js"],"sourcesContent":["/**\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 ViewLink from '../view-link';\nimport MainDashboardButton from './main-dashboard-button';\nimport { store as editPostStore } from '../../store';\nimport DocumentActions from './document-actions';\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( {\n\tsetEntitiesSavedStatesCallback,\n\tsetListViewToggleElement,\n} ) {\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\tconst { hasActiveMetaboxes, isPublishSidebarOpened, showIconLabels } =\n\t\tuseSelect(\n\t\t\t( select ) => ( {\n\t\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\t\tisPublishSidebarOpened:\n\t\t\t\t\tselect( editPostStore ).isPublishSidebarOpened(),\n\t\t\t\tshowIconLabels:\n\t\t\t\t\tselect( editPostStore ).isFeatureActive( 'showIconLabels' ),\n\t\t\t} ),\n\t\t\t[]\n\t\t);\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 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\tsetListViewToggleElement={ setListViewToggleElement }\n\t\t\t\t/>\n\t\t\t\t<div className=\"edit-post-header__center\">\n\t\t\t\t\t<DocumentActions />\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\n\t\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\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 forceIsAutosaveable={ hasActiveMetaboxes } />\n\t\t\t\t<ViewLink />\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{ ( 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;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AAc;IACd4C,YAAY,EAAGZ,kBAAoB;IACnCE,cAAc,EAAGA;EAAgB,CACjC,CACD,EACDI,aAAA,CAAC1B,aAAa,MAAE,CAAC,EACjB0B,aAAA,CAACrC,iBAAiB;IAAC4C,mBAAmB,EAAGb;EAAoB,CAAE,CAAC,EAChEM,aAAA,CAACzB,QAAQ,MAAE,CAAC,EACZyB,aAAA,CAAC5B,yBAAyB;IACzBkC,YAAY,EAAGZ,kBAAoB;IACnCH,8BAA8B,EAC7BA;EACA,CACD,CAAC,EACA,CAAEE,eAAe,IAAI,CAAEG,cAAc,KACtCI,aAAA,CAAAQ,QAAA,QACCR,aAAA,CAACnC,WAAW,CAACqC,IAAI;IAACO,KAAK,EAAC;EAAgB,CAAE,CAAC,EAC3CT,aAAA,CAAC7B,QAAQ;IAACyB,cAAc,EAAGA;EAAgB,CAAE,CAC5C,CACF,EACCA,cAAc,IAAI,CAAEH,eAAe,IACpCO,aAAA,CAAC7B,QAAQ;IAACyB,cAAc,EAAGA;EAAgB,CAAE,CAEnC,CACR,CAAC;AAER;AAEA,eAAeN,MAAM"}
|
|
1
|
+
{"version":3,"names":["classnames","privateApis","blockEditorPrivateApis","store","blockEditorStore","PostSavedState","PostPreviewButton","useEffect","useRef","useState","useSelect","__","next","previous","PinnedItems","useViewportMatch","Button","__unstableMotion","motion","Popover","preferencesStore","FullscreenModeClose","HeaderToolbar","MoreMenu","PostPublishButtonOrToggle","default","DevicePreview","ViewLink","MainDashboardButton","editPostStore","DocumentActions","unlock","BlockContextualToolbar","slideY","hidden","y","distractionFreeInactive","hover","transition","type","delay","slideX","x","Header","setEntitiesSavedStatesCallback","setListViewToggleElement","isWideViewport","isLargeViewport","blockToolbarRef","blockSelectionStart","hasActiveMetaboxes","hasFixedToolbar","isEditingTemplate","isPublishSidebarOpened","showIconLabels","select","get","getPreference","getBlockSelectionStart","hasMetaBoxes","isFeatureActive","isBlockToolsCollapsed","setIsBlockToolsCollapsed","hasBlockSelected","createElement","className","Slot","div","variants","showTooltip","Fragment","isFixed","ref","name","icon","onClick","collapsed","label","forceIsDirty","forceIsAutosaveable","scope"],"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\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { PostSavedState, PostPreviewButton } 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 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 ViewLink from '../view-link';\nimport MainDashboardButton from './main-dashboard-button';\nimport { store as editPostStore } from '../../store';\nimport DocumentActions from './document-actions';\nimport { unlock } from '../../lock-unlock';\n\nconst { BlockContextualToolbar } = unlock( blockEditorPrivateApis );\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( {\n\tsetEntitiesSavedStatesCallback,\n\tsetListViewToggleElement,\n} ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst blockToolbarRef = useRef();\n\tconst {\n\t\tblockSelectionStart,\n\t\thasActiveMetaboxes,\n\t\thasFixedToolbar,\n\t\tisEditingTemplate,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\n\t\treturn {\n\t\t\tblockSelectionStart:\n\t\t\t\tselect( blockEditorStore ).getBlockSelectionStart(),\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\tisEditingTemplate: select( editPostStore ).isEditingTemplate(),\n\t\t\tisPublishSidebarOpened:\n\t\t\t\tselect( editPostStore ).isPublishSidebarOpened(),\n\t\t\thasFixedToolbar: getPreference( 'core/edit-post', 'fixedToolbar' ),\n\t\t\tshowIconLabels:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'showIconLabels' ),\n\t\t};\n\t}, [] );\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tconst hasBlockSelected = !! 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 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\thasFixedToolbar={ hasFixedToolbar }\n\t\t\t\t\tsetListViewToggleElement={ setListViewToggleElement }\n\t\t\t\t/>\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<BlockContextualToolbar isFixed />\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{ isEditingTemplate && hasBlockSelected && (\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\t! isBlockToolsCollapsed &&\n\t\t\t\t\t\t\tisLargeViewport &&\n\t\t\t\t\t\t\tisEditingTemplate,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ isEditingTemplate && <DocumentActions /> }\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\n\t\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\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 forceIsAutosaveable={ hasActiveMetaboxes } />\n\t\t\t\t<ViewLink />\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<>\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 && ! isWideViewport && (\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"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AAC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AE,CAC5C,CACF,EACCA,cAAc,IAAI,CAAER,cAAc,IACnCkB,aAAA,CAACzC,QAAQ;IAAC+B,cAAc,EAAGA;EAAgB,CAAE,CAEnC,CACR,CAAC;AAER;AAEA,eAAeX,MAAM"}
|
|
@@ -14,9 +14,6 @@ import { createBlock } from '@wordpress/blocks';
|
|
|
14
14
|
*/
|
|
15
15
|
import { store as editPostStore } from '../../store';
|
|
16
16
|
function KeyboardShortcuts() {
|
|
17
|
-
const {
|
|
18
|
-
getBlockSelectionStart
|
|
19
|
-
} = useSelect(blockEditorStore);
|
|
20
17
|
const {
|
|
21
18
|
getEditorMode,
|
|
22
19
|
isEditorSidebarOpened,
|
|
@@ -46,7 +43,8 @@ function KeyboardShortcuts() {
|
|
|
46
43
|
const {
|
|
47
44
|
getBlockName,
|
|
48
45
|
getSelectedBlockClientId,
|
|
49
|
-
getBlockAttributes
|
|
46
|
+
getBlockAttributes,
|
|
47
|
+
getBlockSelectionStart
|
|
50
48
|
} = useSelect(blockEditorStore);
|
|
51
49
|
const handleTextLevelShortcut = (event, level) => {
|
|
52
50
|
event.preventDefault();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useSelect","useDispatch","useShortcut","store","keyboardShortcutsStore","__","editorStore","blockEditorStore","createBlock","editPostStore","KeyboardShortcuts","getBlockSelectionStart","getEditorMode","isEditorSidebarOpened","isListViewOpened","isModeToggleDisabled","select","richEditingEnabled","codeEditingEnabled","getEditorSettings","switchEditorMode","openGeneralSidebar","closeGeneralSidebar","toggleFeature","setIsListViewOpened","toggleDistractionFree","registerShortcut","replaceBlocks","getBlockName","getSelectedBlockClientId","getBlockAttributes","handleTextLevelShortcut","event","level","preventDefault","destinationBlockName","currentClientId","blockName","attributes","textAlign","destinationTextAlign","content","name","category","description","keyCombination","modifier","character","aliases","forEach","isDisabled","sidebarToOpen"],"sources":["@wordpress/edit-post/src/components/keyboard-shortcuts/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction KeyboardShortcuts() {\n\tconst { getBlockSelectionStart } = useSelect( blockEditorStore );\n\tconst { getEditorMode, isEditorSidebarOpened, isListViewOpened } =\n\t\tuseSelect( editPostStore );\n\tconst isModeToggleDisabled = useSelect( ( select ) => {\n\t\tconst { richEditingEnabled, codeEditingEnabled } =\n\t\t\tselect( editorStore ).getEditorSettings();\n\t\treturn ! richEditingEnabled || ! codeEditingEnabled;\n\t}, [] );\n\n\tconst {\n\t\tswitchEditorMode,\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\ttoggleFeature,\n\t\tsetIsListViewOpened,\n\t\ttoggleDistractionFree,\n\t} = useDispatch( editPostStore );\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { getBlockName, getSelectedBlockClientId, getBlockAttributes } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst handleTextLevelShortcut = ( event, level ) => {\n\t\tevent.preventDefault();\n\t\tconst destinationBlockName =\n\t\t\tlevel === 0 ? 'core/paragraph' : 'core/heading';\n\t\tconst currentClientId = getSelectedBlockClientId();\n\t\tif ( currentClientId === null ) {\n\t\t\treturn;\n\t\t}\n\t\tconst blockName = getBlockName( currentClientId );\n\t\tif ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {\n\t\t\treturn;\n\t\t}\n\t\tconst attributes = getBlockAttributes( currentClientId );\n\t\tconst textAlign =\n\t\t\tblockName === 'core/paragraph' ? 'align' : 'textAlign';\n\t\tconst destinationTextAlign =\n\t\t\tdestinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';\n\n\t\treplaceBlocks(\n\t\t\tcurrentClientId,\n\t\t\tcreateBlock( destinationBlockName, {\n\t\t\t\tlevel,\n\t\t\t\tcontent: attributes.content,\n\t\t\t\t...{ [ destinationTextAlign ]: attributes[ textAlign ] },\n\t\t\t} )\n\t\t);\n\t};\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-mode',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Switch between visual editor and code editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'm',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-distraction-free',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Toggle distraction free mode.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: '\\\\',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-fullscreen',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Toggle fullscreen mode.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'f',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-list-view',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Open the block list view.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'o',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-sidebar',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Show or hide the Settings sidebar.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: ',',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/next-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the next part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrl',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'n',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/previous-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the previous part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrlShift',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'p',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'ctrlShift',\n\t\t\t\t\tcharacter: '~',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/keyboard-shortcuts',\n\t\t\tcategory: 'main',\n\t\t\tdescription: __( 'Display these keyboard shortcuts.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'h',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/transform-heading-to-paragraph',\n\t\t\tcategory: 'block-library',\n\t\t\tdescription: __( 'Transform heading to paragraph.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: `0`,\n\t\t\t},\n\t\t} );\n\n\t\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t\tregisterShortcut( {\n\t\t\t\tname: `core/edit-post/transform-paragraph-to-heading-${ level }`,\n\t\t\t\tcategory: 'block-library',\n\t\t\t\tdescription: __( 'Transform paragraph to heading.' ),\n\t\t\t\tkeyCombination: {\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: `${ level }`,\n\t\t\t\t},\n\t\t\t} );\n\t\t} );\n\t}, [] );\n\n\tuseShortcut(\n\t\t'core/edit-post/toggle-mode',\n\t\t() => {\n\t\t\tswitchEditorMode(\n\t\t\t\tgetEditorMode() === 'visual' ? 'text' : 'visual'\n\t\t\t);\n\t\t},\n\t\t{\n\t\t\tisDisabled: isModeToggleDisabled,\n\t\t}\n\t);\n\n\tuseShortcut( 'core/edit-post/toggle-fullscreen', () => {\n\t\ttoggleFeature( 'fullscreenMode' );\n\t} );\n\n\tuseShortcut( 'core/edit-post/toggle-distraction-free', () => {\n\t\ttoggleDistractionFree();\n\t} );\n\n\tuseShortcut( 'core/edit-post/toggle-sidebar', ( event ) => {\n\t\t// This shortcut has no known clashes, but use preventDefault to prevent any\n\t\t// obscure shortcuts from triggering.\n\t\tevent.preventDefault();\n\n\t\tif ( isEditorSidebarOpened() ) {\n\t\t\tcloseGeneralSidebar();\n\t\t} else {\n\t\t\tconst sidebarToOpen = getBlockSelectionStart()\n\t\t\t\t? 'edit-post/block'\n\t\t\t\t: 'edit-post/document';\n\t\t\topenGeneralSidebar( sidebarToOpen );\n\t\t}\n\t} );\n\n\t// Only opens the list view. Other functionality for this shortcut happens in the rendered sidebar.\n\tuseShortcut( 'core/edit-post/toggle-list-view', ( event ) => {\n\t\tif ( ! isListViewOpened() ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsListViewOpened( true );\n\t\t}\n\t} );\n\n\tuseShortcut( 'core/edit-post/transform-heading-to-paragraph', ( event ) =>\n\t\thandleTextLevelShortcut( event, 0 )\n\t);\n\n\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t//the loop is based off on a constant therefore\n\t\t//the hook will execute the same way every time\n\t\t//eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseShortcut(\n\t\t\t`core/edit-post/transform-paragraph-to-heading-${ level }`,\n\t\t\t( event ) => handleTextLevelShortcut( event, level )\n\t\t);\n\t} );\n\n\treturn null;\n}\n\nexport default KeyboardShortcuts;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,WAAW,EACXC,KAAK,IAAIC,sBAAsB,QACzB,+BAA+B;AACtC,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASF,KAAK,IAAIG,WAAW,QAAQ,mBAAmB;AACxD,SAASH,KAAK,IAAII,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,WAAW,QAAQ,mBAAmB;;AAE/C;AACA;AACA;AACA,SAASL,KAAK,IAAIM,aAAa,QAAQ,aAAa;AAEpD,SAASC,iBAAiBA,CAAA,EAAG;EAC5B,MAAM;IAAEC;EAAuB,CAAC,GAAGX,SAAS,CAAEO,gBAAiB,CAAC;EAChE,MAAM;IAAEK,aAAa;IAAEC,qBAAqB;IAAEC;EAAiB,CAAC,GAC/Dd,SAAS,CAAES,aAAc,CAAC;EAC3B,MAAMM,oBAAoB,GAAGf,SAAS,CAAIgB,MAAM,IAAM;IACrD,MAAM;MAAEC,kBAAkB;MAAEC;IAAmB,CAAC,GAC/CF,MAAM,CAAEV,WAAY,CAAC,CAACa,iBAAiB,CAAC,CAAC;IAC1C,OAAO,CAAEF,kBAAkB,IAAI,CAAEC,kBAAkB;EACpD,CAAC,EAAE,EAAG,CAAC;EAEP,MAAM;IACLE,gBAAgB;IAChBC,kBAAkB;IAClBC,mBAAmB;IACnBC,aAAa;IACbC,mBAAmB;IACnBC;EACD,CAAC,GAAGxB,WAAW,CAAEQ,aAAc,CAAC;EAChC,MAAM;IAAEiB;EAAiB,CAAC,GAAGzB,WAAW,CAAEG,sBAAuB,CAAC;EAElE,MAAM;IAAEuB;EAAc,CAAC,GAAG1B,WAAW,CAAEM,gBA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ACb,CACD,CAAC;EAEDb,WAAW,CAAE,kCAAkC,EAAE,MAAM;IACtDqB,aAAa,CAAE,gBAAiB,CAAC;EAClC,CAAE,CAAC;EAEHrB,WAAW,CAAE,wCAAwC,EAAE,MAAM;IAC5DuB,qBAAqB,CAAC,CAAC;EACxB,CAAE,CAAC;EAEHvB,WAAW,CAAE,+BAA+B,EAAI8B,KAAK,IAAM;IAC1D;IACA;IACAA,KAAK,CAACE,cAAc,CAAC,CAAC;IAEtB,IAAKrB,qBAAqB,CAAC,CAAC,EAAG;MAC9BS,mBAAmB,CAAC,CAAC;IACtB,CAAC,MAAM;MACN,MAAM6B,aAAa,GAAGxC,sBAAsB,CAAC,CAAC,GAC3C,iBAAiB,GACjB,oBAAoB;MACvBU,kBAAkB,CAAE8B,aAAc,CAAC;IACpC;EACD,CAAE,CAAC;;EAEH;EACAjD,WAAW,CAAE,iCAAiC,EAAI8B,KAAK,IAAM;IAC5D,IAAK,CAAElB,gBAAgB,CAAC,CAAC,EAAG;MAC3BkB,KAAK,CAACE,cAAc,CAAC,CAAC;MACtBV,mBAAmB,CAAE,IAAK,CAAC;IAC5B;EACD,CAAE,CAAC;EAEHtB,WAAW,CAAE,+CAA+C,EAAI8B,KAAK,IACpED,uBAAuB,CAAEC,KAAK,EAAE,CAAE,CACnC,CAAC;EAED,CAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAE,CAACiB,OAAO,CAAIhB,KAAK,IAAM;IAC1C;IACA;IACA;IACA/B,WAAW,CACT,iDAAiD+B,KAAO,EAAC,EACxDD,KAAK,IAAMD,uBAAuB,CAAEC,KAAK,EAAEC,KAAM,CACpD,CAAC;EACF,CAAE,CAAC;EAEH,OAAO,IAAI;AACZ;AAEA,eAAevB,iBAAiB"}
|
|
1
|
+
{"version":3,"names":["useEffect","useSelect","useDispatch","useShortcut","store","keyboardShortcutsStore","__","editorStore","blockEditorStore","createBlock","editPostStore","KeyboardShortcuts","getEditorMode","isEditorSidebarOpened","isListViewOpened","isModeToggleDisabled","select","richEditingEnabled","codeEditingEnabled","getEditorSettings","switchEditorMode","openGeneralSidebar","closeGeneralSidebar","toggleFeature","setIsListViewOpened","toggleDistractionFree","registerShortcut","replaceBlocks","getBlockName","getSelectedBlockClientId","getBlockAttributes","getBlockSelectionStart","handleTextLevelShortcut","event","level","preventDefault","destinationBlockName","currentClientId","blockName","attributes","textAlign","destinationTextAlign","content","name","category","description","keyCombination","modifier","character","aliases","forEach","isDisabled","sidebarToOpen"],"sources":["@wordpress/edit-post/src/components/keyboard-shortcuts/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction KeyboardShortcuts() {\n\tconst { getEditorMode, isEditorSidebarOpened, isListViewOpened } =\n\t\tuseSelect( editPostStore );\n\tconst isModeToggleDisabled = useSelect( ( select ) => {\n\t\tconst { richEditingEnabled, codeEditingEnabled } =\n\t\t\tselect( editorStore ).getEditorSettings();\n\t\treturn ! richEditingEnabled || ! codeEditingEnabled;\n\t}, [] );\n\n\tconst {\n\t\tswitchEditorMode,\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\ttoggleFeature,\n\t\tsetIsListViewOpened,\n\t\ttoggleDistractionFree,\n\t} = useDispatch( editPostStore );\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst {\n\t\tgetBlockName,\n\t\tgetSelectedBlockClientId,\n\t\tgetBlockAttributes,\n\t\tgetBlockSelectionStart,\n\t} = useSelect( blockEditorStore );\n\n\tconst handleTextLevelShortcut = ( event, level ) => {\n\t\tevent.preventDefault();\n\t\tconst destinationBlockName =\n\t\t\tlevel === 0 ? 'core/paragraph' : 'core/heading';\n\t\tconst currentClientId = getSelectedBlockClientId();\n\t\tif ( currentClientId === null ) {\n\t\t\treturn;\n\t\t}\n\t\tconst blockName = getBlockName( currentClientId );\n\t\tif ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {\n\t\t\treturn;\n\t\t}\n\t\tconst attributes = getBlockAttributes( currentClientId );\n\t\tconst textAlign =\n\t\t\tblockName === 'core/paragraph' ? 'align' : 'textAlign';\n\t\tconst destinationTextAlign =\n\t\t\tdestinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';\n\n\t\treplaceBlocks(\n\t\t\tcurrentClientId,\n\t\t\tcreateBlock( destinationBlockName, {\n\t\t\t\tlevel,\n\t\t\t\tcontent: attributes.content,\n\t\t\t\t...{ [ destinationTextAlign ]: attributes[ textAlign ] },\n\t\t\t} )\n\t\t);\n\t};\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-mode',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Switch between visual editor and code editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'm',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-distraction-free',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Toggle distraction free mode.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: '\\\\',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-fullscreen',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Toggle fullscreen mode.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'f',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-list-view',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Open the block list view.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'o',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-sidebar',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Show or hide the Settings sidebar.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: ',',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/next-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the next part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrl',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'n',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/previous-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the previous part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrlShift',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'p',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'ctrlShift',\n\t\t\t\t\tcharacter: '~',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/keyboard-shortcuts',\n\t\t\tcategory: 'main',\n\t\t\tdescription: __( 'Display these keyboard shortcuts.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'h',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/transform-heading-to-paragraph',\n\t\t\tcategory: 'block-library',\n\t\t\tdescription: __( 'Transform heading to paragraph.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: `0`,\n\t\t\t},\n\t\t} );\n\n\t\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t\tregisterShortcut( {\n\t\t\t\tname: `core/edit-post/transform-paragraph-to-heading-${ level }`,\n\t\t\t\tcategory: 'block-library',\n\t\t\t\tdescription: __( 'Transform paragraph to heading.' ),\n\t\t\t\tkeyCombination: {\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: `${ level }`,\n\t\t\t\t},\n\t\t\t} );\n\t\t} );\n\t}, [] );\n\n\tuseShortcut(\n\t\t'core/edit-post/toggle-mode',\n\t\t() => {\n\t\t\tswitchEditorMode(\n\t\t\t\tgetEditorMode() === 'visual' ? 'text' : 'visual'\n\t\t\t);\n\t\t},\n\t\t{\n\t\t\tisDisabled: isModeToggleDisabled,\n\t\t}\n\t);\n\n\tuseShortcut( 'core/edit-post/toggle-fullscreen', () => {\n\t\ttoggleFeature( 'fullscreenMode' );\n\t} );\n\n\tuseShortcut( 'core/edit-post/toggle-distraction-free', () => {\n\t\ttoggleDistractionFree();\n\t} );\n\n\tuseShortcut( 'core/edit-post/toggle-sidebar', ( event ) => {\n\t\t// This shortcut has no known clashes, but use preventDefault to prevent any\n\t\t// obscure shortcuts from triggering.\n\t\tevent.preventDefault();\n\n\t\tif ( isEditorSidebarOpened() ) {\n\t\t\tcloseGeneralSidebar();\n\t\t} else {\n\t\t\tconst sidebarToOpen = getBlockSelectionStart()\n\t\t\t\t? 'edit-post/block'\n\t\t\t\t: 'edit-post/document';\n\t\t\topenGeneralSidebar( sidebarToOpen );\n\t\t}\n\t} );\n\n\t// Only opens the list view. Other functionality for this shortcut happens in the rendered sidebar.\n\tuseShortcut( 'core/edit-post/toggle-list-view', ( event ) => {\n\t\tif ( ! isListViewOpened() ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsListViewOpened( true );\n\t\t}\n\t} );\n\n\tuseShortcut( 'core/edit-post/transform-heading-to-paragraph', ( event ) =>\n\t\thandleTextLevelShortcut( event, 0 )\n\t);\n\n\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t//the loop is based off on a constant therefore\n\t\t//the hook will execute the same way every time\n\t\t//eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseShortcut(\n\t\t\t`core/edit-post/transform-paragraph-to-heading-${ level }`,\n\t\t\t( event ) => handleTextLevelShortcut( event, level )\n\t\t);\n\t} );\n\n\treturn null;\n}\n\nexport default KeyboardShortcuts;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,WAAW,EACXC,KAAK,IAAIC,sBAAsB,QACzB,+BAA+B;AACtC,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASF,KAAK,IAAIG,WAAW,QAAQ,mBAAmB;AACxD,SAASH,KAAK,IAAII,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,WAAW,QAAQ,mBAAmB;;AAE/C;AACA;AACA;AACA,SAASL,KAAK,IAAIM,aAAa,QAAQ,aAAa;AAEpD,SAASC,iBAAiBA,CAAA,EAAG;EAC5B,MAAM;IAAEC,aAAa;IAAEC,qBAAqB;IAAEC;EAAiB,CAAC,GAC/Db,SAAS,CAAES,aAAc,CAAC;EAC3B,MAAMK,oBAAoB,GAAGd,SAAS,CAAIe,MAAM,IAAM;IACrD,MAAM;MAAEC,kBAAkB;MAAEC;IAAmB,CAAC,GAC/CF,MAAM,CAAET,WAAY,CAAC,CAACY,iBAAiB,CAAC,CAAC;I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AAC,EAAE,CAAC,CAAE,CAACiB,OAAO,CAAIhB,KAAK,IAAM;IAC1C;IACA;IACA;IACA/B,WAAW,CACT,iDAAiD+B,KAAO,EAAC,EACxDD,KAAK,IAAMD,uBAAuB,CAAEC,KAAK,EAAEC,KAAM,CACpD,CAAC;EACF,CAAE,CAAC;EAEH,OAAO,IAAI;AACZ;AAEA,eAAevB,iBAAiB"}
|
|
@@ -20,6 +20,7 @@ export default function PostSchedule() {
|
|
|
20
20
|
ref: setPopoverAnchor
|
|
21
21
|
}, createElement("span", null, __('Publish')), createElement(Dropdown, {
|
|
22
22
|
popoverProps: popoverProps,
|
|
23
|
+
className: "edit-post-post-schedule__dropdown",
|
|
23
24
|
contentClassName: "edit-post-post-schedule__dialog",
|
|
24
25
|
focusOnMount: true,
|
|
25
26
|
renderToggle: ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","sprintf","PanelRow","Dropdown","Button","useState","useMemo","PostSchedule","PostScheduleForm","PostScheduleCheck","usePostScheduleLabel","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","createElement","className","ref","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostScheduleToggle","onClick","renderContent","onClose","label","fullLabel","full","variant","showTooltip"],"sources":["@wordpress/edit-post/src/components/sidebar/post-schedule/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PanelRow, Dropdown, Button } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport {\n\tPostSchedule as PostScheduleForm,\n\tPostScheduleCheck,\n\tusePostScheduleLabel,\n} from '@wordpress/editor';\n\nexport default function PostSchedule() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( { anchor: popoverAnchor, placement: 'bottom-end' } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostScheduleCheck>\n\t\t\t<PanelRow\n\t\t\t\tclassName=\"edit-post-post-schedule\"\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t>\n\t\t\t\t<span>{ __( 'Publish' ) }</span>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tcontentClassName=\"edit-post-post-schedule__dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostScheduleToggle\n\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<PostScheduleForm onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</PostScheduleCheck>\n\t);\n}\n\nfunction PostScheduleToggle( { isOpen, onClick } ) {\n\tconst label = usePostScheduleLabel();\n\tconst fullLabel = usePostScheduleLabel( { full: true } );\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-post-post-schedule__toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\tlabel={ fullLabel }\n\t\t\tshowTooltip\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post date.\n\t\t\taria-label={ sprintf( __( 'Change date: %s' ), label ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AAClE,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SACCC,YAAY,IAAIC,gBAAgB,EAChCC,iBAAiB,EACjBC,oBAAoB,QACd,mBAAmB;AAE1B,eAAe,SAASH,YAAYA,CAAA,EAAG;EACtC;EACA;EACA,MAAM,CAAEI,aAAa,EAAEC,gBAAgB,CAAE,GAAGP,QAAQ,CAAE,IAAK,CAAC;EAC5D;EACA,MAAMQ,YAAY,GAAGP,OAAO,CAC3B,OAAQ;IAAEQ,MAAM,EAAEH,aAAa;IAAEI,SAAS,EAAE;EAAa,CAAC,CAAE,EAC5D,CAAEJ,aAAa,CAChB,CAAC;EAED,OACCK,aAAA,CAACP,iBAAiB,QACjBO,aAAA,CAACd,QAAQ;IACRe,SAAS,EAAC,yBAAyB;IACnCC,GAAG,EAAGN;EAAkB,GAExBI,aAAA,eAAQhB,EAAE,CAAE,SAAU,CAAS,CAAC,EAChCgB,aAAA,CAACb,QAAQ;IACRU,YAAY,EAAGA,YAAc;
|
|
1
|
+
{"version":3,"names":["__","sprintf","PanelRow","Dropdown","Button","useState","useMemo","PostSchedule","PostScheduleForm","PostScheduleCheck","usePostScheduleLabel","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","createElement","className","ref","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostScheduleToggle","onClick","renderContent","onClose","label","fullLabel","full","variant","showTooltip"],"sources":["@wordpress/edit-post/src/components/sidebar/post-schedule/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PanelRow, Dropdown, Button } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport {\n\tPostSchedule as PostScheduleForm,\n\tPostScheduleCheck,\n\tusePostScheduleLabel,\n} from '@wordpress/editor';\n\nexport default function PostSchedule() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( { anchor: popoverAnchor, placement: 'bottom-end' } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostScheduleCheck>\n\t\t\t<PanelRow\n\t\t\t\tclassName=\"edit-post-post-schedule\"\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t>\n\t\t\t\t<span>{ __( 'Publish' ) }</span>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"edit-post-post-schedule__dropdown\"\n\t\t\t\t\tcontentClassName=\"edit-post-post-schedule__dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostScheduleToggle\n\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<PostScheduleForm onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</PostScheduleCheck>\n\t);\n}\n\nfunction PostScheduleToggle( { isOpen, onClick } ) {\n\tconst label = usePostScheduleLabel();\n\tconst fullLabel = usePostScheduleLabel( { full: true } );\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-post-post-schedule__toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\tlabel={ fullLabel }\n\t\t\tshowTooltip\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post date.\n\t\t\taria-label={ sprintf( __( 'Change date: %s' ), label ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AAClE,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SACCC,YAAY,IAAIC,gBA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AAW;IACX,iBAAgBV;IAChB;IAAA;IACA,cAAarB,OAAO,CAAED,EAAE,CAAE,iBAAkB,CAAC,EAAE4B,KAAM,CAAG;IACxDH,OAAO,EAAGA;EAAS,GAEjBG,KACK,CAAC;AAEX"}
|
|
@@ -5,7 +5,7 @@ import { createElement, Fragment } from "react";
|
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
import { __experimentalHStack as HStack, PanelBody } from '@wordpress/components';
|
|
7
7
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
|
-
import { PostSwitchToDraftButton, PostSyncStatus } from '@wordpress/editor';
|
|
8
|
+
import { PostSwitchToDraftButton, PostSyncStatus, PostURLPanel } from '@wordpress/editor';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
@@ -21,7 +21,6 @@ import PostPendingStatus from '../post-pending-status';
|
|
|
21
21
|
import PluginPostStatusInfo from '../plugin-post-status-info';
|
|
22
22
|
import { store as editPostStore } from '../../../store';
|
|
23
23
|
import PostTemplate from '../post-template';
|
|
24
|
-
import PostURL from '../post-url';
|
|
25
24
|
|
|
26
25
|
/**
|
|
27
26
|
* Module Constants
|
|
@@ -54,7 +53,7 @@ export default function PostStatus() {
|
|
|
54
53
|
title: __('Summary'),
|
|
55
54
|
opened: isOpened,
|
|
56
55
|
onToggle: () => toggleEditorPanelOpened(PANEL_NAME)
|
|
57
|
-
}, createElement(PluginPostStatusInfo.Slot, null, fills => createElement(Fragment, null, createElement(PostVisibility, null), createElement(PostSchedule, null), createElement(PostTemplate, null), createElement(
|
|
56
|
+
}, createElement(PluginPostStatusInfo.Slot, null, fills => createElement(Fragment, null, createElement(PostVisibility, null), createElement(PostSchedule, null), createElement(PostTemplate, null), createElement(PostURLPanel, null), createElement(PostSticky, null), createElement(PostPendingStatus, null), createElement(PostFormat, null), createElement(PostSlug, null), createElement(PostAuthor, null), createElement(PostSyncStatus, null), fills, createElement(HStack, {
|
|
58
57
|
style: {
|
|
59
58
|
marginTop: '16px'
|
|
60
59
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","__experimentalHStack","HStack","PanelBody","useDispatch","useSelect","PostSwitchToDraftButton","PostSyncStatus","PostVisibility","PostTrash","PostSchedule","PostSticky","PostAuthor","PostSlug","PostFormat","PostPendingStatus","PluginPostStatusInfo","store","editPostStore","PostTemplate","
|
|
1
|
+
{"version":3,"names":["__","__experimentalHStack","HStack","PanelBody","useDispatch","useSelect","PostSwitchToDraftButton","PostSyncStatus","PostURLPanel","PostVisibility","PostTrash","PostSchedule","PostSticky","PostAuthor","PostSlug","PostFormat","PostPendingStatus","PluginPostStatusInfo","store","editPostStore","PostTemplate","PANEL_NAME","PostStatus","isOpened","isRemoved","select","isEditorPanelRemoved","isEditorPanelOpened","toggleEditorPanelOpened","createElement","className","title","opened","onToggle","Slot","fills","Fragment","style","marginTop","spacing","wrap"],"sources":["@wordpress/edit-post/src/components/sidebar/post-status/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalHStack as HStack,\n\tPanelBody,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tPostSwitchToDraftButton,\n\tPostSyncStatus,\n\tPostURLPanel,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport PostVisibility from '../post-visibility';\nimport PostTrash from '../post-trash';\nimport PostSchedule from '../post-schedule';\nimport PostSticky from '../post-sticky';\nimport PostAuthor from '../post-author';\nimport PostSlug from '../post-slug';\nimport PostFormat from '../post-format';\nimport PostPendingStatus from '../post-pending-status';\nimport PluginPostStatusInfo from '../plugin-post-status-info';\nimport { store as editPostStore } from '../../../store';\nimport PostTemplate from '../post-template';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'post-status';\n\nexport default function PostStatus() {\n\tconst { isOpened, isRemoved } = useSelect( ( select ) => {\n\t\t// We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do\n\t\t// not use isEditorPanelEnabled since this panel should not be disabled through the UI.\n\t\tconst { isEditorPanelRemoved, isEditorPanelOpened } =\n\t\t\tselect( editPostStore );\n\t\treturn {\n\t\t\tisRemoved: isEditorPanelRemoved( PANEL_NAME ),\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t};\n\t}, [] );\n\tconst { toggleEditorPanelOpened } = useDispatch( editPostStore );\n\n\tif ( isRemoved ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody\n\t\t\tclassName=\"edit-post-post-status\"\n\t\t\ttitle={ __( 'Summary' ) }\n\t\t\topened={ isOpened }\n\t\t\tonToggle={ () => toggleEditorPanelOpened( PANEL_NAME ) }\n\t\t>\n\t\t\t<PluginPostStatusInfo.Slot>\n\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PostVisibility />\n\t\t\t\t\t\t<PostSchedule />\n\t\t\t\t\t\t<PostTemplate />\n\t\t\t\t\t\t<PostURLPanel />\n\t\t\t\t\t\t<PostSticky />\n\t\t\t\t\t\t<PostPendingStatus />\n\t\t\t\t\t\t<PostFormat />\n\t\t\t\t\t\t<PostSlug />\n\t\t\t\t\t\t<PostAuthor />\n\t\t\t\t\t\t<PostSyncStatus />\n\t\t\t\t\t\t{ fills }\n\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tmarginTop: '16px',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\t\t\twrap\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PostSwitchToDraftButton />\n\t\t\t\t\t\t\t<PostTrash />\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</PluginPostStatusInfo.Slot>\n\t\t</PanelBody>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AAC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