@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
package/CHANGELOG.md
CHANGED
|
@@ -64,7 +64,7 @@ function BlockManagerCategory(_ref) {
|
|
|
64
64
|
let {
|
|
65
65
|
name
|
|
66
66
|
} = _ref2;
|
|
67
|
-
return
|
|
67
|
+
return defaultAllowedBlockTypes === null || defaultAllowedBlockTypes === void 0 ? void 0 : defaultAllowedBlockTypes.includes(name);
|
|
68
68
|
});
|
|
69
69
|
}, [defaultAllowedBlockTypes, blockTypes]);
|
|
70
70
|
const {
|
|
@@ -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,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;AAAA,UAAd;AAAEC,QAAAA;AAAF,OAAc;AACzC,
|
|
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","includes","showBlockTypes","hideBlockTypes","toggleVisible","blockName","nextIsChecked","toggleAllVisible","blockNames","length","checkedBlockNames","type","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;AAAA,UAAd;AAAEC,QAAAA;AAAF,OAAc;AACzC,aAAOT,wBAA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AAC1CK,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,EAAGN,gBAFZ;AAGC,IAAA,SAAS,EAAC,yCAHX;AAIC,oBAAeO,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,EAAGY,iBAFT;AAGC,IAAA,YAAY,EAAGN;AAHhB,IAZD,CADD;AAoBA;;eAEcjB,oB","sourcesContent":["/**\n * External dependencies\n */\nimport { map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { CheckboxControl } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesChecklist from './checklist';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManagerCategory( { title, blockTypes } ) {\n\tconst instanceId = useInstanceId( BlockManagerCategory );\n\tconst { defaultAllowedBlockTypes, hiddenBlockTypes } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getHiddenBlockTypes } = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tdefaultAllowedBlockTypes:\n\t\t\t\t\tgetEditorSettings().defaultAllowedBlockTypes,\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( defaultAllowedBlockTypes === true ) {\n\t\t\treturn blockTypes;\n\t\t}\n\t\treturn blockTypes.filter( ( { name } ) => {\n\t\t\treturn defaultAllowedBlockTypes?.includes( name );\n\t\t} );\n\t}, [ defaultAllowedBlockTypes, blockTypes ] );\n\tconst { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore );\n\tconst toggleVisible = useCallback( ( blockName, nextIsChecked ) => {\n\t\tif ( nextIsChecked ) {\n\t\t\tshowBlockTypes( blockName );\n\t\t} else {\n\t\t\thideBlockTypes( blockName );\n\t\t}\n\t}, [] );\n\tconst toggleAllVisible = useCallback(\n\t\t( nextIsChecked ) => {\n\t\t\tconst blockNames = map( blockTypes, 'name' );\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t} else {\n\t\t\t\thideBlockTypes( blockNames );\n\t\t\t}\n\t\t},\n\t\t[ blockTypes ]\n\t);\n\n\tif ( ! filteredBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\tconst checkedBlockNames = map( filteredBlockTypes, 'name' ).filter(\n\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t);\n\n\tconst titleId = 'edit-post-block-manager__category-title-' + instanceId;\n\n\tconst isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;\n\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"]}
|
|
@@ -51,7 +51,7 @@ function BlockManager(_ref) {
|
|
|
51
51
|
// wasted renders by consequence of `Array#filter` producing
|
|
52
52
|
// a new value reference on each call.
|
|
53
53
|
|
|
54
|
-
blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent ||
|
|
54
|
+
blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent || blockType.parent.includes('core/post-content'))); // Announce search results on change
|
|
55
55
|
|
|
56
56
|
(0, _element.useEffect)(() => {
|
|
57
57
|
if (!search) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/index.js"],"names":["BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","debouncedSpeak","speak","search","setSearch","filter","blockType","parent","count","length","resultsFoundMessage","nextSearch","map","category","slug","title","select","getBlockTypes","getCategories","blocksStore","getHiddenBlockTypes","editPostStore","hiddenBlockTypes","hiddenBlock","some","registeredBlock","name","Array","isArray"],"mappings":";;;;;;;;;AAYA;;AATA;;AAKA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AApBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AAIA,SAASA,YAAT,OAMI;AAAA,MANmB;AACtBC,IAAAA,UADsB;AAEtBC,IAAAA,UAFsB;AAGtBC,IAAAA,eAHsB;AAItBC,IAAAA,oBAJsB;AAKtBC,IAAAA;AALsB,GAMnB;AACH,QAAMC,cAAc,GAAG,0BAAaC,WAAb,EAAoB,GAApB,CAAvB;AACA,QAAM,CAAEC,MAAF,EAAUC,SAAV,IAAwB,uBAAU,EAAV,CAA9B,CAFG,CAIH;AACA;AACA;;AACAR,EAAAA,UAAU,GAAGA,UAAU,CAACS,MAAX,CACVC,SAAF,IACCR,eAAe,CAAEQ,SAAF,EAAa,UAAb,EAAyB,IAAzB,CAAf,KACE,CAAEH,MAAF,IAAYJ,oBAAoB,CAAEO,SAAF,EAAaH,MAAb,CADlC,MAEE,CAAEG,SAAS,CAACC,MAAZ,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/index.js"],"names":["BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","debouncedSpeak","speak","search","setSearch","filter","blockType","parent","includes","count","length","resultsFoundMessage","nextSearch","map","category","slug","title","select","getBlockTypes","getCategories","blocksStore","getHiddenBlockTypes","editPostStore","hiddenBlockTypes","hiddenBlock","some","registeredBlock","name","Array","isArray"],"mappings":";;;;;;;;;AAYA;;AATA;;AAKA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AApBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AAIA,SAASA,YAAT,OAMI;AAAA,MANmB;AACtBC,IAAAA,UADsB;AAEtBC,IAAAA,UAFsB;AAGtBC,IAAAA,eAHsB;AAItBC,IAAAA,oBAJsB;AAKtBC,IAAAA;AALsB,GAMnB;AACH,QAAMC,cAAc,GAAG,0BAAaC,WAAb,EAAoB,GAApB,CAAvB;AACA,QAAM,CAAEC,MAAF,EAAUC,SAAV,IAAwB,uBAAU,EAAV,CAA9B,CAFG,CAIH;AACA;AACA;;AACAR,EAAAA,UAAU,GAAGA,UAAU,CAACS,MAAX,CACVC,SAAF,IACCR,eAAe,CAAEQ,SAAF,EAAa,UAAb,EAAyB,IAAzB,CAAf,KACE,CAAEH,MAAF,IAAYJ,oBAAoB,CAAEO,SAAF,EAAaH,MAAb,CADlC,MAEE,CAAEG,SAAS,CAACC,MAAZ,IAC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FlB;AAGC,IAAA,UAAU,EAAG,oBAAQpB,UAAR,EAAoB;AAChCkB,MAAAA,QAAQ,EAAEA,QAAQ,CAACC;AADa,KAApB;AAHd,IADC,CAXH,EAoBC,4BAAC,iBAAD;AACC,IAAA,KAAK,EAAG,cAAI,eAAJ,CADT;AAEC,IAAA,UAAU,EAAG,oBACZnB,UADY,EAEZ;AAAA,UAAE;AAAEkB,QAAAA;AAAF,OAAF;AAAA,aAAoB,CAAEA,QAAtB;AAAA,KAFY;AAFd,IApBD,CArBD,CADD;AAoDA;;eAEc,sBAAcG,MAAF,IAAc;AACxC,QAAM;AACLC,IAAAA,aADK;AAELC,IAAAA,aAFK;AAGLrB,IAAAA,eAHK;AAILC,IAAAA;AAJK,MAKFkB,MAAM,CAAEG,aAAF,CALV;AAMA,QAAM;AAAEC,IAAAA;AAAF,MAA0BJ,MAAM,CAAEK,YAAF,CAAtC,CAPwC,CASxC;AACA;AACA;AACA;AACA;;AACA,QAAM1B,UAAU,GAAGsB,aAAa,EAAhC;AACA,QAAMK,gBAAgB,GAAGF,mBAAmB,GAAGhB,MAAtB,CAAgCmB,WAAF,IAAmB;AACzE,WAAO5B,UAAU,CAAC6B,IAAX,CACJC,eAAF,IAAuBA,eAAe,CAACC,IAAhB,KAAyBH,WAD1C,CAAP;AAGA,GAJwB,CAAzB;AAKA,QAAMxB,oBAAoB,GACzB4B,KAAK,CAACC,OAAN,CAAeN,gBAAf,KAAqCA,gBAAgB,CAACb,MADvD;AAGA,SAAO;AACNd,IAAAA,UADM;AAENC,IAAAA,UAAU,EAAEsB,aAAa,EAFnB;AAGNrB,IAAAA,eAHM;AAINC,IAAAA,oBAJM;AAKNC,IAAAA;AALM,GAAP;AAOA,CA9Bc,EA8BVL,YA9BU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { filter } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { withSelect } from '@wordpress/data';\nimport { SearchControl } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockManagerCategory from './category';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManager( {\n\tblockTypes,\n\tcategories,\n\thasBlockSupport,\n\tisMatchingSearchTerm,\n\tnumberOfHiddenBlocks,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ search, setSearch ] = useState( '' );\n\n\t// Filtering occurs here (as opposed to `withSelect`) to avoid\n\t// wasted renders by consequence of `Array#filter` producing\n\t// a new value reference on each call.\n\tblockTypes = blockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! search || isMatchingSearchTerm( blockType, search ) ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tblockType.parent.includes( 'core/post-content' ) )\n\t);\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! search ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = blockTypes.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ blockTypes.length, search, debouncedSpeak ] );\n\n\treturn (\n\t\t<div className=\"edit-post-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"edit-post-block-manager__disabled-blocks-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d block is hidden.',\n\t\t\t\t\t\t\t'%d blocks are hidden.',\n\t\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<SearchControl\n\t\t\t\tlabel={ __( 'Search for a block' ) }\n\t\t\t\tplaceholder={ __( 'Search for a block' ) }\n\t\t\t\tvalue={ search }\n\t\t\t\tonChange={ ( nextSearch ) => setSearch( nextSearch ) }\n\t\t\t\tclassName=\"edit-post-block-manager__search\"\n\t\t\t/>\n\t\t\t<div\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"region\"\n\t\t\t\taria-label={ __( 'Available block types' ) }\n\t\t\t\tclassName=\"edit-post-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ blockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"edit-post-block-manager__no-results\">\n\t\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<BlockManagerCategory\n\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\tblockTypes={ filter( blockTypes, {\n\t\t\t\t\t\t\tcategory: category.slug,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t\t<BlockManagerCategory\n\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\tblockTypes={ filter(\n\t\t\t\t\t\tblockTypes,\n\t\t\t\t\t\t( { category } ) => ! category\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst {\n\t\tgetBlockTypes,\n\t\tgetCategories,\n\t\thasBlockSupport,\n\t\tisMatchingSearchTerm,\n\t} = select( blocksStore );\n\tconst { getHiddenBlockTypes } = select( editPostStore );\n\n\t// Some hidden blocks become unregistered\n\t// by removing for instance the plugin that registered them, yet\n\t// they're still remain as hidden by the user's action.\n\t// We consider \"hidden\", blocks which were hidden and\n\t// are still registered.\n\tconst blockTypes = getBlockTypes();\n\tconst hiddenBlockTypes = getHiddenBlockTypes().filter( ( hiddenBlock ) => {\n\t\treturn blockTypes.some(\n\t\t\t( registeredBlock ) => registeredBlock.name === hiddenBlock\n\t\t);\n\t} );\n\tconst numberOfHiddenBlocks =\n\t\tArray.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length;\n\n\treturn {\n\t\tblockTypes,\n\t\tcategories: getCategories(),\n\t\thasBlockSupport,\n\t\tisMatchingSearchTerm,\n\t\tnumberOfHiddenBlocks,\n\t};\n} )( BlockManager );\n"]}
|
|
@@ -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;;A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,SAAS,EACR,2CAFF;AAIC,IAAA,IAAI,EAAC,UAJN;AAKC,IAAA,mBAAmB,EAAGH,kBALvB;AAMC,IAAA,gBAAgB,EAAGE,QAAQ,GAAG,IAAH,GAAUgB,SANtC;AAOC,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"]}
|
|
@@ -83,12 +83,6 @@ function HeaderToolbar() {
|
|
|
83
83
|
const toolbarAriaLabel = (0, _i18n.__)('Document tools');
|
|
84
84
|
const toggleListView = (0, _element.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
|
|
85
85
|
const overflowItems = (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.ToolbarItem, {
|
|
86
|
-
as: _editor.TableOfContents,
|
|
87
|
-
hasOutlineItemsDisabled: isTextModeEnabled,
|
|
88
|
-
repositionDropdown: showIconLabels && !isWideViewport,
|
|
89
|
-
showTooltip: !showIconLabels,
|
|
90
|
-
variant: showIconLabels ? 'tertiary' : undefined
|
|
91
|
-
}), (0, _element.createElement)(_components.ToolbarItem, {
|
|
92
86
|
as: _components.Button,
|
|
93
87
|
className: "edit-post-header-toolbar__list-view-toggle",
|
|
94
88
|
icon: _icons.listView,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.js"],"names":["preventDefault","event","HeaderToolbar","inserterButton","setIsInserterOpened","setIsListViewOpened","editPostStore","isInserterEnabled","isInserterOpened","isTextModeEnabled","showIconLabels","isListViewOpen","listViewShortcut","select","hasInserterItems","getBlockRootClientId","getBlockSelectionEnd","blockEditorStore","getEditorSettings","editorStore","getEditorMode","isFeatureActive","isListViewOpened","getShortcutRepresentation","keyboardShortcutsStore","richEditingEnabled","isLargeViewport","isWideViewport","toolbarAriaLabel","toggleListView","overflowItems","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.js"],"names":["preventDefault","event","HeaderToolbar","inserterButton","setIsInserterOpened","setIsListViewOpened","editPostStore","isInserterEnabled","isInserterOpened","isTextModeEnabled","showIconLabels","isListViewOpen","listViewShortcut","select","hasInserterItems","getBlockRootClientId","getBlockSelectionEnd","blockEditorStore","getEditorSettings","editorStore","getEditorMode","isFeatureActive","isListViewOpened","getShortcutRepresentation","keyboardShortcutsStore","richEditingEnabled","isLargeViewport","isWideViewport","toolbarAriaLabel","toggleListView","overflowItems","Button","listView","undefined","openInserter","current","focus","longLabel","shortLabel","plus","ToolSelector","EditorHistoryUndo","EditorHistoryRedo"],"mappings":";;;;;;;AAkBA;;AAfA;;AACA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AAEA;;AAKA;;AAxBA;AACA;AACA;;AAmBA;AACA;AACA;AAGA,MAAMA,cAAc,GAAKC,KAAF,IAAa;AACnCA,EAAAA,KAAK,CAACD,cAAN;AACA,CAFD;;AAIA,SAASE,aAAT,GAAyB;AACxB,QAAMC,cAAc,GAAG,sBAAvB;AACA,QAAM;AAAEC,IAAAA,mBAAF;AAAuBC,IAAAA;AA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OC,IAAA,OAAO,EAAGkC,YAPX;AAQC,IAAA,QAAQ,EAAG,CAAE3B,iBARd;AASC,IAAA,IAAI,EAAGgC,WATR;AAUC,IAAA,KAAK,EAAG7B,cAAc,GAAG4B,UAAH,GAAgBD,SAVvC;AAWC,IAAA,WAAW,EAAG,CAAE3B;AAXjB,IADD,EAcG,CAAEiB,cAAc,IAAI,CAAEjB,cAAtB,KACD,qDACGgB,eAAe,IAChB,4BAAC,uBAAD;AACC,IAAA,EAAE,EAAGc,yBADN;AAEC,IAAA,WAAW,EAAG,CAAE9B,cAFjB;AAGC,IAAA,OAAO,EACNA,cAAc,GAAG,UAAH,GAAgBuB,SAJhC;AAMC,IAAA,QAAQ,EAAGxB;AANZ,IAFF,EAWC,4BAAC,uBAAD;AACC,IAAA,EAAE,EAAGgC,yBADN;AAEC,IAAA,WAAW,EAAG,CAAE/B,cAFjB;AAGC,IAAA,OAAO,EAAGA,cAAc,GAAG,UAAH,GAAgBuB;AAHzC,IAXD,EAgBC,4BAAC,uBAAD;AACC,IAAA,EAAE,EAAGS,yBADN;AAEC,IAAA,WAAW,EAAG,CAAEhC,cAFjB;AAGC,IAAA,OAAO,EAAGA,cAAc,GAAG,UAAH,GAAgBuB;AAHzC,IAhBD,EAqBGH,aArBH,CAfF,CAJD,CADD;AA+CA;;eAEc5B,a","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tNavigableToolbar,\n\tToolSelector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tEditorHistoryRedo,\n\tEditorHistoryUndo,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useRef, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nfunction HeaderToolbar() {\n\tconst inserterButton = useRef();\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editPostStore );\n\tconst {\n\t\tisInserterEnabled,\n\t\tisInserterOpened,\n\t\tisTextModeEnabled,\n\t\tshowIconLabels,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t} = useSelect( ( select ) => {\n\t\tconst { hasInserterItems, getBlockRootClientId, getBlockSelectionEnd } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst { getEditorMode, isFeatureActive, isListViewOpened } =\n\t\t\tselect( editPostStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\n\t\treturn {\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tisInserterEnabled:\n\t\t\t\tgetEditorMode() === 'visual' &&\n\t\t\t\tgetEditorSettings().richEditingEnabled &&\n\t\t\t\thasInserterItems(\n\t\t\t\t\tgetBlockRootClientId( getBlockSelectionEnd() )\n\t\t\t\t),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisTextModeEnabled: getEditorMode() === 'text',\n\t\t\tshowIconLabels: isFeatureActive( 'showIconLabels' ),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/edit-post/toggle-list-view'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\tconst overflowItems = (\n\t\t<>\n\t\t\t<ToolbarItem\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-post-header-toolbar__list-view-toggle\"\n\t\t\t\ticon={ listView }\n\t\t\t\tdisabled={ isTextModeEnabled }\n\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\tonClick={ toggleListView }\n\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t/>\n\t\t</>\n\t);\n\tconst openInserter = useCallback( () => {\n\t\tif ( isInserterOpened ) {\n\t\t\t// Focusing the inserter button closes the inserter popover.\n\t\t\tinserterButton.current.focus();\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpened, setIsInserterOpened ] );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-post-header-toolbar\"\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t>\n\t\t\t<div className=\"edit-post-header-toolbar__left\">\n\t\t\t\t<ToolbarItem\n\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tclassName=\"edit-post-header-toolbar__inserter-toggle\"\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\tonClick={ openInserter }\n\t\t\t\t\tdisabled={ ! isInserterEnabled }\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t/>\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ isTextModeEnabled }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryUndo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryRedo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ overflowItems }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default HeaderToolbar;\n"]}
|
|
@@ -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"));
|
|
@@ -55,25 +57,67 @@ function Header(_ref) {
|
|
|
55
57
|
isPublishSidebarOpened,
|
|
56
58
|
isSaving,
|
|
57
59
|
showIconLabels,
|
|
58
|
-
|
|
60
|
+
isDistractionFree
|
|
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
65
|
showIconLabels: select(_store.store).isFeatureActive('showIconLabels'),
|
|
64
|
-
|
|
66
|
+
isDistractionFree: select(_store.store).isFeatureActive('distractionFree')
|
|
65
67
|
}), []);
|
|
66
68
|
const isLargeViewport = (0, _compose.useViewportMatch)('large');
|
|
67
|
-
const classes = (0, _classnames.default)('edit-post-header'
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
const classes = (0, _classnames.default)('edit-post-header');
|
|
70
|
+
const slideY = {
|
|
71
|
+
hidden: isDistractionFree ? {
|
|
72
|
+
y: '-50'
|
|
73
|
+
} : {
|
|
74
|
+
y: 0
|
|
75
|
+
},
|
|
76
|
+
hover: {
|
|
77
|
+
y: 0,
|
|
78
|
+
transition: {
|
|
79
|
+
type: 'tween',
|
|
80
|
+
delay: 0.2
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const slideX = {
|
|
85
|
+
hidden: isDistractionFree ? {
|
|
86
|
+
x: '-100%'
|
|
87
|
+
} : {
|
|
88
|
+
x: 0
|
|
89
|
+
},
|
|
90
|
+
hover: {
|
|
91
|
+
x: 0,
|
|
92
|
+
transition: {
|
|
93
|
+
type: 'tween',
|
|
94
|
+
delay: 0.2
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
70
98
|
return (0, _element.createElement)("div", {
|
|
71
99
|
className: classes
|
|
72
|
-
}, (0, _element.createElement)(_mainDashboardButton.default.Slot, null, (0, _element.createElement)(
|
|
100
|
+
}, (0, _element.createElement)(_mainDashboardButton.default.Slot, null, (0, _element.createElement)(_components.__unstableMotion.div, {
|
|
101
|
+
variants: slideX,
|
|
102
|
+
transition: {
|
|
103
|
+
type: 'tween',
|
|
104
|
+
delay: 0.8
|
|
105
|
+
}
|
|
106
|
+
}, (0, _element.createElement)(_fullscreenModeClose.default, {
|
|
73
107
|
showTooltip: true
|
|
74
|
-
})), (0, _element.createElement)(
|
|
108
|
+
}))), (0, _element.createElement)(_components.__unstableMotion.div, {
|
|
109
|
+
variants: slideY,
|
|
110
|
+
transition: {
|
|
111
|
+
type: 'tween',
|
|
112
|
+
delay: 0.8
|
|
113
|
+
},
|
|
75
114
|
className: "edit-post-header__toolbar"
|
|
76
|
-
}, (0, _element.createElement)(_headerToolbar.default, null), (0, _element.createElement)(_templateTitle.default, null)), (0, _element.createElement)(
|
|
115
|
+
}, (0, _element.createElement)(_headerToolbar.default, null), (0, _element.createElement)(_templateTitle.default, null)), (0, _element.createElement)(_components.__unstableMotion.div, {
|
|
116
|
+
variants: slideY,
|
|
117
|
+
transition: {
|
|
118
|
+
type: 'tween',
|
|
119
|
+
delay: 0.8
|
|
120
|
+
},
|
|
77
121
|
className: "edit-post-header__settings"
|
|
78
122
|
}, !isPublishSidebarOpened && // This button isn't completely hidden by the publish sidebar.
|
|
79
123
|
// 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","hasActiveMetaboxes","isPublishSidebarOpened","isSaving","showIconLabels","isDistractionFree","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;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAGA;AAC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lBD,EAsBC,4BAAC,kCAAD;AACC,IAAA,YAAY,EAAGrB,kBADhB;AAEC,IAAA,aAAa,EAAGE,QAFjB;AAGC,IAAA,8BAA8B,EAC7BH;AAJF,IAtBD,EA6BG,CAAEW,eAAe,IAAI,CAAEP,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,CAAEO,eAApB,IACD,4BAAC,iBAAD;AAAU,IAAA,cAAc,EAAGP;AAA3B,IApCF,CAjBD,CADD;AA2DA;;eAEcL,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 } ) {\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"]}
|
|
@@ -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,46 @@ 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
|
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Internal dependencies
|
|
32
|
+
*/
|
|
23
33
|
function WritingMenu() {
|
|
34
|
+
const registry = (0, _data.useRegistry)();
|
|
35
|
+
const isDistractionFree = (0, _data.useSelect)(select => select(_blockEditor.store).getSettings().isDistractionFree, []);
|
|
36
|
+
const blocks = (0, _data.useSelect)(select => select(_blockEditor.store).getBlocks(), []);
|
|
37
|
+
const {
|
|
38
|
+
setIsInserterOpened,
|
|
39
|
+
setIsListViewOpened,
|
|
40
|
+
closeGeneralSidebar
|
|
41
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
42
|
+
const {
|
|
43
|
+
set: setPreference
|
|
44
|
+
} = (0, _data.useDispatch)(_preferences.store);
|
|
45
|
+
const {
|
|
46
|
+
selectBlock
|
|
47
|
+
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
48
|
+
|
|
49
|
+
const toggleDistractionFree = () => {
|
|
50
|
+
registry.batch(() => {
|
|
51
|
+
setPreference('core/edit-post', 'fixedToolbar', false);
|
|
52
|
+
setIsInserterOpened(false);
|
|
53
|
+
setIsListViewOpened(false);
|
|
54
|
+
closeGeneralSidebar();
|
|
55
|
+
|
|
56
|
+
if (!isDistractionFree && !!blocks.length) {
|
|
57
|
+
selectBlock(blocks[0].clientId);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
24
62
|
const isLargeViewport = (0, _compose.useViewportMatch)('medium');
|
|
25
63
|
|
|
26
64
|
if (!isLargeViewport) {
|
|
@@ -31,6 +69,7 @@ function WritingMenu() {
|
|
|
31
69
|
label: (0, _i18n._x)('View', 'noun')
|
|
32
70
|
}, (0, _element.createElement)(_preferences.PreferenceToggleMenuItem, {
|
|
33
71
|
scope: "core/edit-post",
|
|
72
|
+
disabled: isDistractionFree,
|
|
34
73
|
name: "fixedToolbar",
|
|
35
74
|
label: (0, _i18n.__)('Top toolbar'),
|
|
36
75
|
info: (0, _i18n.__)('Access all block and document tools in a single place'),
|
|
@@ -47,10 +86,19 @@ function WritingMenu() {
|
|
|
47
86
|
scope: "core/edit-post",
|
|
48
87
|
name: "fullscreenMode",
|
|
49
88
|
label: (0, _i18n.__)('Fullscreen mode'),
|
|
50
|
-
info: (0, _i18n.__)('
|
|
89
|
+
info: (0, _i18n.__)('Show and hide admin UI'),
|
|
51
90
|
messageActivated: (0, _i18n.__)('Fullscreen mode activated'),
|
|
52
91
|
messageDeactivated: (0, _i18n.__)('Fullscreen mode deactivated'),
|
|
53
92
|
shortcut: _keycodes.displayShortcut.secondary('f')
|
|
93
|
+
}), (0, _element.createElement)(_preferences.PreferenceToggleMenuItem, {
|
|
94
|
+
scope: "core/edit-post",
|
|
95
|
+
name: "distractionFree",
|
|
96
|
+
onToggle: toggleDistractionFree,
|
|
97
|
+
label: (0, _i18n.__)('Distraction free'),
|
|
98
|
+
info: (0, _i18n.__)('Write with calmness'),
|
|
99
|
+
messageActivated: (0, _i18n.__)('Distraction free mode activated'),
|
|
100
|
+
messageDeactivated: (0, _i18n.__)('Distraction free mode deactivated'),
|
|
101
|
+
shortcut: _keycodes.displayShortcut.primaryShift('\\')
|
|
54
102
|
}));
|
|
55
103
|
}
|
|
56
104
|
|
|
@@ -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","registry","isDistractionFree","select","blockEditorStore","getSettings","blocks","getBlocks","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","postEditorStore","set","setPreference","preferencesStore","selectBlock","toggleDistractionFree","batch","length","clientId","isLargeViewport","displayShortcut","secondary","primaryShift"],"mappings":";;;;;;;;;AAGA;;AACA;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AhB,CAA8B,IAA9B;AARZ,IA7BD,CADD;AA0CA;;eAEcvB,W","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"]}
|
|
@@ -7,14 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _element = require("@wordpress/element");
|
|
9
9
|
|
|
10
|
-
var _lodash = require("lodash");
|
|
11
|
-
|
|
12
10
|
var _keycodes = require("@wordpress/keycodes");
|
|
13
11
|
|
|
14
|
-
/**
|
|
15
|
-
* External dependencies
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
12
|
/**
|
|
19
13
|
* WordPress dependencies
|
|
20
14
|
*/
|
|
@@ -28,7 +22,7 @@ function KeyCombination(_ref) {
|
|
|
28
22
|
return (0, _element.createElement)("kbd", {
|
|
29
23
|
className: "edit-post-keyboard-shortcut-help-modal__shortcut-key-combination",
|
|
30
24
|
"aria-label": forceAriaLabel || ariaLabel
|
|
31
|
-
}, (
|
|
25
|
+
}, (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => {
|
|
32
26
|
if (character === '+') {
|
|
33
27
|
return (0, _element.createElement)(_element.Fragment, {
|
|
34
28
|
key: index
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/keyboard-shortcut-help-modal/shortcut.js"],"names":["KeyCombination","keyCombination","forceAriaLabel","shortcut","modifier","displayShortcutList","character","ariaLabel","shortcutAriaLabel","map","index","Shortcut","description","aliases","alias"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/keyboard-shortcut-help-modal/shortcut.js"],"names":["KeyCombination","keyCombination","forceAriaLabel","shortcut","modifier","displayShortcutList","character","ariaLabel","shortcutAriaLabel","Array","isArray","map","index","Shortcut","description","aliases","alias"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,SAASA,cAAT,OAA8D;AAAA,MAArC;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,GAAqC;AAC7D,QAAMC,QAAQ,GAAGF,cAAc,CAACG,QAAf,GACdC,8BAAqBJ,cAAc,CAACG,QAApC,EACAH,cAAc,CAACK,SADf,CADc,GAIdL,cAAc,CAACK,SAJlB;AAKA,QAAMC,SAAS,GAAGN,cAAc,CAACG,QAAf,GACfI,4BAAmBP,cAAc,CAACG,QAAlC,EACAH,cAAc,CAACK,SADf,CADe,GAIfL,cAAc,CAACK,SAJlB;AAMA,SACC;AACC,IAAA,SAAS,EAAC,kEADX;AAEC,kBAAaJ,cAAc,IAAIK;AAFhC,KAIG,CAAEE,KAAK,CAACC,OAAN,CAAeP,QAAf,IAA4BA,QAA5B,GAAuC,CAAEA,QAAF,CAAzC,EAAwDQ,GAAxD,CACD,CAAEL,SAAF,EAAaM,KAAb,KAAwB;AACvB,QAAKN,SAAS,KAAK,GAAnB,EAAyB;AACxB,aAAO,4BAAC,iBAAD;AAAU,QAAA,GAAG,EAAGM;AAAhB,SAA0BN,SAA1B,CAAP;AACA;;AAED,WACC;AACC,MAAA,GAAG,EAAGM,KADP;AAEC,MAAA,SAAS,EAAC;AAFX,OAIGN,SAJH,CADD;AAQA,GAdA,CAJH,CADD;AAuBA;;AAED,SAASO,QAAT,QAA8E;AAAA,MAA3D;AAAEC,IAAAA,WAAF;AAAeb,IAAAA,cAAf;AAA+Bc,IAAAA,OAAO,GAAG,EAAzC;AAA6CR,IAAAA;AAA7C,GAA2D;AAC7E,SACC,qDACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGO,WADH,CADD,EAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,cAAD;AACC,IAAA,cAAc,EAAGb,cADlB;AAEC,IAAA,cAAc,EAAGM;AAFlB,IADD,EAKGQ,OAAO,CAACJ,GAAR,CAAa,CAAEK,KAAF,EAASJ,KAAT,KACd,4BAAC,cAAD;AACC,IAAA,cAAc,EAAGI,KADlB;AAEC,IAAA,cAAc,EAAGT,SAFlB;AAGC,IAAA,GAAG,EAAGK;AAHP,IADC,CALH,CAJD,CADD;AAoBA;;eAEcC,Q","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"]}
|
|
@@ -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 distraction 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,16 @@ 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
|
+
createInfoNotice(isFeatureActive('distractionFree') ? (0, _i18n.__)('Distraction free mode turned on.') : (0, _i18n.__)('Distraction free mode turned off.'), {
|
|
171
|
+
id: 'core/edit-post/distraction-free-mode/notice',
|
|
172
|
+
type: 'snackbar'
|
|
173
|
+
});
|
|
174
|
+
});
|
|
136
175
|
(0, _keyboardShortcuts.useShortcut)('core/edit-post/toggle-sidebar', event => {
|
|
137
176
|
// This shortcut has no known clashes, but use preventDefault to prevent any
|
|
138
177
|
// obscure shortcuts from triggering.
|