@wordpress/edit-post 7.12.6 → 7.12.8
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/build/components/header/header-toolbar/index.js +7 -1
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +2 -1
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/post-trash/index.js +1 -5
- package/build/components/sidebar/post-trash/index.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +37 -6
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/plugins/index.js +35 -6
- package/build/plugins/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.js +6 -1
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +2 -1
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-trash/index.js +1 -4
- package/build-module/components/sidebar/post-trash/index.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +38 -7
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/plugins/index.js +33 -6
- package/build-module/plugins/index.js.map +1 -1
- package/build-style/style-rtl.css +10 -14
- package/build-style/style.css +10 -14
- package/package.json +18 -18
- package/src/components/block-manager/style.scss +1 -1
- package/src/components/header/header-toolbar/index.js +4 -1
- package/src/components/sidebar/post-status/index.js +1 -0
- package/src/components/sidebar/post-trash/index.js +1 -4
- package/src/hooks/commands/use-common-commands.js +39 -9
- package/src/plugins/index.js +32 -8
- package/src/style.scss +1 -7
|
@@ -23,6 +23,8 @@ var _icons = require("@wordpress/icons");
|
|
|
23
23
|
|
|
24
24
|
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
25
25
|
|
|
26
|
+
var _preferences = require("@wordpress/preferences");
|
|
27
|
+
|
|
26
28
|
var _store = require("../../../store");
|
|
27
29
|
|
|
28
30
|
var _lockUnlock = require("../../../lock-unlock");
|
|
@@ -48,6 +50,10 @@ function HeaderToolbar() {
|
|
|
48
50
|
setIsInserterOpened,
|
|
49
51
|
setIsListViewOpened
|
|
50
52
|
} = (0, _data.useDispatch)(_store.store);
|
|
53
|
+
const {
|
|
54
|
+
get: getPreference
|
|
55
|
+
} = (0, _data.useSelect)(_preferences.store);
|
|
56
|
+
const hasFixedToolbar = getPreference('core/edit-post', 'fixedToolbar');
|
|
51
57
|
const {
|
|
52
58
|
isInserterEnabled,
|
|
53
59
|
isInserterOpened,
|
|
@@ -143,7 +149,7 @@ function HeaderToolbar() {
|
|
|
143
149
|
icon: _icons.plus,
|
|
144
150
|
label: showIconLabels ? shortLabel : longLabel,
|
|
145
151
|
showTooltip: !showIconLabels
|
|
146
|
-
}), (isWideViewport || !showIconLabels) && (0, _element.createElement)(_element.Fragment, null, isLargeViewport && (0, _element.createElement)(_components.ToolbarItem, {
|
|
152
|
+
}), (isWideViewport || !showIconLabels) && (0, _element.createElement)(_element.Fragment, null, isLargeViewport && !hasFixedToolbar && (0, _element.createElement)(_components.ToolbarItem, {
|
|
147
153
|
as: _blockEditor.ToolSelector,
|
|
148
154
|
showTooltip: !showIconLabels,
|
|
149
155
|
variant: showIconLabels ? 'tertiary' : undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.js"],"names":["useShouldContextualToolbarShow","blockEditorPrivateApis","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","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","toolbarAriaLabel","toggleListView","overflowItems","Button","listView","undefined","toggleInserter","current","focus","longLabel","shortLabel","plus","ToolSelector","EditorHistoryUndo","EditorHistoryRedo"],"mappings":";;;;;;;AAmBA;;AAhBA;;AACA;;AACA;;AACA;;AAMA;;AAKA;;AACA;;AAEA;;AAKA;;AACA;;AA1BA;AACA;AACA;;AAoBA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAAqC,wBAAQC,wBAAR,CAA3C;;AAEA,MAAMC,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;AAAvB,MACL,uBAAaC,YAAb,CADD;AAEA,QAAM;AACLC,IAAAA,iBADK;AAELC,IAAAA,gBAFK;AAGLC,IAAAA,iBAHK;AAILC,IAAAA,cAJK;AAKLC,IAAAA,cALK;AAMLC,IAAAA;AANK,MAOF,qBAAaC,MAAF,IAAc;AAC5B,UAAM;AAAEC,MAAAA,gBAAF;AAAoBC,MAAAA,oBAApB;AAA0CC,MAAAA;AAA1C,QACLH,MAAM,CAAEI,kBAAF,CADP;AAEA,UAAM;AAAEC,MAAAA;AAAF,QAAwBL,MAAM,CAAEM,aAAF,CAApC;AACA,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA,eAAjB;AAAkCC,MAAAA;AAAlC,QACLT,MAAM,CAAEP,YAAF,CADP;AAEA,UAAM;AAAEiB,MAAAA;AAAF,QAAgCV,MAAM,CAAEW,wBAAF,CAA5C;AAEA,WAAO;AACN;AACAjB,MAAAA,iBAAiB,EAChBa,aAAa,OAAO,QAApB,IACAF,iBAAiB,GAAGO,kBADpB,IAEAX,gBAAgB,CACfC,oBAAoB,CAAEC,oBAAoB,EAAtB,CADL,CALX;AAQNR,MAAAA,gBAAgB,EAAEK,MAAM,CAAEP,YAAF,CAAN,CAAwBE,g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EAAE,EAAGoC,yBADN;AAEC,IAAA,WAAW,EAAG,CAAEnC,cAFjB;AAGC,IAAA,OAAO,EAAGA,cAAc,GAAG,UAAH,GAAgB2B;AAHzC,IAXD,EAgBC,4BAAC,uBAAD;AACC,IAAA,EAAE,EAAGS,yBADN;AAEC,IAAA,WAAW,EAAG,CAAEpC,cAFjB;AAGC,IAAA,OAAO,EAAGA,cAAc,GAAG,UAAH,GAAgB2B;AAHzC,IAhBD,EAqBGH,aArBH,CAfF,CALD,CADD;AAgDA;;eAEchC,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\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tEditorHistoryRedo,\n\tEditorHistoryUndo,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useRef, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nfunction HeaderToolbar() {\n\tconst inserterButton = useRef();\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editPostStore );\n\tconst {\n\t\tisInserterEnabled,\n\t\tisInserterOpened,\n\t\tisTextModeEnabled,\n\t\tshowIconLabels,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t} = useSelect( ( select ) => {\n\t\tconst { hasInserterItems, getBlockRootClientId, getBlockSelectionEnd } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst { getEditorMode, isFeatureActive, isListViewOpened } =\n\t\t\tselect( editPostStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\n\t\treturn {\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tisInserterEnabled:\n\t\t\t\tgetEditorMode() === 'visual' &&\n\t\t\t\tgetEditorSettings().richEditingEnabled &&\n\t\t\t\thasInserterItems(\n\t\t\t\t\tgetBlockRootClientId( getBlockSelectionEnd() )\n\t\t\t\t),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisTextModeEnabled: getEditorMode() === 'text',\n\t\t\tshowIconLabels: isFeatureActive( 'showIconLabels' ),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/edit-post/toggle-list-view'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\tconst overflowItems = (\n\t\t<>\n\t\t\t<ToolbarItem\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-post-header-toolbar__document-overview-toggle\"\n\t\t\t\ticon={ listView }\n\t\t\t\tdisabled={ isTextModeEnabled }\n\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\tlabel={ __( 'Document Overview' ) }\n\t\t\t\tonClick={ toggleListView }\n\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t/>\n\t\t</>\n\t);\n\tconst toggleInserter = useCallback( () => {\n\t\tif ( isInserterOpened ) {\n\t\t\t// Focusing the inserter button should close the inserter popover.\n\t\t\t// However, there are some cases it won't close when the focus is lost.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/43090 for more details.\n\t\t\tinserterButton.current.focus();\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpened, setIsInserterOpened ] );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-post-header-toolbar\"\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tshouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }\n\t\t>\n\t\t\t<div className=\"edit-post-header-toolbar__left\">\n\t\t\t\t<ToolbarItem\n\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tclassName=\"edit-post-header-toolbar__inserter-toggle\"\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\tdisabled={ ! isInserterEnabled }\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t/>\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"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.js"],"names":["useShouldContextualToolbarShow","blockEditorPrivateApis","preventDefault","event","HeaderToolbar","inserterButton","setIsInserterOpened","setIsListViewOpened","editPostStore","get","getPreference","preferencesStore","hasFixedToolbar","isInserterEnabled","isInserterOpened","isTextModeEnabled","showIconLabels","isListViewOpen","listViewShortcut","select","hasInserterItems","getBlockRootClientId","getBlockSelectionEnd","blockEditorStore","getEditorSettings","editorStore","getEditorMode","isFeatureActive","isListViewOpened","getShortcutRepresentation","keyboardShortcutsStore","richEditingEnabled","isLargeViewport","isWideViewport","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","toolbarAriaLabel","toggleListView","overflowItems","Button","listView","undefined","toggleInserter","current","focus","longLabel","shortLabel","plus","ToolSelector","EditorHistoryUndo","EditorHistoryRedo"],"mappings":";;;;;;;AAmBA;;AAhBA;;AACA;;AACA;;AACA;;AAMA;;AAKA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AA3BA;AACA;AACA;;AAqBA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAAqC,wBAAQC,wBAAR,CAA3C;;AAEA,MAAMC,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;AAAvB,MACL,uBAAaC,YAAb,CADD;AAEA,QAAM;AAAEC,IAAAA,GAAG,EAAEC;AAAP,MAAyB,qBAAWC,kBAAX,CAA/B;AACA,QAAMC,eAAe,GAAGF,aAAa,CAAE,gBAAF,EAAoB,cAApB,CAArC;AACA,QAAM;AACLG,IAAAA,iBADK;AAELC,IAAAA,gBAFK;AAGLC,IAAAA,iBAHK;AAILC,IAAAA,cAJK;AAKLC,IAAAA,cALK;AAMLC,IAAAA;AANK,MAOF,qBAAaC,MAAF,IAAc;AAC5B,UAAM;AAAEC,MAAAA,gBAAF;AAAoBC,MAAAA,oBAApB;AAA0CC,MAAAA;AAA1C,QACLH,MAAM,CAAEI,kBAAF,CADP;AAEA,UAAM;AAAEC,MAAAA;AAAF,QAAwBL,MAAM,CAAEM,aAAF,CAApC;AACA,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA,eAAjB;AAAkCC,MAAAA;AAAlC,QACLT,MAAM,CAAEX,YAAF,CADP;A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AXjB,IADD,EAcG,CAAEiB,cAAc,IAAI,CAAEjB,cAAtB,KACD,qDACGgB,eAAe,IAAI,CAAEpB,eAArB,IACD,4BAAC,uBAAD;AACC,IAAA,EAAE,EAAGsC,yBADN;AAEC,IAAA,WAAW,EAAG,CAAElC,cAFjB;AAGC,IAAA,OAAO,EACNA,cAAc,GAAG,UAAH,GAAgB2B,SAJhC;AAMC,IAAA,QAAQ,EAAG5B;AANZ,IAFF,EAWC,4BAAC,uBAAD;AACC,IAAA,EAAE,EAAGoC,yBADN;AAEC,IAAA,WAAW,EAAG,CAAEnC,cAFjB;AAGC,IAAA,OAAO,EAAGA,cAAc,GAAG,UAAH,GAAgB2B;AAHzC,IAXD,EAgBC,4BAAC,uBAAD;AACC,IAAA,EAAE,EAAGS,yBADN;AAEC,IAAA,WAAW,EAAG,CAAEpC,cAFjB;AAGC,IAAA,OAAO,EAAGA,cAAc,GAAG,UAAH,GAAgB2B;AAHzC,IAhBD,EAqBGH,aArBH,CAfF,CALD,CADD;AAgDA;;eAEcpC,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\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tEditorHistoryRedo,\n\tEditorHistoryUndo,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useRef, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nfunction HeaderToolbar() {\n\tconst inserterButton = useRef();\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editPostStore );\n\tconst { get: getPreference } = useSelect( preferencesStore );\n\tconst hasFixedToolbar = getPreference( 'core/edit-post', 'fixedToolbar' );\n\tconst {\n\t\tisInserterEnabled,\n\t\tisInserterOpened,\n\t\tisTextModeEnabled,\n\t\tshowIconLabels,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t} = useSelect( ( select ) => {\n\t\tconst { hasInserterItems, getBlockRootClientId, getBlockSelectionEnd } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst { getEditorMode, isFeatureActive, isListViewOpened } =\n\t\t\tselect( editPostStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\n\t\treturn {\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tisInserterEnabled:\n\t\t\t\tgetEditorMode() === 'visual' &&\n\t\t\t\tgetEditorSettings().richEditingEnabled &&\n\t\t\t\thasInserterItems(\n\t\t\t\t\tgetBlockRootClientId( getBlockSelectionEnd() )\n\t\t\t\t),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisTextModeEnabled: getEditorMode() === 'text',\n\t\t\tshowIconLabels: isFeatureActive( 'showIconLabels' ),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/edit-post/toggle-list-view'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\tconst overflowItems = (\n\t\t<>\n\t\t\t<ToolbarItem\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-post-header-toolbar__document-overview-toggle\"\n\t\t\t\ticon={ listView }\n\t\t\t\tdisabled={ isTextModeEnabled }\n\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\tlabel={ __( 'Document Overview' ) }\n\t\t\t\tonClick={ toggleListView }\n\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t/>\n\t\t</>\n\t);\n\tconst toggleInserter = useCallback( () => {\n\t\tif ( isInserterOpened ) {\n\t\t\t// Focusing the inserter button should close the inserter popover.\n\t\t\t// However, there are some cases it won't close when the focus is lost.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/43090 for more details.\n\t\t\tinserterButton.current.focus();\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpened, setIsInserterOpened ] );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-post-header-toolbar\"\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tshouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }\n\t\t>\n\t\t\t<div className=\"edit-post-header-toolbar__left\">\n\t\t\t\t<ToolbarItem\n\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tclassName=\"edit-post-header-toolbar__inserter-toggle\"\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\tdisabled={ ! isInserterEnabled }\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t/>\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && ! hasFixedToolbar && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ isTextModeEnabled }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryUndo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryRedo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ overflowItems }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default HeaderToolbar;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-status/index.js"],"names":["PANEL_NAME","PostStatus","isOpened","onTogglePanel","fills","marginTop","select","isEditorPanelRemoved","isEditorPanelOpened","editPostStore","isRemoved","dispatch","toggleEditorPanelOpened"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA1BA;AACA;AACA;;AAUA;AACA;AACA;;AAcA;AACA;AACA;AACA,MAAMA,UAAU,GAAG,aAAnB;;AAEA,SAASC,UAAT,CAAqB;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAArB,EAAmD;AAClD,SACC,4BAAC,qBAAD;AACC,IAAA,SAAS,EAAC,uBADX;AAEC,IAAA,KAAK,EAAG,cAAI,SAAJ,CAFT;AAGC,IAAA,MAAM,EAAGD,QAHV;AAIC,IAAA,QAAQ,EAAGC;AAJZ,KAMC,4BAAC,6BAAD,CAAsB,IAAtB,QACKC,KAAF,IACD,qDACC,4BAAC,uBAAD,OADD,EAEC,4BAAC,qBAAD,OAFD,EAGC,4BAAC,qBAAD,OAHD,EAIC,4BAAC,gBAAD,OAJD,EAKC,4BAAC,mBAAD,OALD,EAMC,4BAAC,0BAAD,OAND,EAOC,4BAAC,mBAAD,OAPD,EAQC,4BAAC,iBAAD,OARD,EASC,4BAAC,mBAAD,OATD,EAUC,4BAAC,sBAAD,OAVD,EAWGA,KAXH,EAYC,4BAAC,gCAAD;AACC,IAAA,KAAK,EAAG;AACPC,MAAAA,SAAS,EAAE;AADJ,KADT;AAIC,IAAA,OAAO,EAAG;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-status/index.js"],"names":["PANEL_NAME","PostStatus","isOpened","onTogglePanel","fills","marginTop","select","isEditorPanelRemoved","isEditorPanelOpened","editPostStore","isRemoved","dispatch","toggleEditorPanelOpened"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA1BA;AACA;AACA;;AAUA;AACA;AACA;;AAcA;AACA;AACA;AACA,MAAMA,UAAU,GAAG,aAAnB;;AAEA,SAASC,UAAT,CAAqB;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAArB,EAAmD;AAClD,SACC,4BAAC,qBAAD;AACC,IAAA,SAAS,EAAC,uBADX;AAEC,IAAA,KAAK,EAAG,cAAI,SAAJ,CAFT;AAGC,IAAA,MAAM,EAAGD,QAHV;AAIC,IAAA,QAAQ,EAAGC;AAJZ,KAMC,4BAAC,6BAAD,CAAsB,IAAtB,QACKC,KAAF,IACD,qDACC,4BAAC,uBAAD,OADD,EAEC,4BAAC,qBAAD,OAFD,EAGC,4BAAC,qBAAD,OAHD,EAIC,4BAAC,gBAAD,OAJD,EAKC,4BAAC,mBAAD,OALD,EAMC,4BAAC,0BAAD,OAND,EAOC,4BAAC,mBAAD,OAPD,EAQC,4BAAC,iBAAD,OARD,EASC,4BAAC,mBAAD,OATD,EAUC,4BAAC,sBAAD,OAVD,EAWGA,KAXH,EAYC,4BAAC,gCAAD;AACC,IAAA,KAAK,EAAG;AACPC,MAAAA,SAAS,EAAE;AADJ,KADT;AAIC,IAAA,OAAO,EAAG,CAJX;AAKC,IAAA,IAAI;AALL,KAOC,4BAAC,+BAAD,OAPD,EAQC,4BAAC,kBAAD,OARD,CAZD,CAFF,CAND,CADD;AAoCA;;eAEc,sBAAS,CACvB,sBAAcC,MAAF,IAAc;AACzB;AACA;AACA,QAAM;AAAEC,IAAAA,oBAAF;AAAwBC,IAAAA;AAAxB,MACLF,MAAM,CAAEG,YAAF,CADP;AAEA,SAAO;AACNC,IAAAA,SAAS,EAAEH,oBAAoB,CAAEP,UAAF,CADzB;AAENE,IAAAA,QAAQ,EAAEM,mBAAmB,CAAER,UAAF;AAFvB,GAAP;AAIA,CATD,CADuB,EAWvB,0BAAa,CAAE;AAAEU,EAAAA;AAAF,CAAF,KAAqB,CAAEA,SAApC,CAXuB,EAYvB,wBAAgBC,QAAF,KAAkB;AAC/BR,EAAAA,aAAa,GAAG;AACf,WAAOQ,QAAQ,CAAEF,YAAF,CAAR,CAA0BG,uBAA1B,CACNZ,UADM,CAAP;AAGA;;AAL8B,CAAlB,CAAd,CAZuB,CAAT,EAmBVC,UAnBU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalHStack as HStack,\n\tPanelBody,\n} from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose, ifCondition } from '@wordpress/compose';\nimport { PostSwitchToDraftButton, PostSyncStatus } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport PostVisibility from '../post-visibility';\nimport PostTrash from '../post-trash';\nimport PostSchedule from '../post-schedule';\nimport PostSticky from '../post-sticky';\nimport PostAuthor from '../post-author';\nimport PostSlug from '../post-slug';\nimport PostFormat from '../post-format';\nimport PostPendingStatus from '../post-pending-status';\nimport PluginPostStatusInfo from '../plugin-post-status-info';\nimport { store as editPostStore } from '../../../store';\nimport PostTemplate from '../post-template';\nimport PostURL from '../post-url';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'post-status';\n\nfunction PostStatus( { isOpened, onTogglePanel } ) {\n\treturn (\n\t\t<PanelBody\n\t\t\tclassName=\"edit-post-post-status\"\n\t\t\ttitle={ __( 'Summary' ) }\n\t\t\topened={ isOpened }\n\t\t\tonToggle={ onTogglePanel }\n\t\t>\n\t\t\t<PluginPostStatusInfo.Slot>\n\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PostVisibility />\n\t\t\t\t\t\t<PostSchedule />\n\t\t\t\t\t\t<PostTemplate />\n\t\t\t\t\t\t<PostURL />\n\t\t\t\t\t\t<PostSticky />\n\t\t\t\t\t\t<PostPendingStatus />\n\t\t\t\t\t\t<PostFormat />\n\t\t\t\t\t\t<PostSlug />\n\t\t\t\t\t\t<PostAuthor />\n\t\t\t\t\t\t<PostSyncStatus />\n\t\t\t\t\t\t{ fills }\n\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tmarginTop: '16px',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\t\t\twrap\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PostSwitchToDraftButton />\n\t\t\t\t\t\t\t<PostTrash />\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</PluginPostStatusInfo.Slot>\n\t\t</PanelBody>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\t// We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do\n\t\t// not use isEditorPanelEnabled since this panel should not be disabled through the UI.\n\t\tconst { isEditorPanelRemoved, isEditorPanelOpened } =\n\t\t\tselect( editPostStore );\n\t\treturn {\n\t\t\tisRemoved: isEditorPanelRemoved( PANEL_NAME ),\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t};\n\t} ),\n\tifCondition( ( { isRemoved } ) => ! isRemoved ),\n\twithDispatch( ( dispatch ) => ( {\n\t\tonTogglePanel() {\n\t\t\treturn dispatch( editPostStore ).toggleEditorPanelOpened(\n\t\t\t\tPANEL_NAME\n\t\t\t);\n\t\t},\n\t} ) ),\n] )( PostStatus );\n"]}
|
|
@@ -9,14 +9,10 @@ var _element = require("@wordpress/element");
|
|
|
9
9
|
|
|
10
10
|
var _editor = require("@wordpress/editor");
|
|
11
11
|
|
|
12
|
-
var _components = require("@wordpress/components");
|
|
13
|
-
|
|
14
12
|
/**
|
|
15
13
|
* WordPress dependencies
|
|
16
14
|
*/
|
|
17
15
|
function PostTrash() {
|
|
18
|
-
return (0, _element.createElement)(_editor.PostTrashCheck, null, (0, _element.createElement)(
|
|
19
|
-
isBlock: true
|
|
20
|
-
}, (0, _element.createElement)(_editor.PostTrash, null)));
|
|
16
|
+
return (0, _element.createElement)(_editor.PostTrashCheck, null, (0, _element.createElement)(_editor.PostTrash, null));
|
|
21
17
|
}
|
|
22
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-trash/index.js"],"names":["PostTrash"],"mappings":";;;;;;;;;AAGA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-trash/index.js"],"names":["PostTrash"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,SAAT,GAAqB;AACnC,SACC,4BAAC,sBAAD,QACC,4BAAC,iBAAD,OADD,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { PostTrash as PostTrashLink, PostTrashCheck } from '@wordpress/editor';\n\nexport default function PostTrash() {\n\treturn (\n\t\t<PostTrashCheck>\n\t\t\t<PostTrashLink />\n\t\t</PostTrashCheck>\n\t);\n}\n"]}
|
|
@@ -34,18 +34,27 @@ function useCommonCommands() {
|
|
|
34
34
|
const {
|
|
35
35
|
openGeneralSidebar,
|
|
36
36
|
closeGeneralSidebar,
|
|
37
|
-
switchEditorMode
|
|
37
|
+
switchEditorMode,
|
|
38
|
+
setIsListViewOpened
|
|
38
39
|
} = (0, _data.useDispatch)(_store.store);
|
|
39
40
|
const {
|
|
40
41
|
openModal
|
|
41
42
|
} = (0, _data.useDispatch)(_interface.store);
|
|
42
43
|
const {
|
|
43
44
|
editorMode,
|
|
44
|
-
activeSidebar
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
activeSidebar,
|
|
46
|
+
isListViewOpen
|
|
47
|
+
} = (0, _data.useSelect)(select => {
|
|
48
|
+
const {
|
|
49
|
+
getEditorMode,
|
|
50
|
+
isListViewOpened
|
|
51
|
+
} = select(_store.store);
|
|
52
|
+
return {
|
|
53
|
+
activeSidebar: select(_interface.store).getActiveComplementaryArea(_store.store.name),
|
|
54
|
+
editorMode: getEditorMode(),
|
|
55
|
+
isListViewOpen: isListViewOpened()
|
|
56
|
+
};
|
|
57
|
+
}, []);
|
|
49
58
|
const {
|
|
50
59
|
toggle
|
|
51
60
|
} = (0, _data.useDispatch)(_preferences.store);
|
|
@@ -103,6 +112,28 @@ function useCommonCommands() {
|
|
|
103
112
|
close();
|
|
104
113
|
}
|
|
105
114
|
});
|
|
115
|
+
(0, _commands.useCommand)({
|
|
116
|
+
name: 'core/toggle-fullscreen-mode',
|
|
117
|
+
label: (0, _i18n.__)('Toggle fullscreen mode'),
|
|
118
|
+
icon: _icons.desktop,
|
|
119
|
+
callback: ({
|
|
120
|
+
close
|
|
121
|
+
}) => {
|
|
122
|
+
toggle('core/edit-post', 'fullscreenMode');
|
|
123
|
+
close();
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
(0, _commands.useCommand)({
|
|
127
|
+
name: 'core/toggle-list-view',
|
|
128
|
+
label: (0, _i18n.__)('Toggle list view'),
|
|
129
|
+
icon: _icons.listView,
|
|
130
|
+
callback: ({
|
|
131
|
+
close
|
|
132
|
+
}) => {
|
|
133
|
+
setIsListViewOpened(!isListViewOpen);
|
|
134
|
+
close();
|
|
135
|
+
}
|
|
136
|
+
});
|
|
106
137
|
(0, _commands.useCommand)({
|
|
107
138
|
name: 'core/toggle-top-toolbar',
|
|
108
139
|
label: (0, _i18n.__)('Toggle top toolbar'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/hooks/commands/use-common-commands.js"],"names":["useCommonCommands","openGeneralSidebar","closeGeneralSidebar","switchEditorMode","editPostStore","openModal","interfaceStore","editorMode","activeSidebar","select","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/hooks/commands/use-common-commands.js"],"names":["useCommonCommands","openGeneralSidebar","closeGeneralSidebar","switchEditorMode","setIsListViewOpened","editPostStore","openModal","interfaceStore","editorMode","activeSidebar","isListViewOpen","select","getEditorMode","isListViewOpened","getActiveComplementaryArea","name","toggle","preferencesStore","label","icon","drawerLeft","drawerRight","callback","close","blockDefault","cog","desktop","listView","code","PREFERENCES_MODAL_NAME","keyboardClose","KEYBOARD_SHORTCUT_HELP_MODAL_NAME"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAUA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAiBA;AACA;AACA;AAKe,SAASA,iBAAT,GAA6B;AAC3C,QAAM;AACLC,IAAAA,kBADK;AAELC,IAAAA,mBAFK;AAGLC,IAAAA,gBAHK;AAILC,IAAAA;AAJK,MAKF,uBAAaC,YAAb,CALJ;AAMA,QAAM;AAAEC,IAAAA;AAAF,MAAgB,uBAAaC,gBAAb,CAAtB;AACA,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,aAAd;AAA6BC,IAAAA;AAA7B,MAAgD,qBACnDC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA;AAAjB,QAAsCF,MAAM,CAAEN,YAAF,CAAlD;AACA,WAAO;AACNI,MAAAA,aAAa,EAAEE,MAAM,CACpBJ,gBADoB,CAAN,CAEbO,0BAFa,CAEeT,aAAcU,IAF7B,CADT;AAINP,MAAAA,UAAU,EAAEI,aAAa,EAJnB;AAKNF,MAAAA,cAAc,EAAEG,gBAAgB;AAL1B,KAAP;AAOA,GAVoD,EAWrD,EAXqD,CAAtD;AAaA,QAAM;AAAEG,IAAAA;AAAF,MAAa,uBAAaC,kBAAb,CAAnB;AAEA,4BAAY;AACXF,IAAAA,IAAI,EAAE,4BADK;AAEXG,IA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EAAE,uBADK;AAEXG,IAAAA,KAAK,EAAE,cAAI,yBAAJ,CAFI;AAGXC,IAAAA,IAAI,EAAEM,UAHK;AAIXH,IAAAA,QAAQ,EAAE,MAAM;AACfhB,MAAAA,SAAS,CAAEuB,wCAAF,CAAT;AACA;AANU,GAAZ;AASA,4BAAY;AACXd,IAAAA,IAAI,EAAE,yBADK;AAEXG,IAAAA,KAAK,EAAE,cAAI,yBAAJ,CAFI;AAGXC,IAAAA,IAAI,EAAEW,oBAHK;AAIXR,IAAAA,QAAQ,EAAE,MAAM;AACfhB,MAAAA,SAAS,CAAEyB,4DAAF,CAAT;AACA;AANU,GAAZ;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tcode,\n\tcog,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tkeyboardClose,\n\tdesktop,\n\tlistView,\n} from '@wordpress/icons';\nimport { useCommand } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { store as editPostStore } from '../../store';\n\nexport default function useCommonCommands() {\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\tswitchEditorMode,\n\t\tsetIsListViewOpened,\n\t} = useDispatch( editPostStore );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { editorMode, activeSidebar, isListViewOpen } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorMode, isListViewOpened } = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tactiveSidebar: select(\n\t\t\t\t\tinterfaceStore\n\t\t\t\t).getActiveComplementaryArea( editPostStore.name ),\n\t\t\t\teditorMode: getEditorMode(),\n\t\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tuseCommand( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/document' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: __( 'Toggle distraction free' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'distractionFree' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight mode' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'focusMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-fullscreen-mode',\n\t\tlabel: __( 'Toggle fullscreen mode' ),\n\t\ticon: desktop,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-list-view',\n\t\tlabel: __( 'Toggle list view' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fixedToolbar' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-code-editor',\n\t\tlabel: __( 'Toggle code editor' ),\n\t\ticon: code,\n\t\tcallback: ( { close } ) => {\n\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Open editor preferences' ),\n\t\ticon: cog,\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Open keyboard shortcuts' ),\n\t\ticon: keyboardClose,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n}\n"]}
|
package/build/plugins/index.js
CHANGED
|
@@ -6,6 +6,12 @@ var _element = require("@wordpress/element");
|
|
|
6
6
|
|
|
7
7
|
var _components = require("@wordpress/components");
|
|
8
8
|
|
|
9
|
+
var _coreData = require("@wordpress/core-data");
|
|
10
|
+
|
|
11
|
+
var _editor = require("@wordpress/editor");
|
|
12
|
+
|
|
13
|
+
var _data = require("@wordpress/data");
|
|
14
|
+
|
|
9
15
|
var _icons = require("@wordpress/icons");
|
|
10
16
|
|
|
11
17
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -29,16 +35,39 @@ var _welcomeGuideMenuItem = _interopRequireDefault(require("./welcome-guide-menu
|
|
|
29
35
|
/**
|
|
30
36
|
* Internal dependencies
|
|
31
37
|
*/
|
|
38
|
+
function ManagePatternsMenuItem() {
|
|
39
|
+
const url = (0, _data.useSelect)(select => {
|
|
40
|
+
const {
|
|
41
|
+
canUser
|
|
42
|
+
} = select(_coreData.store);
|
|
43
|
+
const {
|
|
44
|
+
getEditorSettings
|
|
45
|
+
} = select(_editor.store);
|
|
46
|
+
|
|
47
|
+
const isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme;
|
|
48
|
+
|
|
49
|
+
const defaultUrl = (0, _url.addQueryArgs)('edit.php', {
|
|
50
|
+
post_type: 'wp_block'
|
|
51
|
+
});
|
|
52
|
+
const patternsUrl = (0, _url.addQueryArgs)('site-editor.php', {
|
|
53
|
+
path: '/patterns'
|
|
54
|
+
}); // The site editor and templates both check whether the user has
|
|
55
|
+
// edit_theme_options capabilities. We can leverage that here and not
|
|
56
|
+
// display the manage patterns link if the user can't access it.
|
|
57
|
+
|
|
58
|
+
return canUser('read', 'templates') && isBlockTheme ? patternsUrl : defaultUrl;
|
|
59
|
+
}, []);
|
|
60
|
+
return (0, _element.createElement)(_components.MenuItem, {
|
|
61
|
+
role: "menuitem",
|
|
62
|
+
href: url
|
|
63
|
+
}, (0, _i18n.__)('Manage Patterns'));
|
|
64
|
+
}
|
|
65
|
+
|
|
32
66
|
(0, _plugins.registerPlugin)('edit-post', {
|
|
33
67
|
render() {
|
|
34
68
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_toolsMoreMenuGroup.default, null, ({
|
|
35
69
|
onClose
|
|
36
|
-
}) => (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(
|
|
37
|
-
role: "menuitem",
|
|
38
|
-
href: (0, _url.addQueryArgs)('edit.php', {
|
|
39
|
-
post_type: 'wp_block'
|
|
40
|
-
})
|
|
41
|
-
}, (0, _i18n.__)('Manage Patterns')), (0, _element.createElement)(_keyboardShortcutsHelpMenuItem.default, {
|
|
70
|
+
}) => (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(ManagePatternsMenuItem, null), (0, _element.createElement)(_keyboardShortcutsHelpMenuItem.default, {
|
|
42
71
|
onSelect: onClose
|
|
43
72
|
}), (0, _element.createElement)(_welcomeGuideMenuItem.default, null), (0, _element.createElement)(_copyContentMenuItem.default, null), (0, _element.createElement)(_components.MenuItem, {
|
|
44
73
|
role: "menuitem",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["ManagePatternsMenuItem","url","select","canUser","coreStore","getEditorSettings","editorStore","isBlockTheme","__unstableIsBlockBasedTheme","defaultUrl","post_type","patternsUrl","path","render","onClose","external"],"mappings":";;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAUA;AACA;AACA;AAMA,SAASA,sBAAT,GAAkC;AACjC,QAAMC,GAAG,GAAG,qBAAaC,MAAF,IAAc;AACpC,UAAM;AAAEC,MAAAA;AAAF,QAAcD,MAAM,CAAEE,eAAF,CAA1B;AACA,UAAM;AAAEC,MAAAA;AAAF,QAAwBH,MAAM,CAAEI,aAAF,CAApC;;AAEA,UAAMC,YAAY,GAAGF,iBAAiB,GAAGG,2BAAzC;;AACA,UAAMC,UAAU,GAAG,uBAAc,UAAd,EAA0B;AAC5CC,MAAAA,SAAS,EAAE;AADiC,KAA1B,CAAnB;AAGA,UAAMC,WAAW,GAAG,uBAAc,iBAAd,EAAiC;AACpDC,MAAAA,IAAI,EAAE;AAD8C,KAAjC,CAApB,CARoC,CAYpC;AACA;AACA;;AACA,WAAOT,OAAO,CAAE,MAAF,EAAU,WAAV,CAAP,IAAkCI,YAAlC,GACJI,WADI,GAEJF,UAFH;AAGA,GAlBW,EAkBT,EAlBS,CAAZ;AAoBA,SACC,4BAAC,oBAAD;AAAU,IAAA,IAAI,EAAC,UAAf;AAA0B,IAAA,IAAI,EAAGR;AAAjC,KACG,cAAI,iBAAJ,CADH,CADD;AAKA;;AAED,6BAAgB,WAAhB,EAA6B;AAC5BY,EAAAA,MAAM,GAAG;AACR,WACC,qDACC,4BAAC,2BAAD,QACG,CAAE;AAAEC,MAAAA;AAAF,KAAF,KACD,qDACC,4BAAC,sBAAD,OADD,EAEC,4BAAC,sCAAD;AACC,MAAA,QAAQ,EAAGA;AADZ,MAFD,EAKC,4BAAC,6BAAD,OALD,EAMC,4BAAC,4BAAD,OAND,EAOC,4BAAC,oBAAD;AACC,MAAA,IAAI,EAAC,UADN;AAEC,MAAA,IAAI,EAAGC,eAFR;AAGC,MAAA,IAAI,EAAG,cACN,qEADM,CAHR;AAMC,MAAA,MAAM,EAAC,QANR;AAOC,MAAA,GAAG,EAAC;AAPL,OASG,cAAI,MAAJ,CATH,EAUC,4BAAC,0BAAD;AAAgB,MAAA,EAAE,EAAC;AAAnB;AAEE;AACA,kBAAI,sBAAJ,CAHF,CAVD,CAPD,CAFF,CADD,CADD;AAiCA;;AAnC2B,CAA7B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { external } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { registerPlugin } from '@wordpress/plugins';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport CopyContentMenuItem from './copy-content-menu-item';\nimport KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';\nimport ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\n\nfunction ManagePatternsMenuItem() {\n\tconst url = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\n\t\tconst isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme;\n\t\tconst defaultUrl = addQueryArgs( 'edit.php', {\n\t\t\tpost_type: 'wp_block',\n\t\t} );\n\t\tconst patternsUrl = addQueryArgs( 'site-editor.php', {\n\t\t\tpath: '/patterns',\n\t\t} );\n\n\t\t// The site editor and templates both check whether the user has\n\t\t// edit_theme_options capabilities. We can leverage that here and not\n\t\t// display the manage patterns link if the user can't access it.\n\t\treturn canUser( 'read', 'templates' ) && isBlockTheme\n\t\t\t? patternsUrl\n\t\t\t: defaultUrl;\n\t}, [] );\n\n\treturn (\n\t\t<MenuItem role=\"menuitem\" href={ url }>\n\t\t\t{ __( 'Manage Patterns' ) }\n\t\t</MenuItem>\n\t);\n}\n\nregisterPlugin( 'edit-post', {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ManagePatternsMenuItem />\n\t\t\t\t\t\t\t<KeyboardShortcutsHelpMenuItem\n\t\t\t\t\t\t\t\tonSelect={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t\t\t\t\t<CopyContentMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsMoreMenuGroup>\n\t\t\t</>\n\t\t);\n\t},\n} );\n"]}
|
|
@@ -12,6 +12,7 @@ import { Button, ToolbarItem } from '@wordpress/components';
|
|
|
12
12
|
import { listView, plus } from '@wordpress/icons';
|
|
13
13
|
import { useRef, useCallback } from '@wordpress/element';
|
|
14
14
|
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
15
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
15
16
|
/**
|
|
16
17
|
* Internal dependencies
|
|
17
18
|
*/
|
|
@@ -32,6 +33,10 @@ function HeaderToolbar() {
|
|
|
32
33
|
setIsInserterOpened,
|
|
33
34
|
setIsListViewOpened
|
|
34
35
|
} = useDispatch(editPostStore);
|
|
36
|
+
const {
|
|
37
|
+
get: getPreference
|
|
38
|
+
} = useSelect(preferencesStore);
|
|
39
|
+
const hasFixedToolbar = getPreference('core/edit-post', 'fixedToolbar');
|
|
35
40
|
const {
|
|
36
41
|
isInserterEnabled,
|
|
37
42
|
isInserterOpened,
|
|
@@ -129,7 +134,7 @@ function HeaderToolbar() {
|
|
|
129
134
|
icon: plus,
|
|
130
135
|
label: showIconLabels ? shortLabel : longLabel,
|
|
131
136
|
showTooltip: !showIconLabels
|
|
132
|
-
}), (isWideViewport || !showIconLabels) && createElement(Fragment, null, isLargeViewport && createElement(ToolbarItem, {
|
|
137
|
+
}), (isWideViewport || !showIconLabels) && createElement(Fragment, null, isLargeViewport && !hasFixedToolbar && createElement(ToolbarItem, {
|
|
133
138
|
as: ToolSelector,
|
|
134
139
|
showTooltip: !showIconLabels,
|
|
135
140
|
variant: showIconLabels ? 'tertiary' : undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.js"],"names":["useViewportMatch","useSelect","useDispatch","__","_x","NavigableToolbar","ToolSelector","store","blockEditorStore","privateApis","blockEditorPrivateApis","EditorHistoryRedo","EditorHistoryUndo","editorStore","Button","ToolbarItem","listView","plus","useRef","useCallback","keyboardShortcutsStore","editPostStore","unlock","useShouldContextualToolbarShow","preventDefault","event","HeaderToolbar","inserterButton","setIsInserterOpened","setIsListViewOpened","isInserterEnabled","isInserterOpened","isTextModeEnabled","showIconLabels","isListViewOpen","listViewShortcut","select","hasInserterItems","getBlockRootClientId","getBlockSelectionEnd","getEditorSettings","getEditorMode","isFeatureActive","isListViewOpened","getShortcutRepresentation","richEditingEnabled","isLargeViewport","isWideViewport","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","toolbarAriaLabel","toggleListView","overflowItems","undefined","toggleInserter","current","focus","longLabel","shortLabel"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,gBAAT,QAAiC,oBAAjC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SACCC,gBADD,EAECC,YAFD,EAGCC,KAAK,IAAIC,gBAHV,EAICC,WAAW,IAAIC,sBAJhB,QAKO,yBALP;AAMA,SACCC,iBADD,EAECC,iBAFD,EAGCL,KAAK,IAAIM,WAHV,QAIO,mBAJP;AAKA,SAASC,MAAT,EAAiBC,WAAjB,QAAoC,uBAApC;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA+B,kBAA/B;AACA,SAASC,MAAT,EAAiBC,WAAjB,QAAoC,oBAApC;AACA,SAASZ,KAAK,IAAIa,sBAAlB,QAAgD,+BAAhD;AAEA;AACA;AACA;;AACA,SAASb,KAAK,IAAIc,aAAlB,QAAuC,gBAAvC;AACA,SAASC,MAAT,QAAuB,sBAAvB;AAEA,MAAM;AAAEC,EAA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IAAA,EAAE,EAAG5C,iBADN;AAEC,IAAA,WAAW,EAAG,CAAEsB,cAFjB;AAGC,IAAA,OAAO,EAAGA,cAAc,GAAG,UAAH,GAAgBsB;AAHzC,IAhBD,EAqBGD,aArBH,CAfF,CALD,CADD;AAgDA;;AAED,eAAe5B,aAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tNavigableToolbar,\n\tToolSelector,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tEditorHistoryRedo,\n\tEditorHistoryUndo,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useRef, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nfunction HeaderToolbar() {\n\tconst inserterButton = useRef();\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editPostStore );\n\tconst {\n\t\tisInserterEnabled,\n\t\tisInserterOpened,\n\t\tisTextModeEnabled,\n\t\tshowIconLabels,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t} = useSelect( ( select ) => {\n\t\tconst { hasInserterItems, getBlockRootClientId, getBlockSelectionEnd } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst { getEditorMode, isFeatureActive, isListViewOpened } =\n\t\t\tselect( editPostStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\n\t\treturn {\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tisInserterEnabled:\n\t\t\t\tgetEditorMode() === 'visual' &&\n\t\t\t\tgetEditorSettings().richEditingEnabled &&\n\t\t\t\thasInserterItems(\n\t\t\t\t\tgetBlockRootClientId( getBlockSelectionEnd() )\n\t\t\t\t),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisTextModeEnabled: getEditorMode() === 'text',\n\t\t\tshowIconLabels: isFeatureActive( 'showIconLabels' ),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/edit-post/toggle-list-view'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\tconst overflowItems = (\n\t\t<>\n\t\t\t<ToolbarItem\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-post-header-toolbar__document-overview-toggle\"\n\t\t\t\ticon={ listView }\n\t\t\t\tdisabled={ isTextModeEnabled }\n\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\tlabel={ __( 'Document Overview' ) }\n\t\t\t\tonClick={ toggleListView }\n\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t/>\n\t\t</>\n\t);\n\tconst toggleInserter = useCallback( () => {\n\t\tif ( isInserterOpened ) {\n\t\t\t// Focusing the inserter button should close the inserter popover.\n\t\t\t// However, there are some cases it won't close when the focus is lost.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/43090 for more details.\n\t\t\tinserterButton.current.focus();\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpened, setIsInserterOpened ] );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-post-header-toolbar\"\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tshouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }\n\t\t>\n\t\t\t<div className=\"edit-post-header-toolbar__left\">\n\t\t\t\t<ToolbarItem\n\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tclassName=\"edit-post-header-toolbar__inserter-toggle\"\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\tdisabled={ ! isInserterEnabled }\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t/>\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"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.js"],"names":["useViewportMatch","useSelect","useDispatch","__","_x","NavigableToolbar","ToolSelector","store","blockEditorStore","privateApis","blockEditorPrivateApis","EditorHistoryRedo","EditorHistoryUndo","editorStore","Button","ToolbarItem","listView","plus","useRef","useCallback","keyboardShortcutsStore","preferencesStore","editPostStore","unlock","useShouldContextualToolbarShow","preventDefault","event","HeaderToolbar","inserterButton","setIsInserterOpened","setIsListViewOpened","get","getPreference","hasFixedToolbar","isInserterEnabled","isInserterOpened","isTextModeEnabled","showIconLabels","isListViewOpen","listViewShortcut","select","hasInserterItems","getBlockRootClientId","getBlockSelectionEnd","getEditorSettings","getEditorMode","isFeatureActive","isListViewOpened","getShortcutRepresentation","richEditingEnabled","isLargeViewport","isWideViewport","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","toolbarAriaLabel","toggleListView","overflowItems","undefined","toggleInserter","current","focus","longLabel","shortLabel"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,gBAAT,QAAiC,oBAAjC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SACCC,gBADD,EAECC,YAFD,EAGCC,KAAK,IAAIC,gBAHV,EAICC,WAAW,IAAIC,sBAJhB,QAKO,yBALP;AAMA,SACCC,iBADD,EAECC,iBAFD,EAGCL,KAAK,IAAIM,WAHV,QAIO,mBAJP;AAKA,SAASC,MAAT,EAAiBC,WAAjB,QAAoC,uBAApC;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA+B,kBAA/B;AACA,SAASC,MAAT,EAAiBC,WAAjB,QAAoC,oBAApC;AACA,SAASZ,KAAK,IAAIa,sBAAlB,QAAgD,+BAAhD;AACA,SAASb,KAAK,IAAIc,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,SAASd,KAAK,IAAIe,aAAlB,QAAuC,gBAAvC;AACA,SAASC,MAAT,QAAuB,sBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAqCD,MAAM,CAAEb,sBAAF,CAAjD;;AAEA,MAAMe,cAAc,GAAKC,KAAF,IAAa;AACnCA,EAAAA,KAAK,CAACD,cAAN;AACA,CAFD;;AAIA,SAASE,aAAT,GAAyB;AACxB,QAAMC,cAAc,GAAGV,MAAM,EAA7B;AACA,QAAM;AAAEW,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MACL5B,WAAW,CAAEoB,aAAF,CADZ;AAEA,QAAM;AAAES,IAAAA,GAAG,EAAEC;AAAP,MAAyB/B,SAAS,CAAEoB,gBAAF,CAAxC;AACA,QAAMY,eAAe,GAAG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port { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tNavigableToolbar,\n\tToolSelector,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tEditorHistoryRedo,\n\tEditorHistoryUndo,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useRef, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nfunction HeaderToolbar() {\n\tconst inserterButton = useRef();\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editPostStore );\n\tconst { get: getPreference } = useSelect( preferencesStore );\n\tconst hasFixedToolbar = getPreference( 'core/edit-post', 'fixedToolbar' );\n\tconst {\n\t\tisInserterEnabled,\n\t\tisInserterOpened,\n\t\tisTextModeEnabled,\n\t\tshowIconLabels,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t} = useSelect( ( select ) => {\n\t\tconst { hasInserterItems, getBlockRootClientId, getBlockSelectionEnd } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst { getEditorMode, isFeatureActive, isListViewOpened } =\n\t\t\tselect( editPostStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\n\t\treturn {\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tisInserterEnabled:\n\t\t\t\tgetEditorMode() === 'visual' &&\n\t\t\t\tgetEditorSettings().richEditingEnabled &&\n\t\t\t\thasInserterItems(\n\t\t\t\t\tgetBlockRootClientId( getBlockSelectionEnd() )\n\t\t\t\t),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisTextModeEnabled: getEditorMode() === 'text',\n\t\t\tshowIconLabels: isFeatureActive( 'showIconLabels' ),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/edit-post/toggle-list-view'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\tconst overflowItems = (\n\t\t<>\n\t\t\t<ToolbarItem\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-post-header-toolbar__document-overview-toggle\"\n\t\t\t\ticon={ listView }\n\t\t\t\tdisabled={ isTextModeEnabled }\n\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\tlabel={ __( 'Document Overview' ) }\n\t\t\t\tonClick={ toggleListView }\n\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t/>\n\t\t</>\n\t);\n\tconst toggleInserter = useCallback( () => {\n\t\tif ( isInserterOpened ) {\n\t\t\t// Focusing the inserter button should close the inserter popover.\n\t\t\t// However, there are some cases it won't close when the focus is lost.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/43090 for more details.\n\t\t\tinserterButton.current.focus();\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpened, setIsInserterOpened ] );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-post-header-toolbar\"\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tshouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }\n\t\t>\n\t\t\t<div className=\"edit-post-header-toolbar__left\">\n\t\t\t\t<ToolbarItem\n\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tclassName=\"edit-post-header-toolbar__inserter-toggle\"\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\tdisabled={ ! isInserterEnabled }\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t/>\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && ! hasFixedToolbar && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ isTextModeEnabled }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryUndo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryRedo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ overflowItems }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default HeaderToolbar;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-status/index.js"],"names":["__","__experimentalHStack","HStack","PanelBody","withSelect","withDispatch","compose","ifCondition","PostSwitchToDraftButton","PostSyncStatus","PostVisibility","PostTrash","PostSchedule","PostSticky","PostAuthor","PostSlug","PostFormat","PostPendingStatus","PluginPostStatusInfo","store","editPostStore","PostTemplate","PostURL","PANEL_NAME","PostStatus","isOpened","onTogglePanel","fills","marginTop","select","isEditorPanelRemoved","isEditorPanelOpened","isRemoved","dispatch","toggleEditorPanelOpened"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,oBAAoB,IAAIC,MADzB,EAECC,SAFD,QAGO,uBAHP;AAIA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,EAAkBC,WAAlB,QAAqC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idebar/post-status/index.js"],"names":["__","__experimentalHStack","HStack","PanelBody","withSelect","withDispatch","compose","ifCondition","PostSwitchToDraftButton","PostSyncStatus","PostVisibility","PostTrash","PostSchedule","PostSticky","PostAuthor","PostSlug","PostFormat","PostPendingStatus","PluginPostStatusInfo","store","editPostStore","PostTemplate","PostURL","PANEL_NAME","PostStatus","isOpened","onTogglePanel","fills","marginTop","select","isEditorPanelRemoved","isEditorPanelOpened","isRemoved","dispatch","toggleEditorPanelOpened"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,oBAAoB,IAAIC,MADzB,EAECC,SAFD,QAGO,uBAHP;AAIA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,EAAkBC,WAAlB,QAAqC,oBAArC;AACA,SAASC,uBAAT,EAAkCC,cAAlC,QAAwD,mBAAxD;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,SAAP,MAAsB,eAAtB;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,QAAP,MAAqB,cAArB;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,iBAAP,MAA8B,wBAA9B;AACA,OAAOC,oBAAP,MAAiC,4BAAjC;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,gBAAvC;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,OAAP,MAAoB,aAApB;AAEA;AACA;AACA;;AACA,MAAMC,UAAU,GAAG,aAAnB;;AAEA,SAASC,UAAT,CAAqB;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAArB,EAAmD;AAClD,SACC,cAAC,SAAD;AACC,IAAA,SAAS,EAAC,uBADX;AAEC,IAAA,KAAK,EAAG1B,EAAE,CAAE,SAAF,CAFX;AAGC,I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\tPanelBody,\n} from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose, ifCondition } from '@wordpress/compose';\nimport { PostSwitchToDraftButton, PostSyncStatus } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport PostVisibility from '../post-visibility';\nimport PostTrash from '../post-trash';\nimport PostSchedule from '../post-schedule';\nimport PostSticky from '../post-sticky';\nimport PostAuthor from '../post-author';\nimport PostSlug from '../post-slug';\nimport PostFormat from '../post-format';\nimport PostPendingStatus from '../post-pending-status';\nimport PluginPostStatusInfo from '../plugin-post-status-info';\nimport { store as editPostStore } from '../../../store';\nimport PostTemplate from '../post-template';\nimport PostURL from '../post-url';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'post-status';\n\nfunction PostStatus( { isOpened, onTogglePanel } ) {\n\treturn (\n\t\t<PanelBody\n\t\t\tclassName=\"edit-post-post-status\"\n\t\t\ttitle={ __( 'Summary' ) }\n\t\t\topened={ isOpened }\n\t\t\tonToggle={ onTogglePanel }\n\t\t>\n\t\t\t<PluginPostStatusInfo.Slot>\n\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PostVisibility />\n\t\t\t\t\t\t<PostSchedule />\n\t\t\t\t\t\t<PostTemplate />\n\t\t\t\t\t\t<PostURL />\n\t\t\t\t\t\t<PostSticky />\n\t\t\t\t\t\t<PostPendingStatus />\n\t\t\t\t\t\t<PostFormat />\n\t\t\t\t\t\t<PostSlug />\n\t\t\t\t\t\t<PostAuthor />\n\t\t\t\t\t\t<PostSyncStatus />\n\t\t\t\t\t\t{ fills }\n\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tmarginTop: '16px',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\t\t\twrap\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PostSwitchToDraftButton />\n\t\t\t\t\t\t\t<PostTrash />\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</PluginPostStatusInfo.Slot>\n\t\t</PanelBody>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\t// We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do\n\t\t// not use isEditorPanelEnabled since this panel should not be disabled through the UI.\n\t\tconst { isEditorPanelRemoved, isEditorPanelOpened } =\n\t\t\tselect( editPostStore );\n\t\treturn {\n\t\t\tisRemoved: isEditorPanelRemoved( PANEL_NAME ),\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t};\n\t} ),\n\tifCondition( ( { isRemoved } ) => ! isRemoved ),\n\twithDispatch( ( dispatch ) => ( {\n\t\tonTogglePanel() {\n\t\t\treturn dispatch( editPostStore ).toggleEditorPanelOpened(\n\t\t\t\tPANEL_NAME\n\t\t\t);\n\t\t},\n\t} ) ),\n] )( PostStatus );\n"]}
|
|
@@ -4,10 +4,7 @@ import { createElement } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { PostTrash as PostTrashLink, PostTrashCheck } from '@wordpress/editor';
|
|
7
|
-
import { FlexItem } from '@wordpress/components';
|
|
8
7
|
export default function PostTrash() {
|
|
9
|
-
return createElement(PostTrashCheck, null, createElement(
|
|
10
|
-
isBlock: true
|
|
11
|
-
}, createElement(PostTrashLink, null)));
|
|
8
|
+
return createElement(PostTrashCheck, null, createElement(PostTrashLink, null));
|
|
12
9
|
}
|
|
13
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-trash/index.js"],"names":["PostTrash","PostTrashLink","PostTrashCheck"
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-trash/index.js"],"names":["PostTrash","PostTrashLink","PostTrashCheck"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAS,IAAIC,aAAtB,EAAqCC,cAArC,QAA2D,mBAA3D;AAEA,eAAe,SAASF,SAAT,GAAqB;AACnC,SACC,cAAC,cAAD,QACC,cAAC,aAAD,OADD,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { PostTrash as PostTrashLink, PostTrashCheck } from '@wordpress/editor';\n\nexport default function PostTrash() {\n\treturn (\n\t\t<PostTrashCheck>\n\t\t\t<PostTrashLink />\n\t\t</PostTrashCheck>\n\t);\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
5
|
import { __, isRTL } from '@wordpress/i18n';
|
|
6
|
-
import { code, cog, drawerLeft, drawerRight, blockDefault, keyboardClose } from '@wordpress/icons';
|
|
6
|
+
import { code, cog, drawerLeft, drawerRight, blockDefault, keyboardClose, desktop, listView } from '@wordpress/icons';
|
|
7
7
|
import { useCommand } from '@wordpress/commands';
|
|
8
8
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
9
9
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
@@ -18,18 +18,27 @@ export default function useCommonCommands() {
|
|
|
18
18
|
const {
|
|
19
19
|
openGeneralSidebar,
|
|
20
20
|
closeGeneralSidebar,
|
|
21
|
-
switchEditorMode
|
|
21
|
+
switchEditorMode,
|
|
22
|
+
setIsListViewOpened
|
|
22
23
|
} = useDispatch(editPostStore);
|
|
23
24
|
const {
|
|
24
25
|
openModal
|
|
25
26
|
} = useDispatch(interfaceStore);
|
|
26
27
|
const {
|
|
27
28
|
editorMode,
|
|
28
|
-
activeSidebar
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
activeSidebar,
|
|
30
|
+
isListViewOpen
|
|
31
|
+
} = useSelect(select => {
|
|
32
|
+
const {
|
|
33
|
+
getEditorMode,
|
|
34
|
+
isListViewOpened
|
|
35
|
+
} = select(editPostStore);
|
|
36
|
+
return {
|
|
37
|
+
activeSidebar: select(interfaceStore).getActiveComplementaryArea(editPostStore.name),
|
|
38
|
+
editorMode: getEditorMode(),
|
|
39
|
+
isListViewOpen: isListViewOpened()
|
|
40
|
+
};
|
|
41
|
+
}, []);
|
|
33
42
|
const {
|
|
34
43
|
toggle
|
|
35
44
|
} = useDispatch(preferencesStore);
|
|
@@ -87,6 +96,28 @@ export default function useCommonCommands() {
|
|
|
87
96
|
close();
|
|
88
97
|
}
|
|
89
98
|
});
|
|
99
|
+
useCommand({
|
|
100
|
+
name: 'core/toggle-fullscreen-mode',
|
|
101
|
+
label: __('Toggle fullscreen mode'),
|
|
102
|
+
icon: desktop,
|
|
103
|
+
callback: ({
|
|
104
|
+
close
|
|
105
|
+
}) => {
|
|
106
|
+
toggle('core/edit-post', 'fullscreenMode');
|
|
107
|
+
close();
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
useCommand({
|
|
111
|
+
name: 'core/toggle-list-view',
|
|
112
|
+
label: __('Toggle list view'),
|
|
113
|
+
icon: listView,
|
|
114
|
+
callback: ({
|
|
115
|
+
close
|
|
116
|
+
}) => {
|
|
117
|
+
setIsListViewOpened(!isListViewOpen);
|
|
118
|
+
close();
|
|
119
|
+
}
|
|
120
|
+
});
|
|
90
121
|
useCommand({
|
|
91
122
|
name: 'core/toggle-top-toolbar',
|
|
92
123
|
label: __('Toggle top toolbar'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/hooks/commands/use-common-commands.js"],"names":["useSelect","useDispatch","__","isRTL","code","cog","drawerLeft","drawerRight","blockDefault","keyboardClose","useCommand","store","preferencesStore","interfaceStore","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","PREFERENCES_MODAL_NAME","editPostStore","useCommonCommands","openGeneralSidebar","closeGeneralSidebar","switchEditorMode","openModal","editorMode","activeSidebar","select","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/hooks/commands/use-common-commands.js"],"names":["useSelect","useDispatch","__","isRTL","code","cog","drawerLeft","drawerRight","blockDefault","keyboardClose","desktop","listView","useCommand","store","preferencesStore","interfaceStore","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","PREFERENCES_MODAL_NAME","editPostStore","useCommonCommands","openGeneralSidebar","closeGeneralSidebar","switchEditorMode","setIsListViewOpened","openModal","editorMode","activeSidebar","isListViewOpen","select","getEditorMode","isListViewOpened","getActiveComplementaryArea","name","toggle","label","icon","callback","close"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,EAAaC,KAAb,QAA0B,iBAA1B;AACA,SACCC,IADD,EAECC,GAFD,EAGCC,UAHD,EAICC,WAJD,EAKCC,YALD,EAMCC,aAND,EAOCC,OAPD,EAQCC,QARD,QASO,kBATP;AAUA,SAASC,UAAT,QAA2B,qBAA3B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AACA,SAASD,KAAK,IAAIE,cAAlB,QAAwC,sBAAxC;AAEA;AACA;AACA;;AACA,SAASC,iCAAT,QAAkD,+CAAlD;AACA,SAASC,sBAAT,QAAuC,oCAAvC;AACA,SAASJ,KAAK,IAAIK,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,iBAAT,GAA6B;AAC3C,QAAM;AACLC,IAAAA,kBADK;AAELC,IAAAA,mBAFK;AAGLC,IAAAA,gBAHK;AAILC,IAAAA;AAJK,MAKFtB,WAAW,CAAEiB,aAAF,CALf;AAMA,QAAM;AAAEM,IAAAA;AAAF,MAAgBvB,WAAW,CAAEc,cAAF,CAAjC;AACA,QAAM;AAAEU,IAAAA,UAAF;AAAcC,IAAAA,aAAd;AAA6BC,IAAAA;AAA7B,MAAgD3B,SAAS,CAC5D4B,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA;AAAjB,QAAsCF,MAAM,CAAEV,aAAF,CAAlD;AACA,WAAO;AAC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oBAAF,CAFE;AAGXiC,IAAAA,IAAI,EAAE9B,GAHK;AAIX+B,IAAAA,QAAQ,EAAE,CAAE;AAAEC,MAAAA;AAAF,KAAF,KAAiB;AAC1BJ,MAAAA,MAAM,CAAE,gBAAF,EAAoB,cAApB,CAAN;AACAI,MAAAA,KAAK;AACL;AAPU,GAAF,CAAV;AAUAzB,EAAAA,UAAU,CAAE;AACXoB,IAAAA,IAAI,EAAE,yBADK;AAEXE,IAAAA,KAAK,EAAEhC,EAAE,CAAE,oBAAF,CAFE;AAGXiC,IAAAA,IAAI,EAAE/B,IAHK;AAIXgC,IAAAA,QAAQ,EAAE,CAAE;AAAEC,MAAAA;AAAF,KAAF,KAAiB;AAC1Bf,MAAAA,gBAAgB,CAAEG,UAAU,KAAK,QAAf,GAA0B,MAA1B,GAAmC,QAArC,CAAhB;AACAY,MAAAA,KAAK;AACL;AAPU,GAAF,CAAV;AAUAzB,EAAAA,UAAU,CAAE;AACXoB,IAAAA,IAAI,EAAE,uBADK;AAEXE,IAAAA,KAAK,EAAEhC,EAAE,CAAE,yBAAF,CAFE;AAGXiC,IAAAA,IAAI,EAAE9B,GAHK;AAIX+B,IAAAA,QAAQ,EAAE,MAAM;AACfZ,MAAAA,SAAS,CAAEP,sBAAF,CAAT;AACA;AANU,GAAF,CAAV;AASAL,EAAAA,UAAU,CAAE;AACXoB,IAAAA,IAAI,EAAE,yBADK;AAEXE,IAAAA,KAAK,EAAEhC,EAAE,CAAE,yBAAF,CAFE;AAGXiC,IAAAA,IAAI,EAAE1B,aAHK;AAIX2B,IAAAA,QAAQ,EAAE,MAAM;AACfZ,MAAAA,SAAS,CAAER,iCAAF,CAAT;AACA;AANU,GAAF,CAAV;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tcode,\n\tcog,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tkeyboardClose,\n\tdesktop,\n\tlistView,\n} from '@wordpress/icons';\nimport { useCommand } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { store as editPostStore } from '../../store';\n\nexport default function useCommonCommands() {\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\tswitchEditorMode,\n\t\tsetIsListViewOpened,\n\t} = useDispatch( editPostStore );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { editorMode, activeSidebar, isListViewOpen } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorMode, isListViewOpened } = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tactiveSidebar: select(\n\t\t\t\t\tinterfaceStore\n\t\t\t\t).getActiveComplementaryArea( editPostStore.name ),\n\t\t\t\teditorMode: getEditorMode(),\n\t\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tuseCommand( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/document' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: __( 'Toggle distraction free' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'distractionFree' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight mode' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'focusMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-fullscreen-mode',\n\t\tlabel: __( 'Toggle fullscreen mode' ),\n\t\ticon: desktop,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-list-view',\n\t\tlabel: __( 'Toggle list view' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fixedToolbar' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-code-editor',\n\t\tlabel: __( 'Toggle code editor' ),\n\t\ticon: code,\n\t\tcallback: ( { close } ) => {\n\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Open editor preferences' ),\n\t\ticon: cog,\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Open keyboard shortcuts' ),\n\t\ticon: keyboardClose,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n}\n"]}
|
|
@@ -4,6 +4,9 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { MenuItem, VisuallyHidden } from '@wordpress/components';
|
|
7
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
8
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
9
|
+
import { useSelect } from '@wordpress/data';
|
|
7
10
|
import { external } from '@wordpress/icons';
|
|
8
11
|
import { __ } from '@wordpress/i18n';
|
|
9
12
|
import { registerPlugin } from '@wordpress/plugins';
|
|
@@ -16,16 +19,40 @@ import CopyContentMenuItem from './copy-content-menu-item';
|
|
|
16
19
|
import KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';
|
|
17
20
|
import ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';
|
|
18
21
|
import WelcomeGuideMenuItem from './welcome-guide-menu-item';
|
|
22
|
+
|
|
23
|
+
function ManagePatternsMenuItem() {
|
|
24
|
+
const url = useSelect(select => {
|
|
25
|
+
const {
|
|
26
|
+
canUser
|
|
27
|
+
} = select(coreStore);
|
|
28
|
+
const {
|
|
29
|
+
getEditorSettings
|
|
30
|
+
} = select(editorStore);
|
|
31
|
+
|
|
32
|
+
const isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme;
|
|
33
|
+
|
|
34
|
+
const defaultUrl = addQueryArgs('edit.php', {
|
|
35
|
+
post_type: 'wp_block'
|
|
36
|
+
});
|
|
37
|
+
const patternsUrl = addQueryArgs('site-editor.php', {
|
|
38
|
+
path: '/patterns'
|
|
39
|
+
}); // The site editor and templates both check whether the user has
|
|
40
|
+
// edit_theme_options capabilities. We can leverage that here and not
|
|
41
|
+
// display the manage patterns link if the user can't access it.
|
|
42
|
+
|
|
43
|
+
return canUser('read', 'templates') && isBlockTheme ? patternsUrl : defaultUrl;
|
|
44
|
+
}, []);
|
|
45
|
+
return createElement(MenuItem, {
|
|
46
|
+
role: "menuitem",
|
|
47
|
+
href: url
|
|
48
|
+
}, __('Manage Patterns'));
|
|
49
|
+
}
|
|
50
|
+
|
|
19
51
|
registerPlugin('edit-post', {
|
|
20
52
|
render() {
|
|
21
53
|
return createElement(Fragment, null, createElement(ToolsMoreMenuGroup, null, ({
|
|
22
54
|
onClose
|
|
23
|
-
}) => createElement(Fragment, null, createElement(
|
|
24
|
-
role: "menuitem",
|
|
25
|
-
href: addQueryArgs('edit.php', {
|
|
26
|
-
post_type: 'wp_block'
|
|
27
|
-
})
|
|
28
|
-
}, __('Manage Patterns')), createElement(KeyboardShortcutsHelpMenuItem, {
|
|
55
|
+
}) => createElement(Fragment, null, createElement(ManagePatternsMenuItem, null), createElement(KeyboardShortcutsHelpMenuItem, {
|
|
29
56
|
onSelect: onClose
|
|
30
57
|
}), createElement(WelcomeGuideMenuItem, null), createElement(CopyContentMenuItem, null), createElement(MenuItem, {
|
|
31
58
|
role: "menuitem",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["MenuItem","VisuallyHidden","external","__","registerPlugin","addQueryArgs","CopyContentMenuItem","KeyboardShortcutsHelpMenuItem","ToolsMoreMenuGroup","WelcomeGuideMenuItem","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["MenuItem","VisuallyHidden","store","coreStore","editorStore","useSelect","external","__","registerPlugin","addQueryArgs","CopyContentMenuItem","KeyboardShortcutsHelpMenuItem","ToolsMoreMenuGroup","WelcomeGuideMenuItem","ManagePatternsMenuItem","url","select","canUser","getEditorSettings","isBlockTheme","__unstable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ACGR,EAAE,CAAE,iBAAF,CADL,CADD;AAKA;;AAEDC,cAAc,CAAE,WAAF,EAAe;AAC5BiB,EAAAA,MAAM,GAAG;AACR,WACC,8BACC,cAAC,kBAAD,QACG,CAAE;AAAEC,MAAAA;AAAF,KAAF,KACD,8BACC,cAAC,sBAAD,OADD,EAEC,cAAC,6BAAD;AACC,MAAA,QAAQ,EAAGA;AADZ,MAFD,EAKC,cAAC,oBAAD,OALD,EAMC,cAAC,mBAAD,OAND,EAOC,cAAC,QAAD;AACC,MAAA,IAAI,EAAC,UADN;AAEC,MAAA,IAAI,EAAGpB,QAFR;AAGC,MAAA,IAAI,EAAGC,EAAE,CACR,qEADQ,CAHV;AAMC,MAAA,MAAM,EAAC,QANR;AAOC,MAAA,GAAG,EAAC;AAPL,OASGA,EAAE,CAAE,MAAF,CATL,EAUC,cAAC,cAAD;AAAgB,MAAA,EAAE,EAAC;AAAnB;AAEE;AACAA,IAAAA,EAAE,CAAE,sBAAF,CAHJ,CAVD,CAPD,CAFF,CADD,CADD;AAiCA;;AAnC2B,CAAf,CAAd","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { external } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { registerPlugin } from '@wordpress/plugins';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport CopyContentMenuItem from './copy-content-menu-item';\nimport KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';\nimport ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\n\nfunction ManagePatternsMenuItem() {\n\tconst url = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\n\t\tconst isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme;\n\t\tconst defaultUrl = addQueryArgs( 'edit.php', {\n\t\t\tpost_type: 'wp_block',\n\t\t} );\n\t\tconst patternsUrl = addQueryArgs( 'site-editor.php', {\n\t\t\tpath: '/patterns',\n\t\t} );\n\n\t\t// The site editor and templates both check whether the user has\n\t\t// edit_theme_options capabilities. We can leverage that here and not\n\t\t// display the manage patterns link if the user can't access it.\n\t\treturn canUser( 'read', 'templates' ) && isBlockTheme\n\t\t\t? patternsUrl\n\t\t\t: defaultUrl;\n\t}, [] );\n\n\treturn (\n\t\t<MenuItem role=\"menuitem\" href={ url }>\n\t\t\t{ __( 'Manage Patterns' ) }\n\t\t</MenuItem>\n\t);\n}\n\nregisterPlugin( 'edit-post', {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ManagePatternsMenuItem />\n\t\t\t\t\t\t\t<KeyboardShortcutsHelpMenuItem\n\t\t\t\t\t\t\t\tonSelect={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t\t\t\t\t<CopyContentMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsMoreMenuGroup>\n\t\t\t</>\n\t\t);\n\t},\n} );\n"]}
|
|
@@ -1253,7 +1253,7 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
|
|
|
1253
1253
|
|
|
1254
1254
|
.edit-post-block-manager__category-title {
|
|
1255
1255
|
position: sticky;
|
|
1256
|
-
top:
|
|
1256
|
+
top: -4px;
|
|
1257
1257
|
padding: 16px 0;
|
|
1258
1258
|
background-color: #fff;
|
|
1259
1259
|
z-index: 1;
|
|
@@ -1939,36 +1939,32 @@ h2.edit-post-template-summary__title {
|
|
|
1939
1939
|
opacity: 1;
|
|
1940
1940
|
}
|
|
1941
1941
|
}
|
|
1942
|
-
|
|
1943
|
-
background: #fff;
|
|
1944
|
-
}
|
|
1945
|
-
|
|
1946
|
-
body.block-editor-page {
|
|
1942
|
+
body.js.block-editor-page {
|
|
1947
1943
|
background: #fff;
|
|
1948
1944
|
/* We hide legacy notices in Gutenberg Based Pages, because they were not designed in a way that scaled well.
|
|
1949
1945
|
Plugins can use Gutenberg notices if they need to pass on information to the user when they are editing. */
|
|
1950
1946
|
}
|
|
1951
|
-
body.block-editor-page #wpcontent {
|
|
1947
|
+
body.js.block-editor-page #wpcontent {
|
|
1952
1948
|
padding-right: 0;
|
|
1953
1949
|
}
|
|
1954
|
-
body.block-editor-page #wpbody-content {
|
|
1950
|
+
body.js.block-editor-page #wpbody-content {
|
|
1955
1951
|
padding-bottom: 0;
|
|
1956
1952
|
}
|
|
1957
|
-
body.block-editor-page #wpbody-content > div:not(.block-editor):not(#screen-meta) {
|
|
1953
|
+
body.js.block-editor-page #wpbody-content > div:not(.block-editor):not(#screen-meta) {
|
|
1958
1954
|
display: none;
|
|
1959
1955
|
}
|
|
1960
|
-
body.block-editor-page #wpfooter {
|
|
1956
|
+
body.js.block-editor-page #wpfooter {
|
|
1961
1957
|
display: none;
|
|
1962
1958
|
}
|
|
1963
|
-
body.block-editor-page .a11y-speak-region {
|
|
1959
|
+
body.js.block-editor-page .a11y-speak-region {
|
|
1964
1960
|
right: -1px;
|
|
1965
1961
|
top: -1px;
|
|
1966
1962
|
}
|
|
1967
|
-
body.block-editor-page ul#adminmenu a.wp-has-current-submenu::after,
|
|
1968
|
-
body.block-editor-page ul#adminmenu > li.current > a.current::after {
|
|
1963
|
+
body.js.block-editor-page ul#adminmenu a.wp-has-current-submenu::after,
|
|
1964
|
+
body.js.block-editor-page ul#adminmenu > li.current > a.current::after {
|
|
1969
1965
|
border-left-color: #fff;
|
|
1970
1966
|
}
|
|
1971
|
-
body.block-editor-page .media-frame select.attachment-filters:last-of-type {
|
|
1967
|
+
body.js.block-editor-page .media-frame select.attachment-filters:last-of-type {
|
|
1972
1968
|
width: auto;
|
|
1973
1969
|
max-width: 100%;
|
|
1974
1970
|
}
|
package/build-style/style.css
CHANGED
|
@@ -1253,7 +1253,7 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
|
|
|
1253
1253
|
|
|
1254
1254
|
.edit-post-block-manager__category-title {
|
|
1255
1255
|
position: sticky;
|
|
1256
|
-
top:
|
|
1256
|
+
top: -4px;
|
|
1257
1257
|
padding: 16px 0;
|
|
1258
1258
|
background-color: #fff;
|
|
1259
1259
|
z-index: 1;
|
|
@@ -1939,36 +1939,32 @@ h2.edit-post-template-summary__title {
|
|
|
1939
1939
|
opacity: 1;
|
|
1940
1940
|
}
|
|
1941
1941
|
}
|
|
1942
|
-
|
|
1943
|
-
background: #fff;
|
|
1944
|
-
}
|
|
1945
|
-
|
|
1946
|
-
body.block-editor-page {
|
|
1942
|
+
body.js.block-editor-page {
|
|
1947
1943
|
background: #fff;
|
|
1948
1944
|
/* We hide legacy notices in Gutenberg Based Pages, because they were not designed in a way that scaled well.
|
|
1949
1945
|
Plugins can use Gutenberg notices if they need to pass on information to the user when they are editing. */
|
|
1950
1946
|
}
|
|
1951
|
-
body.block-editor-page #wpcontent {
|
|
1947
|
+
body.js.block-editor-page #wpcontent {
|
|
1952
1948
|
padding-left: 0;
|
|
1953
1949
|
}
|
|
1954
|
-
body.block-editor-page #wpbody-content {
|
|
1950
|
+
body.js.block-editor-page #wpbody-content {
|
|
1955
1951
|
padding-bottom: 0;
|
|
1956
1952
|
}
|
|
1957
|
-
body.block-editor-page #wpbody-content > div:not(.block-editor):not(#screen-meta) {
|
|
1953
|
+
body.js.block-editor-page #wpbody-content > div:not(.block-editor):not(#screen-meta) {
|
|
1958
1954
|
display: none;
|
|
1959
1955
|
}
|
|
1960
|
-
body.block-editor-page #wpfooter {
|
|
1956
|
+
body.js.block-editor-page #wpfooter {
|
|
1961
1957
|
display: none;
|
|
1962
1958
|
}
|
|
1963
|
-
body.block-editor-page .a11y-speak-region {
|
|
1959
|
+
body.js.block-editor-page .a11y-speak-region {
|
|
1964
1960
|
left: -1px;
|
|
1965
1961
|
top: -1px;
|
|
1966
1962
|
}
|
|
1967
|
-
body.block-editor-page ul#adminmenu a.wp-has-current-submenu::after,
|
|
1968
|
-
body.block-editor-page ul#adminmenu > li.current > a.current::after {
|
|
1963
|
+
body.js.block-editor-page ul#adminmenu a.wp-has-current-submenu::after,
|
|
1964
|
+
body.js.block-editor-page ul#adminmenu > li.current > a.current::after {
|
|
1969
1965
|
border-right-color: #fff;
|
|
1970
1966
|
}
|
|
1971
|
-
body.block-editor-page .media-frame select.attachment-filters:last-of-type {
|
|
1967
|
+
body.js.block-editor-page .media-frame select.attachment-filters:last-of-type {
|
|
1972
1968
|
width: auto;
|
|
1973
1969
|
max-width: 100%;
|
|
1974
1970
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "7.12.
|
|
3
|
+
"version": "7.12.8",
|
|
4
4
|
"description": "Edit Post module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -29,34 +29,34 @@
|
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
30
|
"@wordpress/a11y": "^3.35.1",
|
|
31
31
|
"@wordpress/api-fetch": "^6.32.1",
|
|
32
|
-
"@wordpress/block-editor": "^12.3.
|
|
33
|
-
"@wordpress/block-library": "^8.12.
|
|
34
|
-
"@wordpress/blocks": "^12.12.
|
|
35
|
-
"@wordpress/commands": "^0.6.
|
|
36
|
-
"@wordpress/components": "^25.1.
|
|
32
|
+
"@wordpress/block-editor": "^12.3.6",
|
|
33
|
+
"@wordpress/block-library": "^8.12.8",
|
|
34
|
+
"@wordpress/blocks": "^12.12.3",
|
|
35
|
+
"@wordpress/commands": "^0.6.6",
|
|
36
|
+
"@wordpress/components": "^25.1.6",
|
|
37
37
|
"@wordpress/compose": "^6.12.1",
|
|
38
|
-
"@wordpress/core-commands": "^0.4.
|
|
39
|
-
"@wordpress/core-data": "^6.12.
|
|
40
|
-
"@wordpress/data": "^9.5.
|
|
38
|
+
"@wordpress/core-commands": "^0.4.6",
|
|
39
|
+
"@wordpress/core-data": "^6.12.6",
|
|
40
|
+
"@wordpress/data": "^9.5.3",
|
|
41
41
|
"@wordpress/deprecated": "^3.35.1",
|
|
42
42
|
"@wordpress/dom": "^3.35.1",
|
|
43
|
-
"@wordpress/editor": "^13.12.
|
|
43
|
+
"@wordpress/editor": "^13.12.6",
|
|
44
44
|
"@wordpress/element": "^5.12.1",
|
|
45
45
|
"@wordpress/hooks": "^3.35.1",
|
|
46
46
|
"@wordpress/i18n": "^4.35.1",
|
|
47
47
|
"@wordpress/icons": "^9.26.2",
|
|
48
|
-
"@wordpress/interface": "^5.12.
|
|
49
|
-
"@wordpress/keyboard-shortcuts": "^4.12.
|
|
48
|
+
"@wordpress/interface": "^5.12.6",
|
|
49
|
+
"@wordpress/keyboard-shortcuts": "^4.12.3",
|
|
50
50
|
"@wordpress/keycodes": "^3.35.1",
|
|
51
51
|
"@wordpress/media-utils": "^4.26.1",
|
|
52
|
-
"@wordpress/notices": "^4.3.
|
|
53
|
-
"@wordpress/plugins": "^6.3.
|
|
54
|
-
"@wordpress/preferences": "^3.12.
|
|
52
|
+
"@wordpress/notices": "^4.3.3",
|
|
53
|
+
"@wordpress/plugins": "^6.3.6",
|
|
54
|
+
"@wordpress/preferences": "^3.12.6",
|
|
55
55
|
"@wordpress/private-apis": "^0.17.1",
|
|
56
56
|
"@wordpress/url": "^3.36.1",
|
|
57
|
-
"@wordpress/viewport": "^5.12.
|
|
57
|
+
"@wordpress/viewport": "^5.12.3",
|
|
58
58
|
"@wordpress/warning": "^2.35.1",
|
|
59
|
-
"@wordpress/widgets": "^3.12.
|
|
59
|
+
"@wordpress/widgets": "^3.12.6",
|
|
60
60
|
"classnames": "^2.3.1",
|
|
61
61
|
"memize": "^2.1.0",
|
|
62
62
|
"rememo": "^4.0.2"
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "86ecd96b3bcada6b4cc35bb2455b3029cebb0ff3"
|
|
72
72
|
}
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
.edit-post-block-manager__category-title {
|
|
38
38
|
position: sticky;
|
|
39
|
-
top:
|
|
39
|
+
top: - $grid-unit-05; // Offsets the top padding on the modal content container
|
|
40
40
|
padding: $grid-unit-20 0;
|
|
41
41
|
background-color: $white;
|
|
42
42
|
z-index: z-index(".edit-post-block-manager__category-title");
|
|
@@ -19,6 +19,7 @@ import { Button, ToolbarItem } from '@wordpress/components';
|
|
|
19
19
|
import { listView, plus } from '@wordpress/icons';
|
|
20
20
|
import { useRef, useCallback } from '@wordpress/element';
|
|
21
21
|
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
22
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Internal dependencies
|
|
@@ -36,6 +37,8 @@ function HeaderToolbar() {
|
|
|
36
37
|
const inserterButton = useRef();
|
|
37
38
|
const { setIsInserterOpened, setIsListViewOpened } =
|
|
38
39
|
useDispatch( editPostStore );
|
|
40
|
+
const { get: getPreference } = useSelect( preferencesStore );
|
|
41
|
+
const hasFixedToolbar = getPreference( 'core/edit-post', 'fixedToolbar' );
|
|
39
42
|
const {
|
|
40
43
|
isInserterEnabled,
|
|
41
44
|
isInserterOpened,
|
|
@@ -147,7 +150,7 @@ function HeaderToolbar() {
|
|
|
147
150
|
/>
|
|
148
151
|
{ ( isWideViewport || ! showIconLabels ) && (
|
|
149
152
|
<>
|
|
150
|
-
{ isLargeViewport && (
|
|
153
|
+
{ isLargeViewport && ! hasFixedToolbar && (
|
|
151
154
|
<ToolbarItem
|
|
152
155
|
as={ ToolSelector }
|
|
153
156
|
showTooltip={ ! showIconLabels }
|
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { PostTrash as PostTrashLink, PostTrashCheck } from '@wordpress/editor';
|
|
5
|
-
import { FlexItem } from '@wordpress/components';
|
|
6
5
|
|
|
7
6
|
export default function PostTrash() {
|
|
8
7
|
return (
|
|
9
8
|
<PostTrashCheck>
|
|
10
|
-
<
|
|
11
|
-
<PostTrashLink />
|
|
12
|
-
</FlexItem>
|
|
9
|
+
<PostTrashLink />
|
|
13
10
|
</PostTrashCheck>
|
|
14
11
|
);
|
|
15
12
|
}
|
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
drawerRight,
|
|
11
11
|
blockDefault,
|
|
12
12
|
keyboardClose,
|
|
13
|
+
desktop,
|
|
14
|
+
listView,
|
|
13
15
|
} from '@wordpress/icons';
|
|
14
16
|
import { useCommand } from '@wordpress/commands';
|
|
15
17
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
@@ -23,16 +25,24 @@ import { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';
|
|
|
23
25
|
import { store as editPostStore } from '../../store';
|
|
24
26
|
|
|
25
27
|
export default function useCommonCommands() {
|
|
26
|
-
const {
|
|
27
|
-
|
|
28
|
+
const {
|
|
29
|
+
openGeneralSidebar,
|
|
30
|
+
closeGeneralSidebar,
|
|
31
|
+
switchEditorMode,
|
|
32
|
+
setIsListViewOpened,
|
|
33
|
+
} = useDispatch( editPostStore );
|
|
28
34
|
const { openModal } = useDispatch( interfaceStore );
|
|
29
|
-
const { editorMode, activeSidebar } = useSelect(
|
|
30
|
-
( select ) =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
const { editorMode, activeSidebar, isListViewOpen } = useSelect(
|
|
36
|
+
( select ) => {
|
|
37
|
+
const { getEditorMode, isListViewOpened } = select( editPostStore );
|
|
38
|
+
return {
|
|
39
|
+
activeSidebar: select(
|
|
40
|
+
interfaceStore
|
|
41
|
+
).getActiveComplementaryArea( editPostStore.name ),
|
|
42
|
+
editorMode: getEditorMode(),
|
|
43
|
+
isListViewOpen: isListViewOpened(),
|
|
44
|
+
};
|
|
45
|
+
},
|
|
36
46
|
[]
|
|
37
47
|
);
|
|
38
48
|
const { toggle } = useDispatch( preferencesStore );
|
|
@@ -85,6 +95,26 @@ export default function useCommonCommands() {
|
|
|
85
95
|
},
|
|
86
96
|
} );
|
|
87
97
|
|
|
98
|
+
useCommand( {
|
|
99
|
+
name: 'core/toggle-fullscreen-mode',
|
|
100
|
+
label: __( 'Toggle fullscreen mode' ),
|
|
101
|
+
icon: desktop,
|
|
102
|
+
callback: ( { close } ) => {
|
|
103
|
+
toggle( 'core/edit-post', 'fullscreenMode' );
|
|
104
|
+
close();
|
|
105
|
+
},
|
|
106
|
+
} );
|
|
107
|
+
|
|
108
|
+
useCommand( {
|
|
109
|
+
name: 'core/toggle-list-view',
|
|
110
|
+
label: __( 'Toggle list view' ),
|
|
111
|
+
icon: listView,
|
|
112
|
+
callback: ( { close } ) => {
|
|
113
|
+
setIsListViewOpened( ! isListViewOpen );
|
|
114
|
+
close();
|
|
115
|
+
},
|
|
116
|
+
} );
|
|
117
|
+
|
|
88
118
|
useCommand( {
|
|
89
119
|
name: 'core/toggle-top-toolbar',
|
|
90
120
|
label: __( 'Toggle top toolbar' ),
|
package/src/plugins/index.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { MenuItem, VisuallyHidden } from '@wordpress/components';
|
|
5
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
6
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
7
|
+
import { useSelect } from '@wordpress/data';
|
|
5
8
|
import { external } from '@wordpress/icons';
|
|
6
9
|
import { __ } from '@wordpress/i18n';
|
|
7
10
|
import { registerPlugin } from '@wordpress/plugins';
|
|
@@ -15,6 +18,34 @@ import KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';
|
|
|
15
18
|
import ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';
|
|
16
19
|
import WelcomeGuideMenuItem from './welcome-guide-menu-item';
|
|
17
20
|
|
|
21
|
+
function ManagePatternsMenuItem() {
|
|
22
|
+
const url = useSelect( ( select ) => {
|
|
23
|
+
const { canUser } = select( coreStore );
|
|
24
|
+
const { getEditorSettings } = select( editorStore );
|
|
25
|
+
|
|
26
|
+
const isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme;
|
|
27
|
+
const defaultUrl = addQueryArgs( 'edit.php', {
|
|
28
|
+
post_type: 'wp_block',
|
|
29
|
+
} );
|
|
30
|
+
const patternsUrl = addQueryArgs( 'site-editor.php', {
|
|
31
|
+
path: '/patterns',
|
|
32
|
+
} );
|
|
33
|
+
|
|
34
|
+
// The site editor and templates both check whether the user has
|
|
35
|
+
// edit_theme_options capabilities. We can leverage that here and not
|
|
36
|
+
// display the manage patterns link if the user can't access it.
|
|
37
|
+
return canUser( 'read', 'templates' ) && isBlockTheme
|
|
38
|
+
? patternsUrl
|
|
39
|
+
: defaultUrl;
|
|
40
|
+
}, [] );
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<MenuItem role="menuitem" href={ url }>
|
|
44
|
+
{ __( 'Manage Patterns' ) }
|
|
45
|
+
</MenuItem>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
18
49
|
registerPlugin( 'edit-post', {
|
|
19
50
|
render() {
|
|
20
51
|
return (
|
|
@@ -22,14 +53,7 @@ registerPlugin( 'edit-post', {
|
|
|
22
53
|
<ToolsMoreMenuGroup>
|
|
23
54
|
{ ( { onClose } ) => (
|
|
24
55
|
<>
|
|
25
|
-
<
|
|
26
|
-
role="menuitem"
|
|
27
|
-
href={ addQueryArgs( 'edit.php', {
|
|
28
|
-
post_type: 'wp_block',
|
|
29
|
-
} ) }
|
|
30
|
-
>
|
|
31
|
-
{ __( 'Manage Patterns' ) }
|
|
32
|
-
</MenuItem>
|
|
56
|
+
<ManagePatternsMenuItem />
|
|
33
57
|
<KeyboardShortcutsHelpMenuItem
|
|
34
58
|
onSelect={ onClose }
|
|
35
59
|
/>
|
package/src/style.scss
CHANGED
|
@@ -41,13 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
// We scope it to .wp-toolbar to be wp-admin only, to prevent bleed into other implementations
|
|
46
|
-
html.wp-toolbar {
|
|
47
|
-
background: $white;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
body.block-editor-page {
|
|
44
|
+
body.js.block-editor-page {
|
|
51
45
|
@include wp-admin-reset( ".block-editor" );
|
|
52
46
|
}
|
|
53
47
|
|