@wordpress/edit-post 6.16.0 → 6.18.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/build/components/block-manager/category.js +2 -2
- package/build/components/block-manager/category.js.map +1 -1
- package/build/components/block-manager/index.js +1 -1
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/device-preview/index.js +3 -0
- package/build/components/device-preview/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.js +0 -6
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/index.js +52 -8
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js +49 -1
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -7
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +41 -2
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +9 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +27 -8
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal/options/enable-feature.js +6 -2
- package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-outline.js +119 -0
- package/build/components/secondary-sidebar/list-view-outline.js.map +1 -0
- package/build/components/secondary-sidebar/list-view-sidebar.js +36 -11
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/visual-editor/index.js +4 -1
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/editor.js +5 -5
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +1 -1
- package/build/editor.native.js.map +1 -1
- package/build/store/actions.js +23 -34
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +30 -9
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/block-manager/category.js +3 -3
- package/build-module/components/block-manager/category.js.map +1 -1
- package/build-module/components/block-manager/index.js +2 -2
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/device-preview/index.js +3 -0
- package/build-module/components/device-preview/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.js +1 -7
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/index.js +51 -8
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js +47 -2
- package/build-module/components/header/writing-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -6
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +39 -2
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +10 -9
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +26 -8
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-feature.js +6 -2
- package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-outline.js +108 -0
- package/build-module/components/secondary-sidebar/list-view-outline.js.map +1 -0
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +34 -12
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/visual-editor/index.js +3 -1
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/editor.js +6 -6
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +2 -2
- package/build-module/editor.native.js.map +1 -1
- package/build-module/store/actions.js +22 -32
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +31 -8
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +92 -6
- package/build-style/style.css +92 -6
- package/package.json +27 -27
- package/src/components/block-manager/category.js +4 -5
- package/src/components/block-manager/index.js +2 -2
- package/src/components/device-preview/index.js +2 -0
- package/src/components/editor-initialization/test/listener-hooks.js +47 -49
- package/src/components/header/fullscreen-mode-close/test/__snapshots__/index.js.snap +26 -0
- package/src/components/header/fullscreen-mode-close/test/index.js +10 -12
- package/src/components/header/header-toolbar/index.js +0 -8
- package/src/components/header/index.js +33 -11
- package/src/components/header/style.scss +43 -0
- package/src/components/header/writing-menu/index.js +53 -2
- package/src/components/keyboard-shortcut-help-modal/shortcut.js +15 -18
- package/src/components/keyboard-shortcuts/index.js +46 -2
- package/src/components/layout/index.js +10 -7
- package/src/components/layout/style.scss +7 -0
- package/src/components/preferences-modal/index.js +35 -19
- package/src/components/preferences-modal/options/enable-feature.js +5 -2
- package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap +128 -132
- package/src/components/preferences-modal/options/test/enable-custom-fields.js +35 -30
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +9 -9
- package/src/components/preferences-modal/test/index.js +3 -3
- package/src/components/secondary-sidebar/list-view-outline.js +98 -0
- package/src/components/secondary-sidebar/list-view-sidebar.js +47 -8
- package/src/components/secondary-sidebar/style.scss +64 -8
- package/src/components/sidebar/plugin-post-status-info/test/__snapshots__/index.js.snap +6 -4
- package/src/components/sidebar/plugin-post-status-info/test/index.js +4 -4
- package/src/components/visual-editor/index.js +9 -3
- package/src/editor.js +7 -8
- package/src/editor.native.js +3 -4
- package/src/store/actions.js +17 -23
- package/src/store/reducer.js +29 -9
- package/src/store/test/reducer.js +32 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/index.js"],"names":["classnames","PostSavedState","PostPreviewButton","useSelect","PinnedItems","useViewportMatch","FullscreenModeClose","HeaderToolbar","MoreMenu","PostPublishButtonOrToggle","default","DevicePreview","MainDashboardButton","store","editPostStore","TemplateTitle","Header","setEntitiesSavedStatesCallback","hasActiveMetaboxes","isPublishSidebarOpened","isSaving","showIconLabels","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/index.js"],"names":["classnames","PostSavedState","PostPreviewButton","useSelect","PinnedItems","useViewportMatch","__unstableMotion","motion","FullscreenModeClose","HeaderToolbar","MoreMenu","PostPublishButtonOrToggle","default","DevicePreview","MainDashboardButton","store","editPostStore","TemplateTitle","Header","setEntitiesSavedStatesCallback","hasActiveMetaboxes","isPublishSidebarOpened","isSaving","showIconLabels","isDistractionFree","select","hasMetaBoxes","isSavingMetaBoxes","isFeatureActive","isLargeViewport","classes","slideY","hidden","y","hover","transition","type","delay","slideX","x","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,cAAT,EAAyBC,iBAAzB,QAAkD,mBAAlD;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,WAAT,QAA4B,sBAA5B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,gBAAgB,IAAIC,MAA7B,QAA2C,uBAA3C;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AACA,OAAOC,QAAP,MAAqB,aAArB;AACA,OAAOC,yBAAP,MAAsC,iCAAtC;AACA,SAASC,OAAO,IAAIC,aAApB,QAAyC,mBAAzC;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,kBAA1B;;AAEA,SAASC,MAAT,OAAsD;AAAA,MAArC;AAAEC,IAAAA;AAAF,GAAqC;AACrD,QAAM;AACLC,IAAAA,kBADK;AAELC,IAAAA,sBAFK;AAGLC,IAAAA,QAHK;AAILC,IAAAA,cAJK;AAKLC,IAAAA;AALK,MAMFrB,SAAS,CACVsB,MAAF,KAAgB;AACfL,IAAAA,kBAAkB,EAAEK,MAAM,CAAET,aAAF,CAAN,CAAwBU,YAAxB,EADL;AAEfL,IAAAA,sBAAsB,EACrBI,MAAM,CAAET,aAAF,CAAN,CAAwBK,sBAAxB,EAH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;AAA3B,IApCF,CAjBD,CADD;AA2DA;;AAED,eAAeL,MAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { PostSavedState, PostPreviewButton } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport FullscreenModeClose from './fullscreen-mode-close';\nimport HeaderToolbar from './header-toolbar';\nimport MoreMenu from './more-menu';\nimport PostPublishButtonOrToggle from './post-publish-button-or-toggle';\nimport { default as DevicePreview } from '../device-preview';\nimport MainDashboardButton from './main-dashboard-button';\nimport { store as editPostStore } from '../../store';\nimport TemplateTitle from './template-title';\n\nfunction Header( { setEntitiesSavedStatesCallback } ) {\n\tconst {\n\t\thasActiveMetaboxes,\n\t\tisPublishSidebarOpened,\n\t\tisSaving,\n\t\tshowIconLabels,\n\t\tisDistractionFree,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\tisPublishSidebarOpened:\n\t\t\t\tselect( editPostStore ).isPublishSidebarOpened(),\n\t\t\tisSaving: select( editPostStore ).isSavingMetaBoxes(),\n\t\t\tshowIconLabels:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'showIconLabels' ),\n\t\t\tisDistractionFree:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'distractionFree' ),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\n\tconst classes = classnames( 'edit-post-header' );\n\n\tconst slideY = {\n\t\thidden: isDistractionFree ? { y: '-50' } : { y: 0 },\n\t\thover: { y: 0, transition: { type: 'tween', delay: 0.2 } },\n\t};\n\n\tconst slideX = {\n\t\thidden: isDistractionFree ? { x: '-100%' } : { x: 0 },\n\t\thover: { x: 0, transition: { type: 'tween', delay: 0.2 } },\n\t};\n\n\treturn (\n\t\t<div className={ classes }>\n\t\t\t<MainDashboardButton.Slot>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ slideX }\n\t\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\t>\n\t\t\t\t\t<FullscreenModeClose showTooltip />\n\t\t\t\t</motion.div>\n\t\t\t</MainDashboardButton.Slot>\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"edit-post-header__toolbar\"\n\t\t\t>\n\t\t\t\t<HeaderToolbar />\n\t\t\t\t<TemplateTitle />\n\t\t\t</motion.div>\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"edit-post-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! isPublishSidebarOpened && (\n\t\t\t\t\t// This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t// We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t// We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t// when the publish sidebar has been closed.\n\t\t\t\t\t<PostSavedState\n\t\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\t\t\t\tforceIsSaving={ isSaving }\n\t\t\t\t\t\tshowIconLabels={ showIconLabels }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<DevicePreview />\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tforceIsAutosaveable={ hasActiveMetaboxes }\n\t\t\t\t\tforcePreviewLink={ isSaving ? null : undefined }\n\t\t\t\t/>\n\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\t\t\tforceIsSaving={ isSaving }\n\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ ( isLargeViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-post\" />\n\t\t\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ showIconLabels && ! isLargeViewport && (\n\t\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"]}
|
|
@@ -3,13 +3,48 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
+
import { useSelect, useDispatch, useRegistry } from '@wordpress/data';
|
|
6
7
|
import { MenuGroup } from '@wordpress/components';
|
|
7
8
|
import { __, _x } from '@wordpress/i18n';
|
|
8
9
|
import { useViewportMatch } from '@wordpress/compose';
|
|
9
10
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
10
|
-
import { PreferenceToggleMenuItem } from '@wordpress/preferences';
|
|
11
|
+
import { PreferenceToggleMenuItem, store as preferencesStore } from '@wordpress/preferences';
|
|
12
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { store as postEditorStore } from '../../../store';
|
|
11
18
|
|
|
12
19
|
function WritingMenu() {
|
|
20
|
+
const registry = useRegistry();
|
|
21
|
+
const isDistractionFree = useSelect(select => select(blockEditorStore).getSettings().isDistractionFree, []);
|
|
22
|
+
const blocks = useSelect(select => select(blockEditorStore).getBlocks(), []);
|
|
23
|
+
const {
|
|
24
|
+
setIsInserterOpened,
|
|
25
|
+
setIsListViewOpened,
|
|
26
|
+
closeGeneralSidebar
|
|
27
|
+
} = useDispatch(postEditorStore);
|
|
28
|
+
const {
|
|
29
|
+
set: setPreference
|
|
30
|
+
} = useDispatch(preferencesStore);
|
|
31
|
+
const {
|
|
32
|
+
selectBlock
|
|
33
|
+
} = useDispatch(blockEditorStore);
|
|
34
|
+
|
|
35
|
+
const toggleDistractionFree = () => {
|
|
36
|
+
registry.batch(() => {
|
|
37
|
+
setPreference('core/edit-post', 'fixedToolbar', false);
|
|
38
|
+
setIsInserterOpened(false);
|
|
39
|
+
setIsListViewOpened(false);
|
|
40
|
+
closeGeneralSidebar();
|
|
41
|
+
|
|
42
|
+
if (!isDistractionFree && !!blocks.length) {
|
|
43
|
+
selectBlock(blocks[0].clientId);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
13
48
|
const isLargeViewport = useViewportMatch('medium');
|
|
14
49
|
|
|
15
50
|
if (!isLargeViewport) {
|
|
@@ -20,6 +55,7 @@ function WritingMenu() {
|
|
|
20
55
|
label: _x('View', 'noun')
|
|
21
56
|
}, createElement(PreferenceToggleMenuItem, {
|
|
22
57
|
scope: "core/edit-post",
|
|
58
|
+
disabled: isDistractionFree,
|
|
23
59
|
name: "fixedToolbar",
|
|
24
60
|
label: __('Top toolbar'),
|
|
25
61
|
info: __('Access all block and document tools in a single place'),
|
|
@@ -36,10 +72,19 @@ function WritingMenu() {
|
|
|
36
72
|
scope: "core/edit-post",
|
|
37
73
|
name: "fullscreenMode",
|
|
38
74
|
label: __('Fullscreen mode'),
|
|
39
|
-
info: __('
|
|
75
|
+
info: __('Show and hide admin UI'),
|
|
40
76
|
messageActivated: __('Fullscreen mode activated'),
|
|
41
77
|
messageDeactivated: __('Fullscreen mode deactivated'),
|
|
42
78
|
shortcut: displayShortcut.secondary('f')
|
|
79
|
+
}), createElement(PreferenceToggleMenuItem, {
|
|
80
|
+
scope: "core/edit-post",
|
|
81
|
+
name: "distractionFree",
|
|
82
|
+
onToggle: toggleDistractionFree,
|
|
83
|
+
label: __('Distraction free'),
|
|
84
|
+
info: __('Write with calmness'),
|
|
85
|
+
messageActivated: __('Distraction free mode activated'),
|
|
86
|
+
messageDeactivated: __('Distraction free mode deactivated'),
|
|
87
|
+
shortcut: displayShortcut.primaryShift('\\')
|
|
43
88
|
}));
|
|
44
89
|
}
|
|
45
90
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/writing-menu/index.js"],"names":["MenuGroup","__","_x","useViewportMatch","displayShortcut","PreferenceToggleMenuItem","WritingMenu","isLargeViewport","secondary"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,uBAA1B;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,eAAT,QAAgC,qBAAhC;AACA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/writing-menu/index.js"],"names":["useSelect","useDispatch","useRegistry","MenuGroup","__","_x","useViewportMatch","displayShortcut","PreferenceToggleMenuItem","store","preferencesStore","blockEditorStore","postEditorStore","WritingMenu","registry","isDistractionFree","select","getSettings","blocks","getBlocks","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","set","setPreference","selectBlock","toggleDistractionFree","batch","length","clientId","isLargeViewport","secondary","primaryShift"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,EAAiCC,WAAjC,QAAoD,iBAApD;AACA,SAASC,SAAT,QAA0B,uBAA1B;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,eAAT,QAAgC,qBAAhC;AACA,SACCC,wBADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,wBAHP;AAIA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,SAASF,KAAK,IAAIG,eAAlB,QAA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CANtB;AAOC,IAAA,kBAAkB,EAAGA,EAAE,CAAE,mCAAF,CAPxB;AAQC,IAAA,QAAQ,EAAGG,eAAe,CAACyB,YAAhB,CAA8B,IAA9B;AARZ,IA7BD,CADD;AA0CA;;AAED,eAAenB,WAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch, useRegistry } from '@wordpress/data';\nimport { MenuGroup } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport {\n\tPreferenceToggleMenuItem,\n\tstore as preferencesStore,\n} from '@wordpress/preferences';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as postEditorStore } from '../../../store';\n\nfunction WritingMenu() {\n\tconst registry = useRegistry();\n\tconst isDistractionFree = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().isDistractionFree,\n\t\t[]\n\t);\n\n\tconst blocks = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlocks(),\n\t\t[]\n\t);\n\n\tconst { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } =\n\t\tuseDispatch( postEditorStore );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst toggleDistractionFree = () => {\n\t\tregistry.batch( () => {\n\t\t\tsetPreference( 'core/edit-post', 'fixedToolbar', false );\n\t\t\tsetIsInserterOpened( false );\n\t\t\tsetIsListViewOpened( false );\n\t\t\tcloseGeneralSidebar();\n\t\t\tif ( ! isDistractionFree && !! blocks.length ) {\n\t\t\t\tselectBlock( blocks[ 0 ].clientId );\n\t\t\t}\n\t\t} );\n\t};\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tif ( ! isLargeViewport ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t<PreferenceToggleMenuItem\n\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\tdisabled={ isDistractionFree }\n\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\tinfo={ __(\n\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t) }\n\t\t\t\tmessageActivated={ __( 'Top toolbar activated' ) }\n\t\t\t\tmessageDeactivated={ __( 'Top toolbar deactivated' ) }\n\t\t\t/>\n\t\t\t<PreferenceToggleMenuItem\n\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\tname=\"focusMode\"\n\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\tinfo={ __( 'Focus on one block at a time' ) }\n\t\t\t\tmessageActivated={ __( 'Spotlight mode activated' ) }\n\t\t\t\tmessageDeactivated={ __( 'Spotlight mode deactivated' ) }\n\t\t\t/>\n\t\t\t<PreferenceToggleMenuItem\n\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\tname=\"fullscreenMode\"\n\t\t\t\tlabel={ __( 'Fullscreen mode' ) }\n\t\t\t\tinfo={ __( 'Show and hide admin UI' ) }\n\t\t\t\tmessageActivated={ __( 'Fullscreen mode activated' ) }\n\t\t\t\tmessageDeactivated={ __( 'Fullscreen mode deactivated' ) }\n\t\t\t\tshortcut={ displayShortcut.secondary( 'f' ) }\n\t\t\t/>\n\t\t\t<PreferenceToggleMenuItem\n\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\tname=\"distractionFree\"\n\t\t\t\tonToggle={ toggleDistractionFree }\n\t\t\t\tlabel={ __( 'Distraction free' ) }\n\t\t\t\tinfo={ __( 'Write with calmness' ) }\n\t\t\t\tmessageActivated={ __( 'Distraction free mode activated' ) }\n\t\t\t\tmessageDeactivated={ __( 'Distraction free mode deactivated' ) }\n\t\t\t\tshortcut={ displayShortcut.primaryShift( '\\\\' ) }\n\t\t\t/>\n\t\t</MenuGroup>\n\t);\n}\n\nexport default WritingMenu;\n"]}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { castArray } from 'lodash';
|
|
7
3
|
/**
|
|
8
4
|
* WordPress dependencies
|
|
9
5
|
*/
|
|
10
|
-
|
|
11
6
|
import { Fragment } from '@wordpress/element';
|
|
12
7
|
import { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';
|
|
13
8
|
|
|
@@ -21,7 +16,7 @@ function KeyCombination(_ref) {
|
|
|
21
16
|
return createElement("kbd", {
|
|
22
17
|
className: "edit-post-keyboard-shortcut-help-modal__shortcut-key-combination",
|
|
23
18
|
"aria-label": forceAriaLabel || ariaLabel
|
|
24
|
-
},
|
|
19
|
+
}, (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => {
|
|
25
20
|
if (character === '+') {
|
|
26
21
|
return createElement(Fragment, {
|
|
27
22
|
key: index
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/keyboard-shortcut-help-modal/shortcut.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/keyboard-shortcut-help-modal/shortcut.js"],"names":["Fragment","displayShortcutList","shortcutAriaLabel","KeyCombination","keyCombination","forceAriaLabel","shortcut","modifier","character","ariaLabel","Array","isArray","map","index","Shortcut","description","aliases","alias"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;AACA,SAASC,mBAAT,EAA8BC,iBAA9B,QAAuD,qBAAvD;;AAEA,SAASC,cAAT,OAA8D;AAAA,MAArC;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,GAAqC;AAC7D,QAAMC,QAAQ,GAAGF,cAAc,CAACG,QAAf,GACdN,mBAAmB,CAAEG,cAAc,CAACG,QAAjB,CAAnB,CACAH,cAAc,CAACI,SADf,CADc,GAIdJ,cAAc,CAACI,SAJlB;AAKA,QAAMC,SAAS,GAAGL,cAAc,CAACG,QAAf,GACfL,iBAAiB,CAAEE,cAAc,CAACG,QAAjB,CAAjB,CACAH,cAAc,CAACI,SADf,CADe,GAIfJ,cAAc,CAACI,SAJlB;AAMA,SACC;AACC,IAAA,SAAS,EAAC,kEADX;AAEC,kBAAaH,cAAc,IAAII;AAFhC,KAIG,CAAEC,KAAK,CAACC,OAAN,CAAeL,QAAf,IAA4BA,QAA5B,GAAuC,CAAEA,QAAF,CAAzC,EAAwDM,GAAxD,CACD,CAAEJ,SAAF,EAAaK,KAAb,KAAwB;AACvB,QAAKL,SAAS,KAAK,GAAnB,EAAyB;AACxB,aAAO,cAAC,QAAD;AAAU,QAAA,GAAG,EAAGK;AAAhB,SAA0BL,SAA1B,CAAP;AACA;;AAED,WACC;AACC,MAAA,GAAG,EAAGK,KADP;AAEC,MAAA,SAAS,EAAC;AAFX,OAIGL,SAJH,CADD;AAQA,GAdA,CAJH,CADD;AAuBA;;AAED,SAASM,QAAT,QAA8E;AAAA,MAA3D;AAAEC,IAAAA,WAAF;AAAeX,IAAAA,cAAf;AAA+BY,IAAAA,OAAO,GAAG,EAAzC;AAA6CP,IAAAA;AAA7C,GAA2D;AAC7E,SACC,8BACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGM,WADH,CADD,EAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,cAAD;AACC,IAAA,cAAc,EAAGX,cADlB;AAEC,IAAA,cAAc,EAAGK;AAFlB,IADD,EAKGO,OAAO,CAACJ,GAAR,CAAa,CAAEK,KAAF,EAASJ,KAAT,KACd,cAAC,cAAD;AACC,IAAA,cAAc,EAAGI,KADlB;AAEC,IAAA,cAAc,EAAGR,SAFlB;AAGC,IAAA,GAAG,EAAGI;AAHP,IADC,CALH,CAJD,CADD;AAoBA;;AAED,eAAeC,QAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';\n\nfunction KeyCombination( { keyCombination, forceAriaLabel } ) {\n\tconst shortcut = keyCombination.modifier\n\t\t? displayShortcutList[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t )\n\t\t: keyCombination.character;\n\tconst ariaLabel = keyCombination.modifier\n\t\t? shortcutAriaLabel[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t )\n\t\t: keyCombination.character;\n\n\treturn (\n\t\t<kbd\n\t\t\tclassName=\"edit-post-keyboard-shortcut-help-modal__shortcut-key-combination\"\n\t\t\taria-label={ forceAriaLabel || ariaLabel }\n\t\t>\n\t\t\t{ ( Array.isArray( shortcut ) ? shortcut : [ shortcut ] ).map(\n\t\t\t\t( character, index ) => {\n\t\t\t\t\tif ( character === '+' ) {\n\t\t\t\t\t\treturn <Fragment key={ index }>{ character }</Fragment>;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<kbd\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tclassName=\"edit-post-keyboard-shortcut-help-modal__shortcut-key\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ character }\n\t\t\t\t\t\t</kbd>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t) }\n\t\t</kbd>\n\t);\n}\n\nfunction Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-post-keyboard-shortcut-help-modal__shortcut-description\">\n\t\t\t\t{ description }\n\t\t\t</div>\n\t\t\t<div className=\"edit-post-keyboard-shortcut-help-modal__shortcut-term\">\n\t\t\t\t<KeyCombination\n\t\t\t\t\tkeyCombination={ keyCombination }\n\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t/>\n\t\t\t\t{ aliases.map( ( alias, index ) => (\n\t\t\t\t\t<KeyCombination\n\t\t\t\t\t\tkeyCombination={ alias }\n\t\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Shortcut;\n"]}
|
|
@@ -7,6 +7,8 @@ import { useShortcut, store as keyboardShortcutsStore } from '@wordpress/keyboar
|
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
8
|
import { store as editorStore } from '@wordpress/editor';
|
|
9
9
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
10
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
11
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
10
12
|
/**
|
|
11
13
|
* Internal dependencies
|
|
12
14
|
*/
|
|
@@ -20,7 +22,8 @@ function KeyboardShortcuts() {
|
|
|
20
22
|
const {
|
|
21
23
|
getEditorMode,
|
|
22
24
|
isEditorSidebarOpened,
|
|
23
|
-
isListViewOpened
|
|
25
|
+
isListViewOpened,
|
|
26
|
+
isFeatureActive
|
|
24
27
|
} = useSelect(editPostStore);
|
|
25
28
|
const isModeToggleDisabled = useSelect(select => {
|
|
26
29
|
const {
|
|
@@ -29,16 +32,31 @@ function KeyboardShortcuts() {
|
|
|
29
32
|
} = select(editorStore).getEditorSettings();
|
|
30
33
|
return !richEditingEnabled || !codeEditingEnabled;
|
|
31
34
|
}, []);
|
|
35
|
+
const {
|
|
36
|
+
createInfoNotice
|
|
37
|
+
} = useDispatch(noticesStore);
|
|
32
38
|
const {
|
|
33
39
|
switchEditorMode,
|
|
34
40
|
openGeneralSidebar,
|
|
35
41
|
closeGeneralSidebar,
|
|
36
42
|
toggleFeature,
|
|
37
|
-
setIsListViewOpened
|
|
43
|
+
setIsListViewOpened,
|
|
44
|
+
setIsInserterOpened
|
|
38
45
|
} = useDispatch(editPostStore);
|
|
39
46
|
const {
|
|
40
47
|
registerShortcut
|
|
41
48
|
} = useDispatch(keyboardShortcutsStore);
|
|
49
|
+
const {
|
|
50
|
+
set: setPreference
|
|
51
|
+
} = useDispatch(preferencesStore);
|
|
52
|
+
|
|
53
|
+
const toggleDistractionFree = () => {
|
|
54
|
+
setPreference('core/edit-post', 'fixedToolbar', false);
|
|
55
|
+
setIsInserterOpened(false);
|
|
56
|
+
setIsListViewOpened(false);
|
|
57
|
+
closeGeneralSidebar();
|
|
58
|
+
};
|
|
59
|
+
|
|
42
60
|
useEffect(() => {
|
|
43
61
|
registerShortcut({
|
|
44
62
|
name: 'core/edit-post/toggle-mode',
|
|
@@ -49,6 +67,15 @@ function KeyboardShortcuts() {
|
|
|
49
67
|
character: 'm'
|
|
50
68
|
}
|
|
51
69
|
});
|
|
70
|
+
registerShortcut({
|
|
71
|
+
name: 'core/edit-post/toggle-distraction-free',
|
|
72
|
+
category: 'global',
|
|
73
|
+
description: __('Toggle distraction free mode.'),
|
|
74
|
+
keyCombination: {
|
|
75
|
+
modifier: 'primaryShift',
|
|
76
|
+
character: '\\'
|
|
77
|
+
}
|
|
78
|
+
});
|
|
52
79
|
registerShortcut({
|
|
53
80
|
name: 'core/edit-post/toggle-fullscreen',
|
|
54
81
|
category: 'global',
|
|
@@ -120,6 +147,16 @@ function KeyboardShortcuts() {
|
|
|
120
147
|
useShortcut('core/edit-post/toggle-fullscreen', () => {
|
|
121
148
|
toggleFeature('fullscreenMode');
|
|
122
149
|
});
|
|
150
|
+
useShortcut('core/edit-post/toggle-distraction-free', () => {
|
|
151
|
+
closeGeneralSidebar();
|
|
152
|
+
setIsListViewOpened(false);
|
|
153
|
+
toggleDistractionFree();
|
|
154
|
+
toggleFeature('distractionFree');
|
|
155
|
+
createInfoNotice(isFeatureActive('distractionFree') ? __('Distraction free mode turned on.') : __('Distraction free mode turned off.'), {
|
|
156
|
+
id: 'core/edit-post/distraction-free-mode/notice',
|
|
157
|
+
type: 'snackbar'
|
|
158
|
+
});
|
|
159
|
+
});
|
|
123
160
|
useShortcut('core/edit-post/toggle-sidebar', event => {
|
|
124
161
|
// This shortcut has no known clashes, but use preventDefault to prevent any
|
|
125
162
|
// obscure shortcuts from triggering.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/keyboard-shortcuts/index.js"],"names":["useEffect","useSelect","useDispatch","useShortcut","store","keyboardShortcutsStore","__","editorStore","blockEditorStore","editPostStore","KeyboardShortcuts","getBlockSelectionStart","getEditorMode","isEditorSidebarOpened","isListViewOpened","isModeToggleDisabled","select","richEditingEnabled","codeEditingEnabled","getEditorSettings","switchEditorMode","openGeneralSidebar","closeGeneralSidebar","toggleFeature","setIsListViewOpened","registerShortcut","name","category","description","keyCombination","modifier","character","aliases","isDisabled","event","preventDefault","sidebarToOpen"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,WADD,EAECC,KAAK,IAAIC,sBAFV,QAGO,+BAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,mBAArC;AACA,SAASH,KAAK,IAAII,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,SAASJ,KAAK,IAAIK,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,iBAAT,GAA6B;AAC5B,QAAM;AAAEC,IAAAA;AAAF,MAA6BV,SAAS,CAAEO,gBAAF,CAA5C;AACA,QAAM;AAAEI,IAAAA,aAAF;AAAiBC,IAAAA,qBAAjB;AAAwCC,IAAAA;AAAxC,MACLb,SAAS,CAAEQ,aAAF,CADV;AAEA,QAAMM,oBAAoB,GAAGd,SAAS,CAAIe,MAAF,IAAc;AACrD,UAAM;AAAEC,MAAAA,kBAAF;AAAsBC,MAAAA;AAAtB,QACLF,MAAM,CAAET,WAAF,CAAN,CAAsBY,iBAAtB,EADD;AAEA,WAAO,CAAEF,kBAAF,IAAwB,CAAEC,kBAAjC;AACA,GAJqC,EAInC,EAJmC,CAAtC;AAMA,QAAM;AACLE,IA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AOV;AACCqB,IAAAA,UAAU,EAAElB;AADb,GAPU,CAAX;AAYAZ,EAAAA,WAAW,CAAE,kCAAF,EAAsC,MAAM;AACtDoB,IAAAA,aAAa,CAAE,gBAAF,CAAb;AACA,GAFU,CAAX;AAIApB,EAAAA,WAAW,CAAE,+BAAF,EAAqC+B,KAAF,IAAa;AAC1D;AACA;AACAA,IAAAA,KAAK,CAACC,cAAN;;AAEA,QAAKtB,qBAAqB,EAA1B,EAA+B;AAC9BS,MAAAA,mBAAmB;AACnB,KAFD,MAEO;AACN,YAAMc,aAAa,GAAGzB,sBAAsB,KACzC,iBADyC,GAEzC,oBAFH;AAGAU,MAAAA,kBAAkB,CAAEe,aAAF,CAAlB;AACA;AACD,GAbU,CAAX;AAeAjC,EAAAA,WAAW,CAAE,iCAAF,EAAqC,MAC/CqB,mBAAmB,CAAE,CAAEV,gBAAgB,EAApB,CADT,CAAX;AAIA,SAAO,IAAP;AACA;;AAED,eAAeJ,iBAAf","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';\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} = useDispatch( editPostStore );\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\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-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],\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\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-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\tuseShortcut( 'core/edit-post/toggle-list-view', () =>\n\t\tsetIsListViewOpened( ! isListViewOpened() )\n\t);\n\n\treturn null;\n}\n\nexport default KeyboardShortcuts;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/keyboard-shortcuts/index.js"],"names":["useEffect","useSelect","useDispatch","useShortcut","store","keyboardShortcutsStore","__","editorStore","blockEditorStore","noticesStore","preferencesStore","editPostStore","KeyboardShortcuts","getBlockSelectionStart","getEditorMode","isEditorSidebarOpened","isListViewOpened","isFeatureActive","isModeToggleDisabled","select","richEditingEnabled","codeEditingEnabled","getEditorSettings","createInfoNotice","switchEditorMode","openGeneralSidebar","closeGeneralSidebar","toggleFeature","setIsListViewOpened","setIsInserterOpened","registerShortcut","set","setPreference","toggleDistractionFree","name","category","description","keyCombination","modifier","character","aliases","isDisabled","id","type","event","preventDefault","sidebarToOpen"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,WADD,EAECC,KAAK,IAAIC,sBAFV,QAGO,+BAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,mBAArC;AACA,SAASH,KAAK,IAAII,gBAAlB,QAA0C,yBAA1C;AACA,SAASJ,KAAK,IAAIK,YAAlB,QAAsC,oBAAtC;AACA,SAASL,KAAK,IAAIM,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,SAASN,KAAK,IAAIO,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,iBAAT,GAA6B;AAC5B,QAAM;AAAEC,IAAAA;AAAF,MAA6BZ,SAAS,CAAEO,gBAAF,CAA5C;AACA,QAAM;AACLM,IAAAA,aADK;AAELC,IAAAA,qBAFK;AAGLC,IAAAA,gBAHK;AAILC,IAAAA;AAJK,MAKFhB,SAAS,CAAEU,aAAF,CALb;AAMA,QAAMO,oBAAoB,GAAGjB,SAAS,CAAIkB,MAAF,IAAc;AACrD,UAAM;AAAEC,MAAAA,kBAAF;AAAsBC,MAAAA;AAAtB,QACLF,MAAM,CAAEZ,WAAF,CAAN,CAAsBe,iBAAtB,EADD;AAEA,W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,6CADL;AAECC,MAAAA,IAAI,EAAE;AAFP,KAJe,CAAhB;AASA,GAdU,CAAX;AAgBAxC,EAAAA,WAAW,CAAE,+BAAF,EAAqCyC,KAAF,IAAa;AAC1D;AACA;AACAA,IAAAA,KAAK,CAACC,cAAN;;AAEA,QAAK9B,qBAAqB,EAA1B,EAA+B;AAC9BW,MAAAA,mBAAmB;AACnB,KAFD,MAEO;AACN,YAAMoB,aAAa,GAAGjC,sBAAsB,KACzC,iBADyC,GAEzC,oBAFH;AAGAY,MAAAA,kBAAkB,CAAEqB,aAAF,CAAlB;AACA;AACD,GAbU,CAAX;AAeA3C,EAAAA,WAAW,CAAE,iCAAF,EAAqC,MAC/CyB,mBAAmB,CAAE,CAAEZ,gBAAgB,EAApB,CADT,CAAX;AAIA,SAAO,IAAP;AACA;;AAED,eAAeJ,iBAAf","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 { store as noticesStore } from '@wordpress/notices';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction KeyboardShortcuts() {\n\tconst { getBlockSelectionStart } = useSelect( blockEditorStore );\n\tconst {\n\t\tgetEditorMode,\n\t\tisEditorSidebarOpened,\n\t\tisListViewOpened,\n\t\tisFeatureActive,\n\t} = useSelect( 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 { createInfoNotice } = useDispatch( noticesStore );\n\n\tconst {\n\t\tswitchEditorMode,\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\ttoggleFeature,\n\t\tsetIsListViewOpened,\n\t\tsetIsInserterOpened,\n\t} = useDispatch( editPostStore );\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst toggleDistractionFree = () => {\n\t\tsetPreference( 'core/edit-post', 'fixedToolbar', false );\n\t\tsetIsInserterOpened( false );\n\t\tsetIsListViewOpened( false );\n\t\tcloseGeneralSidebar();\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],\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\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\tcloseGeneralSidebar();\n\t\tsetIsListViewOpened( false );\n\t\ttoggleDistractionFree();\n\t\ttoggleFeature( 'distractionFree' );\n\t\tcreateInfoNotice(\n\t\t\tisFeatureActive( 'distractionFree' )\n\t\t\t\t? __( 'Distraction free mode turned on.' )\n\t\t\t\t: __( 'Distraction free mode turned off.' ),\n\t\t\t{\n\t\t\t\tid: 'core/edit-post/distraction-free-mode/notice',\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\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\tuseShortcut( 'core/edit-post/toggle-list-view', () =>\n\t\tsetIsListViewOpened( ! isListViewOpened() )\n\t);\n\n\treturn null;\n}\n\nexport default KeyboardShortcuts;\n"]}
|
|
@@ -10,7 +10,7 @@ import classnames from 'classnames';
|
|
|
10
10
|
|
|
11
11
|
import { AutosaveMonitor, LocalAutosaveMonitor, UnsavedChangesWarning, EditorNotices, EditorKeyboardShortcutsRegister, EditorSnackbars, store as editorStore } from '@wordpress/editor';
|
|
12
12
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
13
|
-
import { BlockBreadcrumb
|
|
13
|
+
import { BlockBreadcrumb } from '@wordpress/block-editor';
|
|
14
14
|
import { Button, ScrollLock, Popover } from '@wordpress/components';
|
|
15
15
|
import { useViewportMatch } from '@wordpress/compose';
|
|
16
16
|
import { PluginArea } from '@wordpress/plugins';
|
|
@@ -82,7 +82,7 @@ function Layout(_ref) {
|
|
|
82
82
|
isInserterOpened,
|
|
83
83
|
isListViewOpened,
|
|
84
84
|
showIconLabels,
|
|
85
|
-
|
|
85
|
+
isDistractionFree,
|
|
86
86
|
showBlockBreadcrumbs,
|
|
87
87
|
isTemplateMode,
|
|
88
88
|
documentLabel
|
|
@@ -106,7 +106,7 @@ function Layout(_ref) {
|
|
|
106
106
|
previousShortcut: select(keyboardShortcutsStore).getAllShortcutKeyCombinations('core/edit-post/previous-region'),
|
|
107
107
|
nextShortcut: select(keyboardShortcutsStore).getAllShortcutKeyCombinations('core/edit-post/next-region'),
|
|
108
108
|
showIconLabels: select(editPostStore).isFeatureActive('showIconLabels'),
|
|
109
|
-
|
|
109
|
+
isDistractionFree: select(editPostStore).isFeatureActive('distractionFree'),
|
|
110
110
|
showBlockBreadcrumbs: select(editPostStore).isFeatureActive('showBlockBreadcrumbs'),
|
|
111
111
|
// translators: Default label for the Document in the Block Breadcrumb.
|
|
112
112
|
documentLabel: postTypeLabel || _x('Document', 'noun')
|
|
@@ -116,7 +116,8 @@ function Layout(_ref) {
|
|
|
116
116
|
'is-sidebar-opened': sidebarIsOpened,
|
|
117
117
|
'has-fixed-toolbar': hasFixedToolbar,
|
|
118
118
|
'has-metaboxes': hasActiveMetaboxes,
|
|
119
|
-
'show-icon-labels': showIconLabels
|
|
119
|
+
'show-icon-labels': showIconLabels,
|
|
120
|
+
'is-distraction-free': isDistractionFree
|
|
120
121
|
});
|
|
121
122
|
|
|
122
123
|
const openSidebarPanel = () => openGeneralSidebar(hasBlockSelected ? 'edit-post/block' : 'edit-post/document'); // Inserter and Sidebars are mutually exclusive
|
|
@@ -165,6 +166,7 @@ function Layout(_ref) {
|
|
|
165
166
|
return createElement(Fragment, null, createElement(FullscreenMode, {
|
|
166
167
|
isActive: isFullscreenActive
|
|
167
168
|
}), createElement(BrowserURL, null), createElement(UnsavedChangesWarning, null), createElement(AutosaveMonitor, null), createElement(LocalAutosaveMonitor, null), createElement(EditPostKeyboardShortcuts, null), createElement(EditorKeyboardShortcutsRegister, null), createElement(SettingsSidebar, null), createElement(InterfaceSkeleton, {
|
|
169
|
+
isDistractionFree: isDistractionFree,
|
|
168
170
|
className: className,
|
|
169
171
|
labels: { ...interfaceLabels,
|
|
170
172
|
secondarySidebar: secondarySidebarLabel
|
|
@@ -172,6 +174,7 @@ function Layout(_ref) {
|
|
|
172
174
|
header: createElement(Header, {
|
|
173
175
|
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
|
|
174
176
|
}),
|
|
177
|
+
editorNotices: createElement(EditorNotices, null),
|
|
175
178
|
secondarySidebar: secondarySidebar(),
|
|
176
179
|
sidebar: (!isMobileViewport || sidebarIsOpened) && createElement(Fragment, null, !isMobileViewport && !sidebarIsOpened && createElement("div", {
|
|
177
180
|
className: "edit-post-layout__toggle-sidebar-panel"
|
|
@@ -184,7 +187,7 @@ function Layout(_ref) {
|
|
|
184
187
|
scope: "core/edit-post"
|
|
185
188
|
})),
|
|
186
189
|
notices: createElement(EditorSnackbars, null),
|
|
187
|
-
content: createElement(Fragment, null, createElement(EditorNotices, null), (mode === 'text' || !isRichEditingEnabled) && createElement(TextEditor, null), isRichEditingEnabled && mode === 'visual' && createElement(VisualEditor, {
|
|
190
|
+
content: createElement(Fragment, null, !isDistractionFree && createElement(EditorNotices, null), (mode === 'text' || !isRichEditingEnabled) && createElement(TextEditor, null), isRichEditingEnabled && mode === 'visual' && createElement(VisualEditor, {
|
|
188
191
|
styles: styles
|
|
189
192
|
}), !isTemplateMode && createElement("div", {
|
|
190
193
|
className: "edit-post-layout__metaboxes"
|
|
@@ -192,10 +195,8 @@ function Layout(_ref) {
|
|
|
192
195
|
location: "normal"
|
|
193
196
|
}), createElement(MetaBoxes, {
|
|
194
197
|
location: "advanced"
|
|
195
|
-
})), isMobileViewport && sidebarIsOpened && createElement(ScrollLock, null),
|
|
196
|
-
|
|
197
|
-
})),
|
|
198
|
-
footer: !hasReducedUI && showBlockBreadcrumbs && !isMobileViewport && isRichEditingEnabled && mode === 'visual' && createElement("div", {
|
|
198
|
+
})), isMobileViewport && sidebarIsOpened && createElement(ScrollLock, null)),
|
|
199
|
+
footer: !isDistractionFree && showBlockBreadcrumbs && !isMobileViewport && isRichEditingEnabled && mode === 'visual' && createElement("div", {
|
|
199
200
|
className: "edit-post-layout__footer"
|
|
200
201
|
}, createElement(BlockBreadcrumb, {
|
|
201
202
|
rootLabelText: documentLabel
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/layout/index.js"],"names":["classnames","AutosaveMonitor","LocalAutosaveMonitor","UnsavedChangesWarning","EditorNotices","EditorKeyboardShortcutsRegister","EditorSnackbars","store","editorStore","useSelect","useDispatch","BlockBreadcrumb","BlockStyles","Button","ScrollLock","Popover","useViewportMatch","PluginArea","__","_x","sprintf","ComplementaryArea","FullscreenMode","InterfaceSkeleton","interfaceStore","useState","useEffect","useCallback","keyboardShortcutsStore","noticesStore","TextEditor","VisualEditor","EditPostKeyboardShortcuts","KeyboardShortcutHelpModal","EditPostPreferencesModal","BrowserURL","Header","InserterSidebar","ListViewSidebar","SettingsSidebar","MetaBoxes","WelcomeGuide","ActionsPanel","StartPageOptions","editPostStore","interfaceLabels","header","body","sidebar","actions","footer","Layout","styles","isMobileViewport","isHugeViewport","openGeneralSidebar","closeGeneralSidebar","setIsInserterOpened","createErrorNotice","mode","isFullscreenActive","isRichEditingEnabled","sidebarIsOpened","hasActiveMetaboxes","hasFixedToolbar","previousShortcut","nextShortcut","hasBlockSelected","isInserterOpened","isListViewOpened","showIconLabels","hasReducedUI","showBlockBreadcrumbs","isTemplateMode","documentLabel","select","getEditorSettings","getPostTypeLabel","editorSettings","postTypeLabel","isEditingTemplate","isFeatureActive","getActiveComplementaryArea","name","isPublishSidebarOpened","getEditorMode","richEditingEnabled","hasMetaBoxes","getAllShortcutKeyCombinations","className","openSidebarPanel","entitiesSavedStatesCallback","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","arg","secondarySidebarLabel","secondarySidebar","onPluginAreaError","previ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jC,gBADC;AAEXkC,MAAAA,IAAI,EAAEjC;AAFK;AA/Eb,IATD,EA6FC,cAAC,wBAAD,OA7FD,EA8FC,cAAC,yBAAD,OA9FD,EA+FC,cAAC,YAAD,OA/FD,EAgGC,cAAC,gBAAD,OAhGD,EAiGC,cAAC,OAAD,CAAS,IAAT,OAjGD,EAkGC,cAAC,UAAD;AAAY,IAAA,OAAO,EAAG+B;AAAtB,IAlGD,CADD;AAsGA;;AAED,eAAe9C,MAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAutosaveMonitor,\n\tLocalAutosaveMonitor,\n\tUnsavedChangesWarning,\n\tEditorNotices,\n\tEditorKeyboardShortcutsRegister,\n\tEditorSnackbars,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { BlockBreadcrumb, BlockStyles } from '@wordpress/block-editor';\nimport { Button, ScrollLock, Popover } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { PluginArea } from '@wordpress/plugins';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tFullscreenMode,\n\tInterfaceSkeleton,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { useState, useEffect, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport TextEditor from '../text-editor';\nimport VisualEditor from '../visual-editor';\nimport EditPostKeyboardShortcuts from '../keyboard-shortcuts';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport EditPostPreferencesModal from '../preferences-modal';\nimport BrowserURL from '../browser-url';\nimport Header from '../header';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport SettingsSidebar from '../sidebar/settings-sidebar';\nimport MetaBoxes from '../meta-boxes';\nimport WelcomeGuide from '../welcome-guide';\nimport ActionsPanel from './actions-panel';\nimport StartPageOptions from '../start-page-options';\nimport { store as editPostStore } from '../../store';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor top bar landmark region. */\n\theader: __( 'Editor top bar' ),\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nfunction Layout( { styles } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst { openGeneralSidebar, closeGeneralSidebar, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst {\n\t\tmode,\n\t\tisFullscreenActive,\n\t\tisRichEditingEnabled,\n\t\tsidebarIsOpened,\n\t\thasActiveMetaboxes,\n\t\thasFixedToolbar,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t\thasBlockSelected,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tshowIconLabels,\n\t\thasReducedUI,\n\t\tshowBlockBreadcrumbs,\n\t\tisTemplateMode,\n\t\tdocumentLabel,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getPostTypeLabel } = select( editorStore );\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst postTypeLabel = getPostTypeLabel();\n\n\t\treturn {\n\t\t\tisTemplateMode: select( editPostStore ).isEditingTemplate(),\n\t\t\thasFixedToolbar:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'fixedToolbar' ),\n\t\t\tsidebarIsOpened: !! (\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\teditPostStore.name\n\t\t\t\t) || select( editPostStore ).isPublishSidebarOpened()\n\t\t\t),\n\t\t\tisFullscreenActive:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'fullscreenMode' ),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisListViewOpened: select( editPostStore ).isListViewOpened(),\n\t\t\tmode: select( editPostStore ).getEditorMode(),\n\t\t\tisRichEditingEnabled: editorSettings.richEditingEnabled,\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-post/previous-region' ),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-post/next-region' ),\n\t\t\tshowIconLabels:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'showIconLabels' ),\n\t\t\thasReducedUI:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'reducedUI' ),\n\t\t\tshowBlockBreadcrumbs: select( editPostStore ).isFeatureActive(\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\t// translators: Default label for the Document in the Block Breadcrumb.\n\t\t\tdocumentLabel: postTypeLabel || _x( 'Document', 'noun' ),\n\t\t};\n\t}, [] );\n\tconst className = classnames( 'edit-post-layout', 'is-mode-' + mode, {\n\t\t'is-sidebar-opened': sidebarIsOpened,\n\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t'has-metaboxes': hasActiveMetaboxes,\n\t\t'show-icon-labels': showIconLabels,\n\t} );\n\tconst openSidebarPanel = () =>\n\t\topenGeneralSidebar(\n\t\t\thasBlockSelected ? 'edit-post/block' : 'edit-post/document'\n\t\t);\n\n\t// Inserter and Sidebars are mutually exclusive\n\tuseEffect( () => {\n\t\tif ( sidebarIsOpened && ! isHugeViewport ) {\n\t\t\tsetIsInserterOpened( false );\n\t\t}\n\t}, [ sidebarIsOpened, isHugeViewport ] );\n\tuseEffect( () => {\n\t\tif ( isInserterOpened && ! isHugeViewport ) {\n\t\t\tcloseGeneralSidebar();\n\t\t}\n\t}, [ isInserterOpened, isHugeViewport ] );\n\n\t// Local state for save panel.\n\t// Note 'truthy' callback implies an open panel.\n\tconst [ entitiesSavedStatesCallback, setEntitiesSavedStatesCallback ] =\n\t\tuseState( false );\n\tconst closeEntitiesSavedStates = useCallback(\n\t\t( arg ) => {\n\t\t\tif ( typeof entitiesSavedStatesCallback === 'function' ) {\n\t\t\t\tentitiesSavedStatesCallback( arg );\n\t\t\t}\n\t\t\tsetEntitiesSavedStatesCallback( false );\n\t\t},\n\t\t[ entitiesSavedStatesCallback ]\n\t);\n\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\n\tconst secondarySidebar = () => {\n\t\tif ( mode === 'visual' && isInserterOpened ) {\n\t\t\treturn <InserterSidebar />;\n\t\t}\n\t\tif ( mode === 'visual' && isListViewOpened ) {\n\t\t\treturn <ListViewSidebar />;\n\t\t}\n\n\t\treturn null;\n\t};\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<FullscreenMode isActive={ isFullscreenActive } />\n\t\t\t<BrowserURL />\n\t\t\t<UnsavedChangesWarning />\n\t\t\t<AutosaveMonitor />\n\t\t\t<LocalAutosaveMonitor />\n\t\t\t<EditPostKeyboardShortcuts />\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t<SettingsSidebar />\n\t\t\t<InterfaceSkeleton\n\t\t\t\tclassName={ className }\n\t\t\t\tlabels={ {\n\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t} }\n\t\t\t\theader={\n\t\t\t\t\t<Header\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tsecondarySidebar={ secondarySidebar() }\n\t\t\t\tsidebar={\n\t\t\t\t\t( ! isMobileViewport || sidebarIsOpened ) && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isMobileViewport && ! sidebarIsOpened && (\n\t\t\t\t\t\t\t\t<div className=\"edit-post-layout__toggle-sidebar-panel\">\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-post-layout__toggle-sidebar-panel-button\"\n\t\t\t\t\t\t\t\t\t\tonClick={ openSidebarPanel }\n\t\t\t\t\t\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ hasBlockSelected\n\t\t\t\t\t\t\t\t\t\t\t? __( 'Open block settings' )\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Open document settings' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-post\" />\n\t\t\t\t\t\t</>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\tcontent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t<EditorNotices />\n\t\t\t\t\t\t{ ( mode === 'text' || ! isRichEditingEnabled ) && (\n\t\t\t\t\t\t\t<TextEditor />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isRichEditingEnabled && mode === 'visual' && (\n\t\t\t\t\t\t\t<VisualEditor styles={ styles } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div className=\"edit-post-layout__metaboxes\">\n\t\t\t\t\t\t\t\t<MetaBoxes location=\"normal\" />\n\t\t\t\t\t\t\t\t<MetaBoxes location=\"advanced\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isMobileViewport && sidebarIsOpened && (\n\t\t\t\t\t\t\t<ScrollLock />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<BlockStyles.Slot scope=\"core/block-inspector\" />\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\t! hasReducedUI &&\n\t\t\t\t\tshowBlockBreadcrumbs &&\n\t\t\t\t\t! isMobileViewport &&\n\t\t\t\t\tisRichEditingEnabled &&\n\t\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t\t<div className=\"edit-post-layout__footer\">\n\t\t\t\t\t\t\t<BlockBreadcrumb rootLabelText={ documentLabel } />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<ActionsPanel\n\t\t\t\t\t\tcloseEntitiesSavedStates={ closeEntitiesSavedStates }\n\t\t\t\t\t\tisEntitiesSavedStatesOpen={\n\t\t\t\t\t\t\tentitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tshortcuts={ {\n\t\t\t\t\tprevious: previousShortcut,\n\t\t\t\t\tnext: nextShortcut,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<EditPostPreferencesModal />\n\t\t\t<KeyboardShortcutHelpModal />\n\t\t\t<WelcomeGuide />\n\t\t\t<StartPageOptions />\n\t\t\t<Popover.Slot />\n\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t</>\n\t);\n}\n\nexport default Layout;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/layout/index.js"],"names":["classnames","AutosaveMonitor","LocalAutosaveMonitor","UnsavedChangesWarning","EditorNotices","EditorKeyboardShortcutsRegister","EditorSnackbars","store","editorStore","useSelect","useDispatch","BlockBreadcrumb","Button","ScrollLock","Popover","useViewportMatch","PluginArea","__","_x","sprintf","ComplementaryArea","FullscreenMode","InterfaceSkeleton","interfaceStore","useState","useEffect","useCallback","keyboardShortcutsStore","noticesStore","TextEditor","VisualEditor","EditPostKeyboardShortcuts","KeyboardShortcutHelpModal","EditPostPreferencesModal","BrowserURL","Header","InserterSidebar","ListViewSidebar","SettingsSidebar","MetaBoxes","WelcomeGuide","ActionsPanel","StartPageOptions","editPostStore","interfaceLabels","header","body","sidebar","actions","footer","Layout","styles","isMobileViewport","isHugeViewport","openGeneralSidebar","closeGeneralSidebar","setIsInserterOpened","createErrorNotice","mode","isFullscreenActive","isRichEditingEnabled","sidebarIsOpened","hasActiveMetaboxes","hasFixedToolbar","previousShortcut","nextShortcut","hasBlockSelected","isInserterOpened","isListViewOpened","showIconLabels","isDistractionFree","showBlockBreadcrumbs","isTemplateMode","documentLabel","select","getEditorSettings","getPostTypeLabel","editorSettings","postTypeLabel","isEditingTemplate","isFeatureActive","getActiveComplementaryArea","name","isPublishSidebarOpened","getEditorMode","richEditingEnabled","hasMetaBoxes","getAllShortcutKeyCombinations","className","openSidebarPanel","entitiesSavedStatesCallback","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","arg","secondarySidebarLabel","secondarySidebar","onPluginAreaError","previous","next"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,eADD,EAECC,oBAFD,EAGCC,qBAHD,EAICC,aAJD,EAKCC,+BALD,EAMCC,eAND,EAOCC,KAAK,IAAIC,WAPV,QAQO,mBARP;AASA,SAASC,S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GD,EAkGC,cAAC,OAAD,CAAS,IAAT,OAlGD,EAmGC,cAAC,UAAD;AAAY,IAAA,OAAO,EAAG+B;AAAtB,IAnGD,CADD;AAuGA;;AAED,eAAe9C,MAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAutosaveMonitor,\n\tLocalAutosaveMonitor,\n\tUnsavedChangesWarning,\n\tEditorNotices,\n\tEditorKeyboardShortcutsRegister,\n\tEditorSnackbars,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { BlockBreadcrumb } from '@wordpress/block-editor';\nimport { Button, ScrollLock, Popover } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { PluginArea } from '@wordpress/plugins';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tFullscreenMode,\n\tInterfaceSkeleton,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { useState, useEffect, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport TextEditor from '../text-editor';\nimport VisualEditor from '../visual-editor';\nimport EditPostKeyboardShortcuts from '../keyboard-shortcuts';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport EditPostPreferencesModal from '../preferences-modal';\nimport BrowserURL from '../browser-url';\nimport Header from '../header';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport SettingsSidebar from '../sidebar/settings-sidebar';\nimport MetaBoxes from '../meta-boxes';\nimport WelcomeGuide from '../welcome-guide';\nimport ActionsPanel from './actions-panel';\nimport StartPageOptions from '../start-page-options';\nimport { store as editPostStore } from '../../store';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor top bar landmark region. */\n\theader: __( 'Editor top bar' ),\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nfunction Layout( { styles } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst { openGeneralSidebar, closeGeneralSidebar, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst {\n\t\tmode,\n\t\tisFullscreenActive,\n\t\tisRichEditingEnabled,\n\t\tsidebarIsOpened,\n\t\thasActiveMetaboxes,\n\t\thasFixedToolbar,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t\thasBlockSelected,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tshowIconLabels,\n\t\tisDistractionFree,\n\t\tshowBlockBreadcrumbs,\n\t\tisTemplateMode,\n\t\tdocumentLabel,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getPostTypeLabel } = select( editorStore );\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst postTypeLabel = getPostTypeLabel();\n\n\t\treturn {\n\t\t\tisTemplateMode: select( editPostStore ).isEditingTemplate(),\n\t\t\thasFixedToolbar:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'fixedToolbar' ),\n\t\t\tsidebarIsOpened: !! (\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\teditPostStore.name\n\t\t\t\t) || select( editPostStore ).isPublishSidebarOpened()\n\t\t\t),\n\t\t\tisFullscreenActive:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'fullscreenMode' ),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisListViewOpened: select( editPostStore ).isListViewOpened(),\n\t\t\tmode: select( editPostStore ).getEditorMode(),\n\t\t\tisRichEditingEnabled: editorSettings.richEditingEnabled,\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-post/previous-region' ),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-post/next-region' ),\n\t\t\tshowIconLabels:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'showIconLabels' ),\n\t\t\tisDistractionFree:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'distractionFree' ),\n\t\t\tshowBlockBreadcrumbs: select( editPostStore ).isFeatureActive(\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\t// translators: Default label for the Document in the Block Breadcrumb.\n\t\t\tdocumentLabel: postTypeLabel || _x( 'Document', 'noun' ),\n\t\t};\n\t}, [] );\n\n\tconst className = classnames( 'edit-post-layout', 'is-mode-' + mode, {\n\t\t'is-sidebar-opened': sidebarIsOpened,\n\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t'has-metaboxes': hasActiveMetaboxes,\n\t\t'show-icon-labels': showIconLabels,\n\t\t'is-distraction-free': isDistractionFree,\n\t} );\n\tconst openSidebarPanel = () =>\n\t\topenGeneralSidebar(\n\t\t\thasBlockSelected ? 'edit-post/block' : 'edit-post/document'\n\t\t);\n\n\t// Inserter and Sidebars are mutually exclusive\n\tuseEffect( () => {\n\t\tif ( sidebarIsOpened && ! isHugeViewport ) {\n\t\t\tsetIsInserterOpened( false );\n\t\t}\n\t}, [ sidebarIsOpened, isHugeViewport ] );\n\tuseEffect( () => {\n\t\tif ( isInserterOpened && ! isHugeViewport ) {\n\t\t\tcloseGeneralSidebar();\n\t\t}\n\t}, [ isInserterOpened, isHugeViewport ] );\n\n\t// Local state for save panel.\n\t// Note 'truthy' callback implies an open panel.\n\tconst [ entitiesSavedStatesCallback, setEntitiesSavedStatesCallback ] =\n\t\tuseState( false );\n\tconst closeEntitiesSavedStates = useCallback(\n\t\t( arg ) => {\n\t\t\tif ( typeof entitiesSavedStatesCallback === 'function' ) {\n\t\t\t\tentitiesSavedStatesCallback( arg );\n\t\t\t}\n\t\t\tsetEntitiesSavedStatesCallback( false );\n\t\t},\n\t\t[ entitiesSavedStatesCallback ]\n\t);\n\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\n\tconst secondarySidebar = () => {\n\t\tif ( mode === 'visual' && isInserterOpened ) {\n\t\t\treturn <InserterSidebar />;\n\t\t}\n\t\tif ( mode === 'visual' && isListViewOpened ) {\n\t\t\treturn <ListViewSidebar />;\n\t\t}\n\n\t\treturn null;\n\t};\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<FullscreenMode isActive={ isFullscreenActive } />\n\t\t\t<BrowserURL />\n\t\t\t<UnsavedChangesWarning />\n\t\t\t<AutosaveMonitor />\n\t\t\t<LocalAutosaveMonitor />\n\t\t\t<EditPostKeyboardShortcuts />\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t<SettingsSidebar />\n\t\t\t<InterfaceSkeleton\n\t\t\t\tisDistractionFree={ isDistractionFree }\n\t\t\t\tclassName={ className }\n\t\t\t\tlabels={ {\n\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t} }\n\t\t\t\theader={\n\t\t\t\t\t<Header\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\teditorNotices={ <EditorNotices /> }\n\t\t\t\tsecondarySidebar={ secondarySidebar() }\n\t\t\t\tsidebar={\n\t\t\t\t\t( ! isMobileViewport || sidebarIsOpened ) && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isMobileViewport && ! sidebarIsOpened && (\n\t\t\t\t\t\t\t\t<div className=\"edit-post-layout__toggle-sidebar-panel\">\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-post-layout__toggle-sidebar-panel-button\"\n\t\t\t\t\t\t\t\t\t\tonClick={ openSidebarPanel }\n\t\t\t\t\t\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ hasBlockSelected\n\t\t\t\t\t\t\t\t\t\t\t? __( 'Open block settings' )\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Open document settings' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-post\" />\n\t\t\t\t\t\t</>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\tcontent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isDistractionFree && <EditorNotices /> }\n\t\t\t\t\t\t{ ( mode === 'text' || ! isRichEditingEnabled ) && (\n\t\t\t\t\t\t\t<TextEditor />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isRichEditingEnabled && mode === 'visual' && (\n\t\t\t\t\t\t\t<VisualEditor styles={ styles } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div className=\"edit-post-layout__metaboxes\">\n\t\t\t\t\t\t\t\t<MetaBoxes location=\"normal\" />\n\t\t\t\t\t\t\t\t<MetaBoxes location=\"advanced\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isMobileViewport && sidebarIsOpened && (\n\t\t\t\t\t\t\t<ScrollLock />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\t! isDistractionFree &&\n\t\t\t\t\tshowBlockBreadcrumbs &&\n\t\t\t\t\t! isMobileViewport &&\n\t\t\t\t\tisRichEditingEnabled &&\n\t\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t\t<div className=\"edit-post-layout__footer\">\n\t\t\t\t\t\t\t<BlockBreadcrumb rootLabelText={ documentLabel } />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<ActionsPanel\n\t\t\t\t\t\tcloseEntitiesSavedStates={ closeEntitiesSavedStates }\n\t\t\t\t\t\tisEntitiesSavedStatesOpen={\n\t\t\t\t\t\t\tentitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tshortcuts={ {\n\t\t\t\t\tprevious: previousShortcut,\n\t\t\t\t\tnext: nextShortcut,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<EditPostPreferencesModal />\n\t\t\t<KeyboardShortcutHelpModal />\n\t\t\t<WelcomeGuide />\n\t\t\t<StartPageOptions />\n\t\t\t<Popover.Slot />\n\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t</>\n\t);\n}\n\nexport default Layout;\n"]}
|
|
@@ -14,6 +14,7 @@ import { useSelect, useDispatch } from '@wordpress/data';
|
|
|
14
14
|
import { useMemo } from '@wordpress/element';
|
|
15
15
|
import { PostTaxonomies, PostExcerptCheck, PageAttributesCheck, PostFeaturedImageCheck, PostTypeSupportCheck, store as editorStore } from '@wordpress/editor';
|
|
16
16
|
import { PreferencesModal, PreferencesModalTabs, PreferencesModalSection } from '@wordpress/interface';
|
|
17
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
17
18
|
/**
|
|
18
19
|
* Internal dependencies
|
|
19
20
|
*/
|
|
@@ -28,8 +29,7 @@ export default function EditPostPreferencesModal() {
|
|
|
28
29
|
const {
|
|
29
30
|
closeModal
|
|
30
31
|
} = useDispatch(editPostStore);
|
|
31
|
-
const isModalActive = useSelect(select =>
|
|
32
|
-
const showBlockBreadcrumbsOption = useSelect(select => {
|
|
32
|
+
const [isModalActive, showBlockBreadcrumbsOption] = useSelect(select => {
|
|
33
33
|
const {
|
|
34
34
|
getEditorSettings
|
|
35
35
|
} = select(editorStore);
|
|
@@ -37,11 +37,28 @@ export default function EditPostPreferencesModal() {
|
|
|
37
37
|
getEditorMode,
|
|
38
38
|
isFeatureActive
|
|
39
39
|
} = select(editPostStore);
|
|
40
|
+
const modalActive = select(editPostStore).isModalActive(MODAL_NAME);
|
|
40
41
|
const mode = getEditorMode();
|
|
41
42
|
const isRichEditingEnabled = getEditorSettings().richEditingEnabled;
|
|
42
|
-
const
|
|
43
|
-
return !
|
|
43
|
+
const isDistractionFreeEnabled = isFeatureActive('distractionFree');
|
|
44
|
+
return [modalActive, !isDistractionFreeEnabled && isLargeViewport && isRichEditingEnabled && mode === 'visual', isDistractionFreeEnabled];
|
|
44
45
|
}, [isLargeViewport]);
|
|
46
|
+
const {
|
|
47
|
+
closeGeneralSidebar,
|
|
48
|
+
setIsListViewOpened,
|
|
49
|
+
setIsInserterOpened
|
|
50
|
+
} = useDispatch(editPostStore);
|
|
51
|
+
const {
|
|
52
|
+
set: setPreference
|
|
53
|
+
} = useDispatch(preferencesStore);
|
|
54
|
+
|
|
55
|
+
const toggleDistractionFree = () => {
|
|
56
|
+
setPreference('core/edit-post', 'fixedToolbar', false);
|
|
57
|
+
setIsInserterOpened(false);
|
|
58
|
+
setIsListViewOpened(false);
|
|
59
|
+
closeGeneralSidebar();
|
|
60
|
+
};
|
|
61
|
+
|
|
45
62
|
const sections = useMemo(() => [{
|
|
46
63
|
name: 'general',
|
|
47
64
|
tabLabel: __('General'),
|
|
@@ -55,6 +72,11 @@ export default function EditPostPreferencesModal() {
|
|
|
55
72
|
title: __('Appearance'),
|
|
56
73
|
description: __('Customize options related to the block editor interface and editing flow.')
|
|
57
74
|
}, createElement(EnableFeature, {
|
|
75
|
+
featureName: "distractionFree",
|
|
76
|
+
onToggle: toggleDistractionFree,
|
|
77
|
+
help: __('Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'),
|
|
78
|
+
label: __('Distraction Free')
|
|
79
|
+
}), createElement(EnableFeature, {
|
|
58
80
|
featureName: "focusMode",
|
|
59
81
|
help: __('Highlights the current block and fades other content.'),
|
|
60
82
|
label: __('Spotlight mode')
|
|
@@ -66,10 +88,6 @@ export default function EditPostPreferencesModal() {
|
|
|
66
88
|
featureName: "showListViewByDefault",
|
|
67
89
|
help: __('Opens the block list view sidebar by default.'),
|
|
68
90
|
label: __('Always open list view')
|
|
69
|
-
}), createElement(EnableFeature, {
|
|
70
|
-
featureName: "reducedUI",
|
|
71
|
-
help: __('Compacts options and outlines in the toolbar.'),
|
|
72
|
-
label: __('Reduce the interface')
|
|
73
91
|
}), createElement(EnableFeature, {
|
|
74
92
|
featureName: "themeStyles",
|
|
75
93
|
help: __('Make the editor look like your theme.'),
|