@wordpress/edit-post 6.15.1-next.4d3b314fd5.0 → 6.17.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 +1 -1
- package/build/components/block-manager/category.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/index.js +54 -11
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/main-dashboard-button/index.js +2 -2
- package/build/components/header/main-dashboard-button/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +3 -1
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js +51 -2
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +43 -2
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +14 -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/visual-editor/index.js +9 -7
- 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/index.js +15 -10
- package/build/index.js.map +1 -1
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/block-manager/category.js +2 -2
- package/build-module/components/block-manager/category.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/index.js +53 -11
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/main-dashboard-button/index.js +3 -3
- package/build-module/components/header/main-dashboard-button/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +3 -1
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js +49 -3
- package/build-module/components/header/writing-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +42 -3
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +15 -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/visual-editor/index.js +9 -7
- 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/index.js +15 -10
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +2 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +1 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +41 -0
- package/build-style/style.css +41 -0
- package/package.json +27 -27
- package/src/components/block-manager/category.js +3 -4
- package/src/components/device-preview/index.js +2 -0
- package/src/components/editor-initialization/test/listener-hooks.js +47 -49
- package/src/components/header/index.js +31 -12
- package/src/components/header/main-dashboard-button/index.js +3 -3
- package/src/components/header/more-menu/index.js +1 -1
- package/src/components/header/style.scss +44 -0
- package/src/components/header/writing-menu/index.js +52 -3
- package/src/components/keyboard-shortcuts/index.js +49 -3
- package/src/components/layout/index.js +17 -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 +50 -55
- package/src/components/preferences-modal/test/index.js +3 -3
- package/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap +37 -1
- package/src/components/sidebar/plugin-post-publish-panel/test/index.js +8 -6
- package/src/components/sidebar/plugin-post-status-info/test/__snapshots__/index.js.snap +1 -1
- package/src/components/sidebar/plugin-post-status-info/test/index.js +4 -4
- package/src/components/visual-editor/index.js +13 -6
- package/src/editor.js +7 -8
- package/src/editor.native.js +3 -4
- package/src/index.js +20 -16
- package/src/store/actions.js +3 -4
- package/src/store/reducer.js +1 -1
- package/src/style.scss +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -92,7 +92,7 @@ function BlockManagerCategory(_ref) {
|
|
|
92
92
|
return null;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
const checkedBlockNames = (0, _lodash.
|
|
95
|
+
const checkedBlockNames = (0, _lodash.map)(filteredBlockTypes, 'name').filter(type => !hiddenBlockTypes.includes(type));
|
|
96
96
|
const titleId = 'edit-post-block-manager__category-title-' + instanceId;
|
|
97
97
|
const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;
|
|
98
98
|
let ariaChecked;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/category.js"],"names":["BlockManagerCategory","title","blockTypes","instanceId","defaultAllowedBlockTypes","hiddenBlockTypes","select","getEditorSettings","editorStore","getHiddenBlockTypes","editPostStore","filteredBlockTypes","filter","name","showBlockTypes","hideBlockTypes","toggleVisible","blockName","nextIsChecked","toggleAllVisible","blockNames","length","checkedBlockNames","titleId","isAllChecked","ariaChecked"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAIA,SAASA,oBAAT,OAAuD;AAAA,MAAxB;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAwB;AACtD,QAAMC,UAAU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NL,MAAAA,cAAc,CAAEK,UAAF,CAAd;AACA;AACD,GARuB,EASxB,CAAElB,UAAF,CATwB,CAAzB;;AAYA,MAAK,CAAES,kBAAkB,CAACU,MAA1B,EAAmC;AAClC,WAAO,IAAP;AACA;;AAED,QAAMC,iBAAiB,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/category.js"],"names":["BlockManagerCategory","title","blockTypes","instanceId","defaultAllowedBlockTypes","hiddenBlockTypes","select","getEditorSettings","editorStore","getHiddenBlockTypes","editPostStore","filteredBlockTypes","filter","name","showBlockTypes","hideBlockTypes","toggleVisible","blockName","nextIsChecked","toggleAllVisible","blockNames","length","checkedBlockNames","type","includes","titleId","isAllChecked","ariaChecked"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAIA,SAASA,oBAAT,OAAuD;AAAA,MAAxB;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAwB;AACtD,QAAMC,UAAU,GAAG,4BAAeH,oBAAf,CAAnB;AACA,QAAM;AAAEI,IAAAA,wBAAF;AAA4BC,IAAAA;AAA5B,MAAiD,qBACpDC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAwBD,MAAM,CAAEE,aAAF,CAApC;AACA,UAAM;AAAEC,MAAAA;AAAF,QAA0BH,MAAM,CAAEI,YAAF,CAAtC;AACA,WAAO;AACNN,MAAAA,wBAAwB,EACvBG,iBAAiB,GAAGH,wBAFf;AAGNC,MAAAA,gBAAgB,EAAEI,mBAAmB;AAH/B,KAAP;AAKA,GATqD,EAUtD,EAVsD,CAAvD;AAYA,QAAME,kBAAkB,GAAG,sBAAS,MAAM;AACzC,QAAKP,wBAAwB,KAAK,IAAlC,EAAyC;AACxC,aAAOF,UAAP;AACA;;AACD,WAAOA,UAAU,CAACU,MAAX,CAAmB,SAAgB;AA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AAlB,GAA2B,CAAhC,EAAoC;AAC1CM,IAAAA,WAAW,GAAG,OAAd;AACA,GAFM,MAEA;AACNA,IAAAA,WAAW,GAAG,OAAd;AACA;;AAED,SACC;AACC,IAAA,IAAI,EAAC,OADN;AAEC,uBAAkBF,OAFnB;AAGC,IAAA,SAAS,EAAC;AAHX,KAKC,4BAAC,2BAAD;AACC,IAAA,OAAO,EAAGC,YADX;AAEC,IAAA,QAAQ,EAAGP,gBAFZ;AAGC,IAAA,SAAS,EAAC,yCAHX;AAIC,oBAAeQ,WAJhB;AAKC,IAAA,KAAK,EAAG;AAAM,MAAA,EAAE,EAAGF;AAAX,OAAuBxB,KAAvB;AALT,IALD,EAYC,4BAAC,kBAAD;AACC,IAAA,UAAU,EAAGU,kBADd;AAEC,IAAA,KAAK,EAAGW,iBAFT;AAGC,IAAA,YAAY,EAAGN;AAHhB,IAZD,CADD;AAoBA;;eAEchB,oB","sourcesContent":["/**\n * External dependencies\n */\nimport { includes, map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { CheckboxControl } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesChecklist from './checklist';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManagerCategory( { title, blockTypes } ) {\n\tconst instanceId = useInstanceId( BlockManagerCategory );\n\tconst { defaultAllowedBlockTypes, hiddenBlockTypes } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getHiddenBlockTypes } = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tdefaultAllowedBlockTypes:\n\t\t\t\t\tgetEditorSettings().defaultAllowedBlockTypes,\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( defaultAllowedBlockTypes === true ) {\n\t\t\treturn blockTypes;\n\t\t}\n\t\treturn blockTypes.filter( ( { name } ) => {\n\t\t\treturn includes( defaultAllowedBlockTypes || [], name );\n\t\t} );\n\t}, [ defaultAllowedBlockTypes, blockTypes ] );\n\tconst { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore );\n\tconst toggleVisible = useCallback( ( blockName, nextIsChecked ) => {\n\t\tif ( nextIsChecked ) {\n\t\t\tshowBlockTypes( blockName );\n\t\t} else {\n\t\t\thideBlockTypes( blockName );\n\t\t}\n\t}, [] );\n\tconst toggleAllVisible = useCallback(\n\t\t( nextIsChecked ) => {\n\t\t\tconst blockNames = map( blockTypes, 'name' );\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t} else {\n\t\t\t\thideBlockTypes( blockNames );\n\t\t\t}\n\t\t},\n\t\t[ blockTypes ]\n\t);\n\n\tif ( ! filteredBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\tconst checkedBlockNames = map( filteredBlockTypes, 'name' ).filter(\n\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t);\n\n\tconst titleId = 'edit-post-block-manager__category-title-' + instanceId;\n\n\tconst isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;\n\n\tlet ariaChecked;\n\tif ( isAllChecked ) {\n\t\tariaChecked = 'true';\n\t} else if ( checkedBlockNames.length > 0 ) {\n\t\tariaChecked = 'mixed';\n\t} else {\n\t\tariaChecked = 'false';\n\t}\n\n\treturn (\n\t\t<div\n\t\t\trole=\"group\"\n\t\t\taria-labelledby={ titleId }\n\t\t\tclassName=\"edit-post-block-manager__category\"\n\t\t>\n\t\t\t<CheckboxControl\n\t\t\t\tchecked={ isAllChecked }\n\t\t\t\tonChange={ toggleAllVisible }\n\t\t\t\tclassName=\"edit-post-block-manager__category-title\"\n\t\t\t\taria-checked={ ariaChecked }\n\t\t\t\tlabel={ <span id={ titleId }>{ title }</span> }\n\t\t\t/>\n\t\t\t<BlockTypesChecklist\n\t\t\t\tblockTypes={ filteredBlockTypes }\n\t\t\t\tvalue={ checkedBlockNames }\n\t\t\t\tonItemChange={ toggleVisible }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default BlockManagerCategory;\n"]}
|
|
@@ -67,6 +67,9 @@ function DevicePreview() {
|
|
|
67
67
|
className: "edit-post-post-preview-dropdown",
|
|
68
68
|
deviceType: deviceType,
|
|
69
69
|
setDeviceType: setPreviewDeviceType
|
|
70
|
+
/* translators: button label text should, if possible, be under 16 characters. */
|
|
71
|
+
,
|
|
72
|
+
viewLabel: (0, _i18n.__)('Preview')
|
|
70
73
|
}, isViewable && (0, _element.createElement)(_components.MenuGroup, null, (0, _element.createElement)("div", {
|
|
71
74
|
className: "edit-post-header-preview__grouping-external"
|
|
72
75
|
}, (0, _element.createElement)(_editor.PostPreviewButton, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/device-preview/index.js"],"names":["DevicePreview","hasActiveMetaboxes","isPostSaveable","isSaving","isViewable","deviceType","select","getEditedPostAttribute","editorStore","getPostType","coreStore","postType","editPostStore","hasMetaBoxes","isSavingMetaBoxes","isEditedPostSaveable","__experimentalGetPreviewDeviceType","__experimentalSetPreviewDeviceType","setPreviewDeviceType","undefined","external"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AAGe,SAASA,aAAT,GAAyB;AACvC,QAAM;AACLC,IAAAA,kBADK;AAELC,IAAAA,cAFK;AAGLC,IAAAA,QAHK;AAILC,IAAAA,UAJK;AAKLC,IAAAA;AALK,MAMF,qBAAaC,MAAF,IAAc;AAC5B,UAAM;AAAEC,MAAAA;AAAF,QAA6BD,MAAM,CAAEE,aAAF,CAAzC;AACA,UAAM;AAAEC,MAAAA;AAAF,QAAkBH,MAAM,CAAEI,eAAF,CAA9B;AACA,UAAMC,QAAQ,GAAGF,WAAW,CAAEF,sBAAsB,CAAE,MAAF,CAAxB,CAA5B;AAEA,WAAO;AACNN,MAAAA,kBAAkB,EAAEK,MAAM,CAAEM,YAAF,CAAN,CAAwBC,YAAxB,EADd;AAENV,MAAAA,QAAQ,EAAEG,MAAM,CAAEM,YAAF,CAAN,CAAwBE,iBAAxB,EAFJ;AAGNZ,MAAAA,cAAc,EAAEI,MAAM,CAAEE,aAAF,CAAN,CAAsBO,oBAAtB,EAHV;AAINX,MAAAA,UAAU,EAAE,iBAAKO,QAAL,EAAe,CAAE,UAAF,CAAf,EAA+B,KAA/B,CAJN;AAKNN,MAAAA,UAAU,EACTC,MAAM,CAAEM,YAAF,CAAN,CAAwBI,kCAAxB;AANK,KAAP;AAQA,GAbG,EAaD,EAbC,CANJ;AAoBA,QAAM;AAAEC,IAAAA,kCAAkC,EAAEC;AAAtC,MACL,uBAAaN,YAAb,CADD;AAGA,SACC,4BAAC,yCAAD;AACC,IAAA,SAAS,EAAGV,cADb;AAEC,IAAA,SAAS,EAAC,iCAFX;AAGC,IAAA,UAAU,EAAGG,UAHd;AAIC,IAAA,aAAa,EAAGa;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/device-preview/index.js"],"names":["DevicePreview","hasActiveMetaboxes","isPostSaveable","isSaving","isViewable","deviceType","select","getEditedPostAttribute","editorStore","getPostType","coreStore","postType","editPostStore","hasMetaBoxes","isSavingMetaBoxes","isEditedPostSaveable","__experimentalGetPreviewDeviceType","__experimentalSetPreviewDeviceType","setPreviewDeviceType","undefined","external"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AAGe,SAASA,aAAT,GAAyB;AACvC,QAAM;AACLC,IAAAA,kBADK;AAELC,IAAAA,cAFK;AAGLC,IAAA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C,IAAA,WAAW,EACV,qDACG,cAAI,oBAAJ,CADH,EAEC,4BAAC,gBAAD;AAAM,MAAA,IAAI,EAAGC;AAAb,MAFD;AARF,IADD,CADD,CATF,CADD;AA+BA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Icon, MenuGroup } from '@wordpress/components';\nimport { PostPreviewButton, store as editorStore } from '@wordpress/editor';\nimport { external } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalPreviewOptions as PreviewOptions } from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport default function DevicePreview() {\n\tconst {\n\t\thasActiveMetaboxes,\n\t\tisPostSaveable,\n\t\tisSaving,\n\t\tisViewable,\n\t\tdeviceType,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\treturn {\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\tisSaving: select( editPostStore ).isSavingMetaBoxes(),\n\t\t\tisPostSaveable: select( editorStore ).isEditedPostSaveable(),\n\t\t\tisViewable: get( postType, [ 'viewable' ], false ),\n\t\t\tdeviceType:\n\t\t\t\tselect( editPostStore ).__experimentalGetPreviewDeviceType(),\n\t\t};\n\t}, [] );\n\tconst { __experimentalSetPreviewDeviceType: setPreviewDeviceType } =\n\t\tuseDispatch( editPostStore );\n\n\treturn (\n\t\t<PreviewOptions\n\t\t\tisEnabled={ isPostSaveable }\n\t\t\tclassName=\"edit-post-post-preview-dropdown\"\n\t\t\tdeviceType={ deviceType }\n\t\t\tsetDeviceType={ setPreviewDeviceType }\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\tviewLabel={ __( 'Preview' ) }\n\t\t>\n\t\t\t{ isViewable && (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<div className=\"edit-post-header-preview__grouping-external\">\n\t\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t'edit-post-header-preview__button-external'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\tforceIsAutosaveable={ hasActiveMetaboxes }\n\t\t\t\t\t\t\tforcePreviewLink={ isSaving ? null : undefined }\n\t\t\t\t\t\t\ttextContent={\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\t\t<Icon icon={ external } />\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</div>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</PreviewOptions>\n\t);\n}\n"]}
|
|
@@ -19,6 +19,8 @@ var _interface = require("@wordpress/interface");
|
|
|
19
19
|
|
|
20
20
|
var _compose = require("@wordpress/compose");
|
|
21
21
|
|
|
22
|
+
var _components = require("@wordpress/components");
|
|
23
|
+
|
|
22
24
|
var _fullscreenModeClose = _interopRequireDefault(require("./fullscreen-mode-close"));
|
|
23
25
|
|
|
24
26
|
var _headerToolbar = _interopRequireDefault(require("./header-toolbar"));
|
|
@@ -48,32 +50,73 @@ var _templateTitle = _interopRequireDefault(require("./template-title"));
|
|
|
48
50
|
*/
|
|
49
51
|
function Header(_ref) {
|
|
50
52
|
let {
|
|
51
|
-
setEntitiesSavedStatesCallback
|
|
53
|
+
setEntitiesSavedStatesCallback,
|
|
54
|
+
isDistractionFree
|
|
52
55
|
} = _ref;
|
|
53
56
|
const {
|
|
54
57
|
hasActiveMetaboxes,
|
|
55
58
|
isPublishSidebarOpened,
|
|
56
59
|
isSaving,
|
|
57
|
-
showIconLabels
|
|
58
|
-
hasReducedUI
|
|
60
|
+
showIconLabels
|
|
59
61
|
} = (0, _data.useSelect)(select => ({
|
|
60
62
|
hasActiveMetaboxes: select(_store.store).hasMetaBoxes(),
|
|
61
63
|
isPublishSidebarOpened: select(_store.store).isPublishSidebarOpened(),
|
|
62
64
|
isSaving: select(_store.store).isSavingMetaBoxes(),
|
|
63
|
-
showIconLabels: select(_store.store).isFeatureActive('showIconLabels')
|
|
64
|
-
hasReducedUI: select(_store.store).isFeatureActive('reducedUI')
|
|
65
|
+
showIconLabels: select(_store.store).isFeatureActive('showIconLabels')
|
|
65
66
|
}), []);
|
|
66
67
|
const isLargeViewport = (0, _compose.useViewportMatch)('large');
|
|
67
|
-
const classes = (0, _classnames.default)('edit-post-header'
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
const classes = (0, _classnames.default)('edit-post-header');
|
|
69
|
+
const slideY = {
|
|
70
|
+
hidden: isDistractionFree ? {
|
|
71
|
+
y: '-50'
|
|
72
|
+
} : {
|
|
73
|
+
y: 0
|
|
74
|
+
},
|
|
75
|
+
hover: {
|
|
76
|
+
y: 0,
|
|
77
|
+
transition: {
|
|
78
|
+
type: 'tween',
|
|
79
|
+
delay: 0.2
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const slideX = {
|
|
84
|
+
hidden: isDistractionFree ? {
|
|
85
|
+
x: '-100%'
|
|
86
|
+
} : {
|
|
87
|
+
x: 0
|
|
88
|
+
},
|
|
89
|
+
hover: {
|
|
90
|
+
x: 0,
|
|
91
|
+
transition: {
|
|
92
|
+
type: 'tween',
|
|
93
|
+
delay: 0.2
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
70
97
|
return (0, _element.createElement)("div", {
|
|
71
98
|
className: classes
|
|
72
|
-
}, (0, _element.createElement)(_mainDashboardButton.default.Slot, null, (0, _element.createElement)(
|
|
99
|
+
}, (0, _element.createElement)(_mainDashboardButton.default.Slot, null, (0, _element.createElement)(_components.__unstableMotion.div, {
|
|
100
|
+
variants: slideX,
|
|
101
|
+
transition: {
|
|
102
|
+
type: 'tween',
|
|
103
|
+
delay: 0.8
|
|
104
|
+
}
|
|
105
|
+
}, (0, _element.createElement)(_fullscreenModeClose.default, {
|
|
73
106
|
showTooltip: true
|
|
74
|
-
})), (0, _element.createElement)(
|
|
107
|
+
}))), (0, _element.createElement)(_components.__unstableMotion.div, {
|
|
108
|
+
variants: slideY,
|
|
109
|
+
transition: {
|
|
110
|
+
type: 'tween',
|
|
111
|
+
delay: 0.8
|
|
112
|
+
},
|
|
75
113
|
className: "edit-post-header__toolbar"
|
|
76
|
-
}, (0, _element.createElement)(_headerToolbar.default, null), (0, _element.createElement)(_templateTitle.default, null)), (0, _element.createElement)(
|
|
114
|
+
}, (0, _element.createElement)(_headerToolbar.default, null), (0, _element.createElement)(_templateTitle.default, null)), (0, _element.createElement)(_components.__unstableMotion.div, {
|
|
115
|
+
variants: slideY,
|
|
116
|
+
transition: {
|
|
117
|
+
type: 'tween',
|
|
118
|
+
delay: 0.8
|
|
119
|
+
},
|
|
77
120
|
className: "edit-post-header__settings"
|
|
78
121
|
}, !isPublishSidebarOpened && // This button isn't completely hidden by the publish sidebar.
|
|
79
122
|
// We can't hide the whole toolbar when the publish sidebar is open because
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/index.js"],"names":["Header","setEntitiesSavedStatesCallback","hasActiveMetaboxes","isPublishSidebarOpened","isSaving","showIconLabels","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/index.js"],"names":["Header","setEntitiesSavedStatesCallback","isDistractionFree","hasActiveMetaboxes","isPublishSidebarOpened","isSaving","showIconLabels","select","editPostStore","hasMetaBoxes","isSavingMetaBoxes","isFeatureActive","isLargeViewport","classes","slideY","hidden","y","hover","transition","type","delay","slideX","x","undefined"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;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kCAAD;AACC,IAAA,YAAY,EAAGpB,kBADhB;AAEC,IAAA,aAAa,EAAGE,QAFjB;AAGC,IAAA,8BAA8B,EAC7BJ;AAJF,IAtBD,EA6BG,CAAEW,eAAe,IAAI,CAAEN,cAAvB,KACD,qDACC,4BAAC,sBAAD,CAAa,IAAb;AAAkB,IAAA,KAAK,EAAC;AAAxB,IADD,EAEC,4BAAC,iBAAD;AAAU,IAAA,cAAc,EAAGA;AAA3B,IAFD,CA9BF,EAmCGA,cAAc,IAAI,CAAEM,eAApB,IACD,4BAAC,iBAAD;AAAU,IAAA,cAAc,EAAGN;AAA3B,IApCF,CAjBD,CADD;AA2DA;;eAEcN,M","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, isDistractionFree } ) {\n\tconst {\n\t\thasActiveMetaboxes,\n\t\tisPublishSidebarOpened,\n\t\tisSaving,\n\t\tshowIconLabels,\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} ),\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"]}
|
|
@@ -23,8 +23,8 @@ const Slot = _ref => {
|
|
|
23
23
|
let {
|
|
24
24
|
children
|
|
25
25
|
} = _ref;
|
|
26
|
-
const
|
|
27
|
-
const hasFills = Boolean(
|
|
26
|
+
const fills = (0, _components.__experimentalUseSlotFills)(slotName);
|
|
27
|
+
const hasFills = Boolean(fills && fills.length);
|
|
28
28
|
|
|
29
29
|
if (!hasFills) {
|
|
30
30
|
return children;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/main-dashboard-button/index.js"],"names":["slotName","Fill","Slot","MainDashboardButtonSlot","MainDashboardButton","children","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/main-dashboard-button/index.js"],"names":["slotName","Fill","Slot","MainDashboardButtonSlot","MainDashboardButton","children","fills","hasFills","Boolean","length"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAMA,MAAMA,QAAQ,GAAG,mCAAjB;AAEA,MAAM;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,IAAI,EAAEC;AAAd,IAA0C,gCAAgBH,QAAhB,CAAhD;AAEA,MAAMI,mBAAmB,GAAGH,IAA5B;;AAEA,MAAMC,IAAI,GAAG,QAAoB;AAAA,MAAlB;AAAEG,IAAAA;AAAF,GAAkB;AAChC,QAAMC,KAAK,GAAG,4CAAcN,QAAd,CAAd;AACA,QAAMO,QAAQ,GAAGC,OAAO,CAAEF,KAAK,IAAIA,KAAK,CAACG,MAAjB,CAAxB;;AAEA,MAAK,CAAEF,QAAP,EAAkB;AACjB,WAAOF,QAAP;AACA;;AAED,SAAO,4BAAC,uBAAD;AAAyB,IAAA,gBAAgB;AAAzC,IAAP;AACA,CATD;;AAWAD,mBAAmB,CAACF,IAApB,GAA2BA,IAA3B;eAEeE,mB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseSlotFills as useSlotFills,\n\tcreateSlotFill,\n} from '@wordpress/components';\n\nconst slotName = '__experimentalMainDashboardButton';\n\nconst { Fill, Slot: MainDashboardButtonSlot } = createSlotFill( slotName );\n\nconst MainDashboardButton = Fill;\n\nconst Slot = ( { children } ) => {\n\tconst fills = useSlotFills( slotName );\n\tconst hasFills = Boolean( fills && fills.length );\n\n\tif ( ! hasFills ) {\n\t\treturn children;\n\t}\n\n\treturn <MainDashboardButtonSlot bubblesVirtually />;\n};\n\nMainDashboardButton.Slot = Slot;\n\nexport default MainDashboardButton;\n"]}
|
|
@@ -51,7 +51,9 @@ const MoreMenu = _ref => {
|
|
|
51
51
|
return (0, _element.createElement)(_element.Fragment, null, showIconLabels && !isLargeViewport && (0, _element.createElement)(_interface.PinnedItems.Slot, {
|
|
52
52
|
className: showIconLabels && 'show-icon-labels',
|
|
53
53
|
scope: "core/edit-post"
|
|
54
|
-
}), (0, _element.createElement)(_writingMenu.default,
|
|
54
|
+
}), (0, _element.createElement)(_writingMenu.default, {
|
|
55
|
+
onClose: onClose
|
|
56
|
+
}), (0, _element.createElement)(_modeSwitcher.default, null), (0, _element.createElement)(_interface.ActionItem.Slot, {
|
|
55
57
|
name: "core/edit-post/plugin-more-menu",
|
|
56
58
|
label: (0, _i18n.__)('Plugins'),
|
|
57
59
|
as: _components.MenuGroup,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/more-menu/index.js"],"names":["MoreMenu","showIconLabels","isLargeViewport","showTooltip","variant","onClose","MenuGroup","onClick"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAUA;AACA;AACA;AAMA,MAAMA,QAAQ,GAAG,QAA0B;AAAA,MAAxB;AAAEC,IAAAA;AAAF,GAAwB;AAC1C,QAAMC,eAAe,GAAG,+BAAkB,OAAlB,CAAxB;AAEA,SACC,4BAAC,2BAAD;AACC,IAAA,WAAW,EAAG;AACbC,MAAAA,WAAW,EAAE,CAAEF,cADF;AAEb,UAAKA,cAAc,IAAI;AAAEG,QAAAA,OAAO,EAAE;AAAX,OAAvB;AAFa;AADf,KAMG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,qDACGJ,cAAc,IAAI,CAAEC,eAApB,IACD,4BAAC,sBAAD,CAAa,IAAb;AACC,MAAA,SAAS,EAAGD,cAAc,IAAI,kBAD/B;AAEC,MAAA,KAAK,EAAC;AAFP,MAFF,EAOC,4BAAC,oBAAD,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/more-menu/index.js"],"names":["MoreMenu","showIconLabels","isLargeViewport","showTooltip","variant","onClose","MenuGroup","onClick"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAUA;AACA;AACA;AAMA,MAAMA,QAAQ,GAAG,QAA0B;AAAA,MAAxB;AAAEC,IAAAA;AAAF,GAAwB;AAC1C,QAAMC,eAAe,GAAG,+BAAkB,OAAlB,CAAxB;AAEA,SACC,4BAAC,2BAAD;AACC,IAAA,WAAW,EAAG;AACbC,MAAAA,WAAW,EAAE,CAAEF,cADF;AAEb,UAAKA,cAAc,IAAI;AAAEG,QAAAA,OAAO,EAAE;AAAX,OAAvB;AAFa;AADf,KAMG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,qDACGJ,cAAc,IAAI,CAAEC,eAApB,IACD,4BAAC,sBAAD,CAAa,IAAb;AACC,MAAA,SAAS,EAAGD,cAAc,IAAI,kBAD/B;AAEC,MAAA,KAAK,EAAC;AAFP,MAFF,EAOC,4BAAC,oBAAD;AAAa,MAAA,OAAO,EAAGI;AAAvB,MAPD,EAQC,4BAAC,qBAAD,OARD,EASC,4BAAC,qBAAD,CAAY,IAAZ;AACC,MAAA,IAAI,EAAC,iCADN;AAEC,MAAA,KAAK,EAAG,cAAI,SAAJ,CAFT;AAGC,MAAA,EAAE,EAAGC,qBAHN;AAIC,MAAA,SAAS,EAAG;AAAEC,QAAAA,OAAO,EAAEF;AAAX;AAJb,MATD,EAeC,4BAAC,2BAAD,CAAoB,IAApB;AAAyB,MAAA,SAAS,EAAG;AAAEA,QAAAA;AAAF;AAArC,MAfD,EAgBC,4BAAC,qBAAD,QACC,4BAAC,4BAAD,OADD,CAhBD,CADC;AAAA,GANH,CADD;AA+BA,CAlCD;;eAoCeL,Q","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuGroup } from '@wordpress/components';\nimport {\n\tActionItem,\n\tMoreMenuDropdown,\n\tPinnedItems,\n} from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport ModeSwitcher from '../mode-switcher';\nimport PreferencesMenuItem from '../preferences-menu-item';\nimport ToolsMoreMenuGroup from '../tools-more-menu-group';\nimport WritingMenu from '../writing-menu';\n\nconst MoreMenu = ( { showIconLabels } ) => {\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\n\treturn (\n\t\t<MoreMenuDropdown\n\t\t\ttoggleProps={ {\n\t\t\t\tshowTooltip: ! showIconLabels,\n\t\t\t\t...( showIconLabels && { variant: 'tertiary' } ),\n\t\t\t} }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t{ showIconLabels && ! isLargeViewport && (\n\t\t\t\t\t\t<PinnedItems.Slot\n\t\t\t\t\t\t\tclassName={ showIconLabels && 'show-icon-labels' }\n\t\t\t\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<WritingMenu onClose={ onClose } />\n\t\t\t\t\t<ModeSwitcher />\n\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\tname=\"core/edit-post/plugin-more-menu\"\n\t\t\t\t\t\tlabel={ __( 'Plugins' ) }\n\t\t\t\t\t\tas={ MenuGroup }\n\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsMoreMenuGroup.Slot fillProps={ { onClose } } />\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<PreferencesMenuItem />\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</MoreMenuDropdown>\n\t);\n};\n\nexport default MoreMenu;\n"]}
|
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _element = require("@wordpress/element");
|
|
9
9
|
|
|
10
|
+
var _data = require("@wordpress/data");
|
|
11
|
+
|
|
10
12
|
var _components = require("@wordpress/components");
|
|
11
13
|
|
|
12
14
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -17,10 +19,47 @@ var _keycodes = require("@wordpress/keycodes");
|
|
|
17
19
|
|
|
18
20
|
var _preferences = require("@wordpress/preferences");
|
|
19
21
|
|
|
22
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
23
|
+
|
|
24
|
+
var _store = require("../../../store");
|
|
25
|
+
|
|
20
26
|
/**
|
|
21
27
|
* WordPress dependencies
|
|
22
28
|
*/
|
|
23
|
-
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Internal dependencies
|
|
32
|
+
*/
|
|
33
|
+
function WritingMenu(_ref) {
|
|
34
|
+
let {
|
|
35
|
+
onClose
|
|
36
|
+
} = _ref;
|
|
37
|
+
const isDistractionFree = (0, _data.useSelect)(select => select(_blockEditor.store).getSettings().isDistractionFree, []);
|
|
38
|
+
const blocks = (0, _data.useSelect)(select => select(_blockEditor.store).getBlocks(), []);
|
|
39
|
+
const {
|
|
40
|
+
setIsInserterOpened,
|
|
41
|
+
setIsListViewOpened,
|
|
42
|
+
closeGeneralSidebar
|
|
43
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
44
|
+
const {
|
|
45
|
+
set: setPreference
|
|
46
|
+
} = (0, _data.useDispatch)(_preferences.store);
|
|
47
|
+
const {
|
|
48
|
+
selectBlock
|
|
49
|
+
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
50
|
+
|
|
51
|
+
const toggleDistractionFree = () => {
|
|
52
|
+
setPreference('core/edit-post', 'fixedToolbar', false);
|
|
53
|
+
setIsInserterOpened(false);
|
|
54
|
+
setIsListViewOpened(false);
|
|
55
|
+
closeGeneralSidebar();
|
|
56
|
+
onClose();
|
|
57
|
+
|
|
58
|
+
if (!isDistractionFree) {
|
|
59
|
+
selectBlock(blocks[0].clientId);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
24
63
|
const isLargeViewport = (0, _compose.useViewportMatch)('medium');
|
|
25
64
|
|
|
26
65
|
if (!isLargeViewport) {
|
|
@@ -31,6 +70,7 @@ function WritingMenu() {
|
|
|
31
70
|
label: (0, _i18n._x)('View', 'noun')
|
|
32
71
|
}, (0, _element.createElement)(_preferences.PreferenceToggleMenuItem, {
|
|
33
72
|
scope: "core/edit-post",
|
|
73
|
+
disabled: isDistractionFree,
|
|
34
74
|
name: "fixedToolbar",
|
|
35
75
|
label: (0, _i18n.__)('Top toolbar'),
|
|
36
76
|
info: (0, _i18n.__)('Access all block and document tools in a single place'),
|
|
@@ -47,10 +87,19 @@ function WritingMenu() {
|
|
|
47
87
|
scope: "core/edit-post",
|
|
48
88
|
name: "fullscreenMode",
|
|
49
89
|
label: (0, _i18n.__)('Fullscreen mode'),
|
|
50
|
-
info: (0, _i18n.__)('
|
|
90
|
+
info: (0, _i18n.__)('Show and hide admin UI'),
|
|
51
91
|
messageActivated: (0, _i18n.__)('Fullscreen mode activated'),
|
|
52
92
|
messageDeactivated: (0, _i18n.__)('Fullscreen mode deactivated'),
|
|
53
93
|
shortcut: _keycodes.displayShortcut.secondary('f')
|
|
94
|
+
}), (0, _element.createElement)(_preferences.PreferenceToggleMenuItem, {
|
|
95
|
+
scope: "core/edit-post",
|
|
96
|
+
name: "distractionFree",
|
|
97
|
+
toggleHandler: toggleDistractionFree,
|
|
98
|
+
label: (0, _i18n.__)('Distraction free'),
|
|
99
|
+
info: (0, _i18n.__)('Write with calmness'),
|
|
100
|
+
messageActivated: (0, _i18n.__)('Distraction free mode activated'),
|
|
101
|
+
messageDeactivated: (0, _i18n.__)('Distraction free mode deactivated'),
|
|
102
|
+
shortcut: _keycodes.displayShortcut.primaryShift('\\')
|
|
54
103
|
}));
|
|
55
104
|
}
|
|
56
105
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/writing-menu/index.js"],"names":["WritingMenu","isLargeViewport","displayShortcut","secondary"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/writing-menu/index.js"],"names":["WritingMenu","onClose","isDistractionFree","select","blockEditorStore","getSettings","blocks","getBlocks","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","postEditorStore","set","setPreference","preferencesStore","selectBlock","toggleDistractionFree","clientId","isLargeViewport","displayShortcut","secondary","primaryShift"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AAKA;;AAjBA;AACA;AACA;;AAYA;AACA;AACA;AAGA,SAASA,WAAT,OAAoC;AAAA,MAAd;AAAEC,IAAAA;AAAF,GAAc;AACnC,QAAMC,iBAAiB,GAAG,qBACvBC,MAAF,IACCA,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,WAA3B,GAAyCH,iBAFjB,EAGzB,EAHyB,CAA1B;AAMA,QAAMI,MAAM,GAAG,qBACZH,MAAF,IAAcA,MAAM,CAAEC,kBAAF,CAAN,CAA2BG,SAA3B,EADA,EAEd,EAFc,CAAf;AAKA,QAAM;AAAEC,IAAAA,mBAAF;AAAuBC,IAAAA,mBAAvB;AAA4CC,IAAAA;AAA5C,MACL,uBAAaC,YAAb,CADD;AAEA,QAAM;AAAEC,IAAAA,GAAG,EAAEC;AAAP,MAAyB,uBAAaC,kBAAb,CAA/B;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAkB,uBAAaX,kBAAb,CAAxB;;AAEA,QAAMY,qBAAqB,GAAG,MAAM;AACnCH,IAAAA,aAAa,CAAE,gBAAF,EAAoB,cAApB,EAAoC,KAApC,CAAb;AACAL,IAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACAC,IAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACAC,IAAAA,mBAAmB;AACnBT,IAAAA,OAAO;;AACP,QAAK,CAAEC,iBAAP,EAA2B;AAC1Ba,MAAAA,WAAW,CAAET,MAAM,CAAE,CAAF,CAAN,CAAYW,QAAd,CAAX;AACA;AACD,GATD;;AAWA,QAAMC,eAAe,GAAG,+BAAkB,QAAlB,CAAxB;;AACA,MAAK,CAAEA,eAAP,EAAyB;AACxB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,qB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B,EAAG,cAAI,mCAAJ,CAPtB;AAQC,IAAA,QAAQ,EAAGG,0BAAgBE,YAAhB,CAA8B,IAA9B;AARZ,IA7BD,CADD;AA0CA;;eAEcrB,W","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } 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( { onClose } ) {\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\tsetPreference( 'core/edit-post', 'fixedToolbar', false );\n\t\tsetIsInserterOpened( false );\n\t\tsetIsListViewOpened( false );\n\t\tcloseGeneralSidebar();\n\t\tonClose();\n\t\tif ( ! isDistractionFree ) {\n\t\t\tselectBlock( blocks[ 0 ].clientId );\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\ttoggleHandler={ 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"]}
|
|
@@ -17,6 +17,10 @@ var _editor = require("@wordpress/editor");
|
|
|
17
17
|
|
|
18
18
|
var _blockEditor = require("@wordpress/block-editor");
|
|
19
19
|
|
|
20
|
+
var _notices = require("@wordpress/notices");
|
|
21
|
+
|
|
22
|
+
var _preferences = require("@wordpress/preferences");
|
|
23
|
+
|
|
20
24
|
var _store = require("../../store");
|
|
21
25
|
|
|
22
26
|
/**
|
|
@@ -33,7 +37,8 @@ function KeyboardShortcuts() {
|
|
|
33
37
|
const {
|
|
34
38
|
getEditorMode,
|
|
35
39
|
isEditorSidebarOpened,
|
|
36
|
-
isListViewOpened
|
|
40
|
+
isListViewOpened,
|
|
41
|
+
isFeatureActive
|
|
37
42
|
} = (0, _data.useSelect)(_store.store);
|
|
38
43
|
const isModeToggleDisabled = (0, _data.useSelect)(select => {
|
|
39
44
|
const {
|
|
@@ -42,16 +47,31 @@ function KeyboardShortcuts() {
|
|
|
42
47
|
} = select(_editor.store).getEditorSettings();
|
|
43
48
|
return !richEditingEnabled || !codeEditingEnabled;
|
|
44
49
|
}, []);
|
|
50
|
+
const {
|
|
51
|
+
createInfoNotice
|
|
52
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
45
53
|
const {
|
|
46
54
|
switchEditorMode,
|
|
47
55
|
openGeneralSidebar,
|
|
48
56
|
closeGeneralSidebar,
|
|
49
57
|
toggleFeature,
|
|
50
|
-
setIsListViewOpened
|
|
58
|
+
setIsListViewOpened,
|
|
59
|
+
setIsInserterOpened
|
|
51
60
|
} = (0, _data.useDispatch)(_store.store);
|
|
52
61
|
const {
|
|
53
62
|
registerShortcut
|
|
54
63
|
} = (0, _data.useDispatch)(_keyboardShortcuts.store);
|
|
64
|
+
const {
|
|
65
|
+
set: setPreference
|
|
66
|
+
} = (0, _data.useDispatch)(_preferences.store);
|
|
67
|
+
|
|
68
|
+
const toggleDistractionFree = () => {
|
|
69
|
+
setPreference('core/edit-post', 'fixedToolbar', false);
|
|
70
|
+
setIsInserterOpened(false);
|
|
71
|
+
setIsListViewOpened(false);
|
|
72
|
+
closeGeneralSidebar();
|
|
73
|
+
};
|
|
74
|
+
|
|
55
75
|
(0, _element.useEffect)(() => {
|
|
56
76
|
registerShortcut({
|
|
57
77
|
name: 'core/edit-post/toggle-mode',
|
|
@@ -62,6 +82,15 @@ function KeyboardShortcuts() {
|
|
|
62
82
|
character: 'm'
|
|
63
83
|
}
|
|
64
84
|
});
|
|
85
|
+
registerShortcut({
|
|
86
|
+
name: 'core/edit-post/toggle-distraction-free',
|
|
87
|
+
category: 'global',
|
|
88
|
+
description: (0, _i18n.__)('Toggle disrtaction free mode.'),
|
|
89
|
+
keyCombination: {
|
|
90
|
+
modifier: 'primaryShift',
|
|
91
|
+
character: '\\'
|
|
92
|
+
}
|
|
93
|
+
});
|
|
65
94
|
registerShortcut({
|
|
66
95
|
name: 'core/edit-post/toggle-fullscreen',
|
|
67
96
|
category: 'global',
|
|
@@ -133,6 +162,18 @@ function KeyboardShortcuts() {
|
|
|
133
162
|
(0, _keyboardShortcuts.useShortcut)('core/edit-post/toggle-fullscreen', () => {
|
|
134
163
|
toggleFeature('fullscreenMode');
|
|
135
164
|
});
|
|
165
|
+
(0, _keyboardShortcuts.useShortcut)('core/edit-post/toggle-distraction-free', () => {
|
|
166
|
+
closeGeneralSidebar();
|
|
167
|
+
setIsListViewOpened(false);
|
|
168
|
+
toggleDistractionFree();
|
|
169
|
+
toggleFeature('distractionFree');
|
|
170
|
+
const modeState = isFeatureActive('distractionFree') ? (0, _i18n.__)('on') : (0, _i18n.__)('off');
|
|
171
|
+
createInfoNotice( // translators: Mode of distraction free can be 'on' or 'off';
|
|
172
|
+
(0, _i18n.sprintf)((0, _i18n.__)('Distraction free mode turned %s.'), modeState), {
|
|
173
|
+
speak: true,
|
|
174
|
+
type: 'snackbar'
|
|
175
|
+
});
|
|
176
|
+
});
|
|
136
177
|
(0, _keyboardShortcuts.useShortcut)('core/edit-post/toggle-sidebar', event => {
|
|
137
178
|
// This shortcut has no known clashes, but use preventDefault to prevent any
|
|
138
179
|
// obscure shortcuts from triggering.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/keyboard-shortcuts/index.js"],"names":["KeyboardShortcuts","getBlockSelectionStart","blockEditorStore","getEditorMode","isEditorSidebarOpened","isListViewOpened","editPostStore","isModeToggleDisabled","select","richEditingEnabled","codeEditingEnabled","editorStore","getEditorSettings","switchEditorMode","openGeneralSidebar","closeGeneralSidebar","toggleFeature","setIsListViewOpened","registerShortcut","keyboardShortcutsStore","name","category","description","keyCombination","modifier","character","aliases","isDisabled","event","preventDefault","sidebarToOpen"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AAKA;;AAhBA;AACA;AACA;;AAWA;AACA;AACA;AAGA,SAASA,iBAAT,GAA6B;AAC5B,QAAM;AAAEC,IAAAA;AAAF,MAA6B,qBAAWC,kBAAX,CAAnC;AACA,QAAM;AAAEC,IAAAA,aAAF;AAAiBC,IAAAA,qBAAjB;AAAwCC,IAAAA;AAAxC,MACL,qBAAWC,YAAX,CADD;AAEA,QAAMC,oBAAoB,GAAG,qBAAaC,MAAF,IAAc;AACrD,UAAM;AAAEC,MAAAA,kBAAF;AAAsBC,MAAAA;AAAtB,QACLF,MAAM,CAAEG,aAAF,CAAN,CAAsBC,iBAAtB,EADD;AAEA,WAAO,CAAEH,kBAAF,IAAwB,CAAEC,kBAAjC;AACA,GAJ4B,EAI1B,EAJ0B,CAA7B;AAMA,QAAM;AACLG,IAAAA,gBADK;AAELC,IAAAA,kBAFK;AAGLC,IAAAA,mBAHK;AAILC,IAAAA,aAJK;AAKLC,IAAAA;AALK,MAMF,uBAAaX,YAAb,CANJ;AAOA,QAAM;AAAEY,IAAAA;AAAF,MAAuB,uBAAaC,wBAAb,CAA7B;AAEA,0BAAW,MAAM;AAChBD,IAAAA,gBAAgB,CAAE;AACjBE,MAAAA,IAAI,EAAE,4BADW;AAEjBC,MAAAA,QAAQ,EAAE,QAFO;AAGjBC,MAAAA,WAAW,EAAE,cAAI,+CAAJ,CAHI;AAIjBC,MAAAA,cAAc,EAAE;AACfC,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AApB,CADpB;AAIA,SAAO,IAAP;AACA;;eAEcL,iB","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":["KeyboardShortcuts","getBlockSelectionStart","blockEditorStore","getEditorMode","isEditorSidebarOpened","isListViewOpened","isFeatureActive","editPostStore","isModeToggleDisabled","select","richEditingEnabled","codeEditingEnabled","editorStore","getEditorSettings","createInfoNotice","noticesStore","switchEditorMode","openGeneralSidebar","closeGeneralSidebar","toggleFeature","setIsListViewOpened","setIsInserterOpened","registerShortcut","keyboardShortcutsStore","set","setPreference","preferencesStore","toggleDistractionFree","name","category","description","keyCombination","modifier","character","aliases","isDisabled","modeState","speak","type","event","preventDefault","sidebarToOpen"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAlBA;AACA;AACA;;AAaA;AACA;AACA;AAGA,SAASA,iBAAT,GAA6B;AAC5B,QAAM;AAAEC,IAAAA;AAAF,MAA6B,qBAAWC,kBAAX,CA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AAE,iBAAF,CAAf,GACf,cAAI,IAAJ,CADe,GAEf,cAAI,KAAJ,CAFH;AAGAQ,IAAAA,gBAAgB,EACf;AACA,uBAAS,cAAI,kCAAJ,CAAT,EAAmDsB,SAAnD,CAFe,EAGf;AACCC,MAAAA,KAAK,EAAE,IADR;AAECC,MAAAA,IAAI,EAAE;AAFP,KAHe,CAAhB;AAQA,GAhBD;AAkBA,sCAAa,+BAAb,EAAgDC,KAAF,IAAa;AAC1D;AACA;AACAA,IAAAA,KAAK,CAACC,cAAN;;AAEA,QAAKpC,qBAAqB,EAA1B,EAA+B;AAC9Bc,MAAAA,mBAAmB;AACnB,KAFD,MAEO;AACN,YAAMuB,aAAa,GAAGxC,sBAAsB,KACzC,iBADyC,GAEzC,oBAFH;AAGAgB,MAAAA,kBAAkB,CAAEwB,aAAF,CAAlB;AACA;AACD,GAbD;AAeA,sCAAa,iCAAb,EAAgD,MAC/CrB,mBAAmB,CAAE,CAAEf,gBAAgB,EAApB,CADpB;AAIA,SAAO,IAAP;AACA;;eAEcL,iB","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 { __, sprintf } 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 disrtaction 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\tconst modeState = isFeatureActive( 'distractionFree' )\n\t\t\t? __( 'on' )\n\t\t\t: __( 'off' );\n\t\tcreateInfoNotice(\n\t\t\t// translators: Mode of distraction free can be 'on' or 'off';\n\t\t\tsprintf( __( 'Distraction free mode turned %s.' ), modeState ),\n\t\t\t{\n\t\t\t\tspeak: true,\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"]}
|
|
@@ -116,7 +116,7 @@ function Layout(_ref) {
|
|
|
116
116
|
isInserterOpened,
|
|
117
117
|
isListViewOpened,
|
|
118
118
|
showIconLabels,
|
|
119
|
-
|
|
119
|
+
isDistractionFree,
|
|
120
120
|
showBlockBreadcrumbs,
|
|
121
121
|
isTemplateMode,
|
|
122
122
|
documentLabel
|
|
@@ -140,17 +140,22 @@ function Layout(_ref) {
|
|
|
140
140
|
previousShortcut: select(_keyboardShortcuts.store).getAllShortcutKeyCombinations('core/edit-post/previous-region'),
|
|
141
141
|
nextShortcut: select(_keyboardShortcuts.store).getAllShortcutKeyCombinations('core/edit-post/next-region'),
|
|
142
142
|
showIconLabels: select(_store.store).isFeatureActive('showIconLabels'),
|
|
143
|
-
|
|
143
|
+
isDistractionFree: select(_store.store).isFeatureActive('distractionFree'),
|
|
144
144
|
showBlockBreadcrumbs: select(_store.store).isFeatureActive('showBlockBreadcrumbs'),
|
|
145
145
|
// translators: Default label for the Document in the Block Breadcrumb.
|
|
146
146
|
documentLabel: postTypeLabel || (0, _i18n._x)('Document', 'noun')
|
|
147
147
|
};
|
|
148
148
|
}, []);
|
|
149
|
+
const [distractionFree, setDistractionFree] = (0, _element.useState)(isDistractionFree);
|
|
150
|
+
(0, _element.useEffect)(() => {
|
|
151
|
+
setDistractionFree(isDistractionFree);
|
|
152
|
+
}, [isDistractionFree]);
|
|
149
153
|
const className = (0, _classnames.default)('edit-post-layout', 'is-mode-' + mode, {
|
|
150
154
|
'is-sidebar-opened': sidebarIsOpened,
|
|
151
155
|
'has-fixed-toolbar': hasFixedToolbar,
|
|
152
156
|
'has-metaboxes': hasActiveMetaboxes,
|
|
153
|
-
'show-icon-labels': showIconLabels
|
|
157
|
+
'show-icon-labels': showIconLabels,
|
|
158
|
+
'is-distraction-free': isDistractionFree
|
|
154
159
|
});
|
|
155
160
|
|
|
156
161
|
const openSidebarPanel = () => openGeneralSidebar(hasBlockSelected ? 'edit-post/block' : 'edit-post/document'); // Inserter and Sidebars are mutually exclusive
|
|
@@ -199,13 +204,16 @@ function Layout(_ref) {
|
|
|
199
204
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_interface.FullscreenMode, {
|
|
200
205
|
isActive: isFullscreenActive
|
|
201
206
|
}), (0, _element.createElement)(_browserUrl.default, null), (0, _element.createElement)(_editor.UnsavedChangesWarning, null), (0, _element.createElement)(_editor.AutosaveMonitor, null), (0, _element.createElement)(_editor.LocalAutosaveMonitor, null), (0, _element.createElement)(_keyboardShortcuts2.default, null), (0, _element.createElement)(_editor.EditorKeyboardShortcutsRegister, null), (0, _element.createElement)(_settingsSidebar.default, null), (0, _element.createElement)(_interface.InterfaceSkeleton, {
|
|
207
|
+
isDistractionFree: distractionFree,
|
|
202
208
|
className: className,
|
|
203
209
|
labels: { ...interfaceLabels,
|
|
204
210
|
secondarySidebar: secondarySidebarLabel
|
|
205
211
|
},
|
|
206
212
|
header: (0, _element.createElement)(_header.default, {
|
|
213
|
+
isDistractionFree: distractionFree,
|
|
207
214
|
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
|
|
208
215
|
}),
|
|
216
|
+
editorNotices: (0, _element.createElement)(_editor.EditorNotices, null),
|
|
209
217
|
secondarySidebar: secondarySidebar(),
|
|
210
218
|
sidebar: (!isMobileViewport || sidebarIsOpened) && (0, _element.createElement)(_element.Fragment, null, !isMobileViewport && !sidebarIsOpened && (0, _element.createElement)("div", {
|
|
211
219
|
className: "edit-post-layout__toggle-sidebar-panel"
|
|
@@ -218,7 +226,7 @@ function Layout(_ref) {
|
|
|
218
226
|
scope: "core/edit-post"
|
|
219
227
|
})),
|
|
220
228
|
notices: (0, _element.createElement)(_editor.EditorSnackbars, null),
|
|
221
|
-
content: (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_editor.EditorNotices, null), (mode === 'text' || !isRichEditingEnabled) && (0, _element.createElement)(_textEditor.default, null), isRichEditingEnabled && mode === 'visual' && (0, _element.createElement)(_visualEditor.default, {
|
|
229
|
+
content: (0, _element.createElement)(_element.Fragment, null, !isDistractionFree && (0, _element.createElement)(_editor.EditorNotices, null), (mode === 'text' || !isRichEditingEnabled) && (0, _element.createElement)(_textEditor.default, null), isRichEditingEnabled && mode === 'visual' && (0, _element.createElement)(_visualEditor.default, {
|
|
222
230
|
styles: styles
|
|
223
231
|
}), !isTemplateMode && (0, _element.createElement)("div", {
|
|
224
232
|
className: "edit-post-layout__metaboxes"
|
|
@@ -226,10 +234,8 @@ function Layout(_ref) {
|
|
|
226
234
|
location: "normal"
|
|
227
235
|
}), (0, _element.createElement)(_metaBoxes.default, {
|
|
228
236
|
location: "advanced"
|
|
229
|
-
})), isMobileViewport && sidebarIsOpened && (0, _element.createElement)(_components.ScrollLock, null)
|
|
230
|
-
|
|
231
|
-
})),
|
|
232
|
-
footer: !hasReducedUI && showBlockBreadcrumbs && !isMobileViewport && isRichEditingEnabled && mode === 'visual' && (0, _element.createElement)("div", {
|
|
237
|
+
})), isMobileViewport && sidebarIsOpened && (0, _element.createElement)(_components.ScrollLock, null)),
|
|
238
|
+
footer: !isDistractionFree && showBlockBreadcrumbs && !isMobileViewport && isRichEditingEnabled && mode === 'visual' && (0, _element.createElement)("div", {
|
|
233
239
|
className: "edit-post-layout__footer"
|
|
234
240
|
}, (0, _element.createElement)(_blockEditor.BlockBreadcrumb, {
|
|
235
241
|
rootLabelText: documentLabel
|