@wordpress/edit-post 7.9.0 → 7.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/header/header-toolbar/index.js +6 -12
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/index.js +3 -1
- package/build/components/header/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/sidebar/plugin-document-setting-panel/index.js +1 -3
- package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-post-status-info/index.js +1 -4
- package/build/components/sidebar/plugin-post-status-info/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +8 -1
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/post-trash/index.js +5 -3
- package/build/components/sidebar/post-trash/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +1 -1
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/components/view-link/index.js +52 -0
- package/build/components/view-link/index.js.map +1 -0
- package/build/components/visual-editor/header.native.js +10 -3
- package/build/components/visual-editor/header.native.js.map +1 -1
- package/build/editor.js +11 -1
- package/build/editor.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.js +6 -12
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/index.js +2 -1
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js +1 -1
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-post-status-info/index.js +1 -1
- package/build-module/components/sidebar/plugin-post-status-info/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +8 -2
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-trash/index.js +4 -2
- package/build-module/components/sidebar/post-trash/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build-module/components/view-link/index.js +39 -0
- package/build-module/components/view-link/index.js.map +1 -0
- package/build-module/components/visual-editor/header.native.js +10 -3
- package/build-module/components/visual-editor/header.native.js.map +1 -1
- package/build-module/editor.js +9 -1
- package/build-module/editor.js.map +1 -1
- package/build-style/style-rtl.css +1 -1
- package/build-style/style.css +1 -1
- package/package.json +32 -30
- package/src/components/header/header-toolbar/index.js +8 -17
- package/src/components/header/index.js +2 -0
- package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +3 -1
- package/src/components/keyboard-shortcuts/index.js +1 -1
- package/src/components/layout/style.scss +0 -1
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +9 -5
- package/src/components/sidebar/plugin-document-setting-panel/index.js +1 -1
- package/src/components/sidebar/plugin-post-status-info/index.js +1 -1
- package/src/components/sidebar/post-status/index.js +14 -2
- package/src/components/sidebar/post-trash/index.js +3 -3
- package/src/components/sidebar/settings-sidebar/index.js +1 -1
- package/src/components/start-page-options/style.scss +1 -1
- package/src/components/view-link/index.js +37 -0
- package/src/components/visual-editor/header.native.js +12 -4
- package/src/components/visual-editor/style.scss +1 -1
- package/src/editor.js +7 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { Button } from '@wordpress/components';
|
|
8
|
+
import { external } from '@wordpress/icons';
|
|
9
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
10
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
11
|
+
import { useSelect } from '@wordpress/data';
|
|
12
|
+
export default function ViewLink() {
|
|
13
|
+
const {
|
|
14
|
+
permalink,
|
|
15
|
+
isPublished,
|
|
16
|
+
label
|
|
17
|
+
} = useSelect(select => {
|
|
18
|
+
// Grab post type to retrieve the view_item label.
|
|
19
|
+
const postTypeSlug = select(editorStore).getCurrentPostType();
|
|
20
|
+
const postType = select(coreStore).getPostType(postTypeSlug);
|
|
21
|
+
return {
|
|
22
|
+
permalink: select(editorStore).getPermalink(),
|
|
23
|
+
isPublished: select(editorStore).isCurrentPostPublished(),
|
|
24
|
+
label: postType === null || postType === void 0 ? void 0 : postType.labels.view_item
|
|
25
|
+
};
|
|
26
|
+
}, []); // Only render the view button if the post is published and has a permalink.
|
|
27
|
+
|
|
28
|
+
if (!isPublished || !permalink) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return createElement(Button, {
|
|
33
|
+
icon: external,
|
|
34
|
+
label: label || __('View post'),
|
|
35
|
+
href: permalink,
|
|
36
|
+
target: "_blank"
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/view-link/index.js"],"names":["__","Button","external","store","editorStore","coreStore","useSelect","ViewLink","permalink","isPublished","label","select","postTypeSlug","getCurrentPostType","postType","getPostType","getPermalink","isCurrentPostPublished","labels","view_item"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA,eAAe,SAASC,QAAT,GAAoB;AAClC,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,WAAb;AAA0BC,IAAAA;AAA1B,MAAoCJ,SAAS,CAAIK,MAAF,IAAc;AAClE;AACA,UAAMC,YAAY,GAAGD,MAAM,CAAEP,WAAF,CAAN,CAAsBS,kBAAtB,EAArB;AACA,UAAMC,QAAQ,GAAGH,MAAM,CAAEN,SAAF,CAAN,CAAoBU,WAApB,CAAiCH,YAAjC,CAAjB;AAEA,WAAO;AACNJ,MAAAA,SAAS,EAAEG,MAAM,CAAEP,WAAF,CAAN,CAAsBY,YAAtB,EADL;AAENP,MAAAA,WAAW,EAAEE,MAAM,CAAEP,WAAF,CAAN,CAAsBa,sBAAtB,EAFP;AAGNP,MAAAA,KAAK,EAAEI,QAAF,aAAEA,QAAF,uBAAEA,QAAQ,CAAEI,MAAV,CAAiBC;AAHlB,KAAP;AAKA,GAVkD,EAUhD,EAVgD,CAAnD,CADkC,CAalC;;AACA,MAAK,CAAEV,WAAF,IAAiB,CAAED,SAAxB,EAAoC;AACnC,WAAO,IAAP;AACA;;AAED,SACC,cAAC,MAAD;AACC,IAAA,IAAI,EAAGN,QADR;AAEC,IAAA,KAAK,EAAGQ,KAAK,IAAIV,EAAE,CAAE,WAAF,CAFpB;AAGC,IAAA,IAAI,EAAGQ,SAHR;AAIC,IAAA,MAAM,EAAC;AAJR,IADD;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { external } from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\nexport default function ViewLink() {\n\tconst { permalink, isPublished, label } = useSelect( ( select ) => {\n\t\t// Grab post type to retrieve the view_item label.\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\n\t\treturn {\n\t\t\tpermalink: select( editorStore ).getPermalink(),\n\t\t\tisPublished: select( editorStore ).isCurrentPostPublished(),\n\t\t\tlabel: postType?.labels.view_item,\n\t\t};\n\t}, [] );\n\n\t// Only render the view button if the post is published and has a permalink.\n\tif ( ! isPublished || ! permalink ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\ticon={ external }\n\t\t\tlabel={ label || __( 'View post' ) }\n\t\t\thref={ permalink }\n\t\t\ttarget=\"_blank\"\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { View } from 'react-native';
|
|
3
7
|
/**
|
|
4
8
|
* WordPress dependencies
|
|
5
9
|
*/
|
|
10
|
+
|
|
6
11
|
import { memo } from '@wordpress/element';
|
|
7
12
|
import { __ } from '@wordpress/i18n';
|
|
8
13
|
import { withDispatch, withSelect } from '@wordpress/data';
|
|
9
14
|
import { compose, withPreferredColorScheme } from '@wordpress/compose';
|
|
10
15
|
import { PostTitle } from '@wordpress/editor';
|
|
11
|
-
import {
|
|
12
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
16
|
+
import { store as blockEditorStore, useEditorWrapperStyles } from '@wordpress/block-editor';
|
|
13
17
|
/**
|
|
14
18
|
* Internal dependencies
|
|
15
19
|
*/
|
|
@@ -22,8 +26,11 @@ const Header = memo(function EditorHeader(_ref) {
|
|
|
22
26
|
title,
|
|
23
27
|
getStylesFromColorScheme
|
|
24
28
|
} = _ref;
|
|
29
|
+
const [wrapperStyles] = useEditorWrapperStyles();
|
|
25
30
|
const blockHolderFocusedStyle = getStylesFromColorScheme(styles.blockHolderFocused, styles.blockHolderFocusedDark);
|
|
26
|
-
return createElement(
|
|
31
|
+
return createElement(View, {
|
|
32
|
+
style: wrapperStyles
|
|
33
|
+
}, createElement(PostTitle, {
|
|
27
34
|
innerRef: setTitleRef,
|
|
28
35
|
title: title,
|
|
29
36
|
onUpdate: editTitle,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/header.native.js"],"names":["memo","__","withDispatch","withSelect","compose","withPreferredColorScheme","PostTitle","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/header.native.js"],"names":["View","memo","__","withDispatch","withSelect","compose","withPreferredColorScheme","PostTitle","store","blockEditorStore","useEditorWrapperStyles","styles","Header","EditorHeader","editTitle","setTitleRef","title","getStylesFromColorScheme","wrapperStyles","blockHolderFocusedStyle","blockHolderFocused","blockHolderFocusedDark","blockHolderFullBordered","borderColor","prevProps","nextProps","select","getEditedPostAttribute","dispatch","editPost","clearSelectedBlock"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,cAArB;AAEA;AACA;AACA;;AACA,SAASC,IAAT,QAAqB,oBAArB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,OAAT,EAAkBC,wBAAlB,QAAkD,oBAAlD;AACA,SAASC,SAAT,QAA0B,mBAA1B;AACA,SACCC,KAAK,IAAIC,gBADV,EAECC,sBAFD,QAGO,yBAHP;AAKA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;AAEA,MAAMC,MAAM,GAAGX,IAAI,CAClB,SAASY,YAAT,OAKI;AAAA,MALmB;AACtBC,IAAAA,SADsB;AAEtBC,IAAAA,WAFsB;AAGtBC,IAAAA,KAHsB;AAItBC,IAAAA;AAJsB,GAKnB;AACH,QAAM,CAAEC,aAAF,IAAoBR,sBAAsB,EAAhD;AACA,QAAMS,uBAAuB,GAAGF,wBAAwB,CACvDN,MAAM,CAACS,kBADgD,EAEvDT,MAAM,CAACU,sBAFgD,CAAxD;AAIA,SACC,cAAC,IAAD;AAAM,IAAA,KAAK,EAAGH;AAAd,KACC,cAAC,SAAD;AACC,IAAA,QAAQ,EAAGH,WADZ;AAEC,IAAA,KAAK,EAAGC,KAFT;AAGC,IAAA,QAAQ,EAAGF,SAHZ;AAIC,IAAA,WAAW,EAAGZ,EAAE,CAAE,WAAF,CAJjB;AAKC,IAAA,WAAW,EAAGS,MAAM,CAACW,uBALtB;AAMC,IAAA,kBAAkB,EAAGH,uBAAuB,CAACI,WAN9C;AAOC,IAAA,kBAAkB,EAAC;AAPpB,IADD,CADD;AAaA,CAzBiB,EA0BlB,CAAEC,SAAF,EAAaC,SAAb,KAA4BD,SAAS,CAACR,KAAV,KAAoBS,SAAS,CAACT,KA1BxC,CAAnB;AA6BA,eAAeX,OAAO,CAAE,CACvBD,UAAU,CAAIsB,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA;AAAF,MAA6BD,MAAM,CAAE,aAAF,CAAzC;AAEA,SAAO;AACNV,IAAAA,KAAK,EAAEW,sBAAsB,CAAE,OAAF;AADvB,GAAP;AAGA,CANS,CADa,EAQvBxB,YAAY,CAAIyB,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAeD,QAAQ,CAAE,aAAF,CAA7B;AAEA,QAAM;AAAEE,IAAAA;AAAF,MAAyBF,QAAQ,CAAEnB,gBAAF,CAAvC;AAEA,SAAO;AACNqB,IAAAA,kBADM;;AAENhB,IAAAA,SAAS,CAAEE,KAAF,EAAU;AAClBa,MAAAA,QAAQ,CAAE;AAAEb,QAAAA;AAAF,OAAF,CAAR;AACA;;AAJK,GAAP;AAMA,CAXW,CARW,EAoBvBV,wBApBuB,CAAF,CAAP,CAqBVM,MArBU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { memo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport { PostTitle } from '@wordpress/editor';\nimport {\n\tstore as blockEditorStore,\n\tuseEditorWrapperStyles,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nconst Header = memo(\n\tfunction EditorHeader( {\n\t\teditTitle,\n\t\tsetTitleRef,\n\t\ttitle,\n\t\tgetStylesFromColorScheme,\n\t} ) {\n\t\tconst [ wrapperStyles ] = useEditorWrapperStyles();\n\t\tconst blockHolderFocusedStyle = getStylesFromColorScheme(\n\t\t\tstyles.blockHolderFocused,\n\t\t\tstyles.blockHolderFocusedDark\n\t\t);\n\t\treturn (\n\t\t\t<View style={ wrapperStyles }>\n\t\t\t\t<PostTitle\n\t\t\t\t\tinnerRef={ setTitleRef }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tonUpdate={ editTitle }\n\t\t\t\t\tplaceholder={ __( 'Add title' ) }\n\t\t\t\t\tborderStyle={ styles.blockHolderFullBordered }\n\t\t\t\t\tfocusedBorderColor={ blockHolderFocusedStyle.borderColor }\n\t\t\t\t\taccessibilityLabel=\"post-title\"\n\t\t\t\t/>\n\t\t\t</View>\n\t\t);\n\t},\n\t( prevProps, nextProps ) => prevProps.title === nextProps.title\n);\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( 'core/editor' );\n\n\t\treturn {\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost } = dispatch( 'core/editor' );\n\n\t\tconst { clearSelectedBlock } = dispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\tclearSelectedBlock,\n\t\t\teditTitle( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( Header );\n"]}
|
package/build-module/editor.js
CHANGED
|
@@ -12,6 +12,8 @@ import { SlotFillProvider } from '@wordpress/components';
|
|
|
12
12
|
import { store as coreStore } from '@wordpress/core-data';
|
|
13
13
|
import { ShortcutProvider } from '@wordpress/keyboard-shortcuts';
|
|
14
14
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
15
|
+
import { CommandMenu } from '@wordpress/commands';
|
|
16
|
+
import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
|
|
15
17
|
/**
|
|
16
18
|
* Internal dependencies
|
|
17
19
|
*/
|
|
@@ -23,8 +25,13 @@ import { unlock } from './private-apis';
|
|
|
23
25
|
const {
|
|
24
26
|
ExperimentalEditorProvider
|
|
25
27
|
} = unlock(editorPrivateApis);
|
|
28
|
+
const {
|
|
29
|
+
useCommands
|
|
30
|
+
} = unlock(coreCommandsPrivateApis);
|
|
26
31
|
|
|
27
32
|
function Editor(_ref) {
|
|
33
|
+
var _window;
|
|
34
|
+
|
|
28
35
|
let {
|
|
29
36
|
postId,
|
|
30
37
|
postType,
|
|
@@ -32,6 +39,7 @@ function Editor(_ref) {
|
|
|
32
39
|
initialEdits,
|
|
33
40
|
...props
|
|
34
41
|
} = _ref;
|
|
42
|
+
useCommands();
|
|
35
43
|
const {
|
|
36
44
|
hasFixedToolbar,
|
|
37
45
|
focusMode,
|
|
@@ -162,7 +170,7 @@ function Editor(_ref) {
|
|
|
162
170
|
initialEdits: initialEdits,
|
|
163
171
|
useSubRegistry: false,
|
|
164
172
|
__unstableTemplate: isTemplateMode ? template : undefined
|
|
165
|
-
}, props), createElement(ErrorBoundary, null, createElement(EditorInitialization, {
|
|
173
|
+
}, props), createElement(ErrorBoundary, null, ((_window = window) === null || _window === void 0 ? void 0 : _window.__experimentalEnableCommandCenter) && createElement(CommandMenu, null), createElement(EditorInitialization, {
|
|
166
174
|
postId: postId
|
|
167
175
|
}), createElement(Layout, {
|
|
168
176
|
styles: styles
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/editor.js"],"names":["store","blocksStore","useSelect","useDispatch","ErrorBoundary","PostLockedModal","editorStore","privateApis","editorPrivateApis","useMemo","SlotFillProvider","coreStore","ShortcutProvider","preferencesStore","Layout","EditorInitialization","editPostStore","unlock","ExperimentalEditorProvider","Editor","postId","postType","settings","initialEdits","props","hasFixedToolbar","focusMode","isDistractionFree","hasInlineToolbar","hasThemeStyles","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","isTemplateMode","template","select","isFeatureActive","__experimentalGetPreviewDeviceType","isEditingTemplate","getEditedPostTemplate","getHiddenBlockTypes","getEntityRecord","getPostType","getEntityRecords","canUser","getEditorSettings","getBlockTypes","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","get","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","map","name","filter","type","styles","themeStyles","presetStyles","forEach","style","__unstableType","push","defaultEditorStyles","undefined"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,aADD,EAECC,eAFD,EAGCL,KAAK,IAAIM,WAHV,EAICC,WAAW,IAAIC,iBAJhB,QAKO,mBALP;AAMA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,gBAAT,QAAiC,uBAAjC;AACA,SAASV,KAAK,IAAIW,SAAlB,QAAmC,sBAAnC;AACA,SAASC,gBAAT,QAAiC,+BAAjC;AACA,SAASZ,KAAK,IAAIa,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASf,KAAK,IAAIgB,aAAlB,QAAuC,SAAvC;AACA,SAASC,MAAT,QAAuB,gBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAiCD,MAAM,CAAET,iBAAF,CAA7C;;AAEA,SAASW,MAAT,OAA0E;AAAA,MAAzD;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,QAAV;AAAoBC,IAAAA,QAApB;AAA8BC,IAAAA,YAA9B;AAA4C,OAAGC;AAA/C,GA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OAFD,MAEO;AACNF,QAAAA,YAAY,CAACI,IAAb,CAAmBF,KAAnB;AACA;AACD,KAND;AAOA,UAAMG,mBAAmB,GAAG,CAC3B,GAAG3D,QAAQ,CAAC2D,mBADe,EAE3B,GAAGL,YAFwB,CAA5B;AAIA,WAAO/C,cAAc,IAAI8C,WAAW,CAACN,MAA9B,GACJ/C,QAAQ,CAACoD,MADL,GAEJO,mBAFH;AAGA,GAjBqB,EAiBnB,CAAE3D,QAAF,EAAYO,cAAZ,CAjBmB,CAAtB;;AAmBA,MAAK,CAAEC,IAAP,EAAc;AACb,WAAO,IAAP;AACA;;AAED,SACC,cAAC,gBAAD,QACC,cAAC,gBAAD,QACC,cAAC,0BAAD;AACC,IAAA,QAAQ,EAAG+B,cADZ;AAEC,IAAA,IAAI,EAAG/B,IAFR;AAGC,IAAA,YAAY,EAAGP,YAHhB;AAIC,IAAA,cAAc,EAAG,KAJlB;AAKC,IAAA,kBAAkB,EAAGY,cAAc,GAAGC,QAAH,GAAc8C;AALlD,KAMM1D,KANN,GAQC,cAAC,aAAD,QACC,cAAC,oBAAD;AAAsB,IAAA,MAAM,EAAGJ;AAA/B,IADD,EAEC,cAAC,MAAD;AAAQ,IAAA,MAAM,EAAGsD;AAAjB,IAFD,CARD,EAYC,cAAC,eAAD,OAZD,CADD,CADD,CADD;AAoBA;;AAED,eAAevD,MAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './private-apis';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\n\nfunction Editor( { postId, postType, settings, initialEdits, ...props } ) {\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thasInlineToolbar,\n\t\thasThemeStyles,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\t\tisEditingTemplate,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tisFeatureActive( 'fixedToolbar' ) ||\n\t\t\t\t\t__experimentalGetPreviewDeviceType() !== 'Desktop',\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\tisDistractionFree: isFeatureActive( 'distractionFree' ),\n\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\thasThemeStyles: isFeatureActive( 'themeStyles' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tisDistractionFree,\n\t\t\thasInlineToolbar,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\thasInlineToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tconst styles = useMemo( () => {\n\t\tconst themeStyles = [];\n\t\tconst presetStyles = [];\n\t\tsettings.styles?.forEach( ( style ) => {\n\t\t\tif ( ! style.__unstableType || style.__unstableType === 'theme' ) {\n\t\t\t\tthemeStyles.push( style );\n\t\t\t} else {\n\t\t\t\tpresetStyles.push( style );\n\t\t\t}\n\t\t} );\n\t\tconst defaultEditorStyles = [\n\t\t\t...settings.defaultEditorStyles,\n\t\t\t...presetStyles,\n\t\t];\n\t\treturn hasThemeStyles && themeStyles.length\n\t\t\t? settings.styles\n\t\t\t: defaultEditorStyles;\n\t}, [ settings, hasThemeStyles ] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\tpost={ post }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t__unstableTemplate={ isTemplateMode ? template : undefined }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t\t<Layout styles={ styles } />\n\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t<PostLockedModal />\n\t\t\t\t</ExperimentalEditorProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n\nexport default Editor;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/editor.js"],"names":["store","blocksStore","useSelect","useDispatch","ErrorBoundary","PostLockedModal","editorStore","privateApis","editorPrivateApis","useMemo","SlotFillProvider","coreStore","ShortcutProvider","preferencesStore","CommandMenu","coreCommandsPrivateApis","Layout","EditorInitialization","editPostStore","unlock","ExperimentalEditorProvider","useCommands","Editor","postId","postType","settings","initialEdits","props","hasFixedToolbar","focusMode","isDistractionFree","hasInlineToolbar","hasThemeStyles","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","isTemplateMode","template","select","isFeatureActive","__experimentalGetPreviewDeviceType","isEditingTemplate","getEditedPostTemplate","getHiddenBlockTypes","getEntityRecord","getPostType","getEntityRecords","canUser","getEditorSettings","getBlockTypes","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","get","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","map","name","filter","type","styles","themeStyles","presetStyles","forEach","style","__unstableType","push","defaultEditorStyles","undefined","window","__experimentalEnableCommandCenter"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,aADD,EAECC,eAFD,EAGCL,KAAK,IAAIM,WAHV,EAICC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D;AACC,IAAA,QAAQ,EAAG+B,cADZ;AAEC,IAAA,IAAI,EAAG/B,IAFR;AAGC,IAAA,YAAY,EAAGP,YAHhB;AAIC,IAAA,cAAc,EAAG,KAJlB;AAKC,IAAA,kBAAkB,EAAGY,cAAc,GAAGC,QAAH,GAAc8C;AALlD,KAMM1D,KANN,GAQC,cAAC,aAAD,QACG,YAAA2D,MAAM,UAAN,0CAAQC,iCAAR,KACD,cAAC,WAAD,OAFF,EAIC,cAAC,oBAAD;AAAsB,IAAA,MAAM,EAAGhE;AAA/B,IAJD,EAKC,cAAC,MAAD;AAAQ,IAAA,MAAM,EAAGsD;AAAjB,IALD,CARD,EAeC,cAAC,eAAD,OAfD,CADD,CADD,CADD;AAuBA;;AAED,eAAevD,MAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\nimport { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './private-apis';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\nconst { useCommands } = unlock( coreCommandsPrivateApis );\n\nfunction Editor( { postId, postType, settings, initialEdits, ...props } ) {\n\tuseCommands();\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thasInlineToolbar,\n\t\thasThemeStyles,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\t\tisEditingTemplate,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tisFeatureActive( 'fixedToolbar' ) ||\n\t\t\t\t\t__experimentalGetPreviewDeviceType() !== 'Desktop',\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\tisDistractionFree: isFeatureActive( 'distractionFree' ),\n\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\thasThemeStyles: isFeatureActive( 'themeStyles' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tisDistractionFree,\n\t\t\thasInlineToolbar,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\thasInlineToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tconst styles = useMemo( () => {\n\t\tconst themeStyles = [];\n\t\tconst presetStyles = [];\n\t\tsettings.styles?.forEach( ( style ) => {\n\t\t\tif ( ! style.__unstableType || style.__unstableType === 'theme' ) {\n\t\t\t\tthemeStyles.push( style );\n\t\t\t} else {\n\t\t\t\tpresetStyles.push( style );\n\t\t\t}\n\t\t} );\n\t\tconst defaultEditorStyles = [\n\t\t\t...settings.defaultEditorStyles,\n\t\t\t...presetStyles,\n\t\t];\n\t\treturn hasThemeStyles && themeStyles.length\n\t\t\t? settings.styles\n\t\t\t: defaultEditorStyles;\n\t}, [ settings, hasThemeStyles ] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\tpost={ post }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t__unstableTemplate={ isTemplateMode ? template : undefined }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t{ window?.__experimentalEnableCommandCenter && (\n\t\t\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t\t<Layout styles={ styles } />\n\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t<PostLockedModal />\n\t\t\t\t</ExperimentalEditorProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n\nexport default Editor;\n"]}
|
|
@@ -1860,7 +1860,7 @@ h2.edit-post-template-summary__title {
|
|
|
1860
1860
|
display: flex;
|
|
1861
1861
|
flex-flow: column;
|
|
1862
1862
|
overflow: hidden;
|
|
1863
|
-
background-color: #
|
|
1863
|
+
background-color: #1e1e1e;
|
|
1864
1864
|
flex: 1 0 auto;
|
|
1865
1865
|
}
|
|
1866
1866
|
.edit-post-visual-editor .components-button {
|
package/build-style/style.css
CHANGED
|
@@ -1860,7 +1860,7 @@ h2.edit-post-template-summary__title {
|
|
|
1860
1860
|
display: flex;
|
|
1861
1861
|
flex-flow: column;
|
|
1862
1862
|
overflow: hidden;
|
|
1863
|
-
background-color: #
|
|
1863
|
+
background-color: #1e1e1e;
|
|
1864
1864
|
flex: 1 0 auto;
|
|
1865
1865
|
}
|
|
1866
1866
|
.edit-post-visual-editor .components-button {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.10.0",
|
|
4
4
|
"description": "Edit Post module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,34 +27,36 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/a11y": "^3.
|
|
31
|
-
"@wordpress/api-fetch": "^6.
|
|
32
|
-
"@wordpress/block-editor": "^12.
|
|
33
|
-
"@wordpress/block-library": "^8.
|
|
34
|
-
"@wordpress/blocks": "^12.
|
|
35
|
-
"@wordpress/
|
|
36
|
-
"@wordpress/
|
|
37
|
-
"@wordpress/
|
|
38
|
-
"@wordpress/
|
|
39
|
-
"@wordpress/
|
|
40
|
-
"@wordpress/
|
|
41
|
-
"@wordpress/
|
|
42
|
-
"@wordpress/
|
|
43
|
-
"@wordpress/
|
|
44
|
-
"@wordpress/
|
|
45
|
-
"@wordpress/
|
|
46
|
-
"@wordpress/
|
|
47
|
-
"@wordpress/
|
|
48
|
-
"@wordpress/
|
|
49
|
-
"@wordpress/
|
|
50
|
-
"@wordpress/
|
|
51
|
-
"@wordpress/
|
|
52
|
-
"@wordpress/
|
|
53
|
-
"@wordpress/
|
|
54
|
-
"@wordpress/
|
|
55
|
-
"@wordpress/
|
|
56
|
-
"@wordpress/
|
|
57
|
-
"@wordpress/
|
|
30
|
+
"@wordpress/a11y": "^3.33.0",
|
|
31
|
+
"@wordpress/api-fetch": "^6.30.0",
|
|
32
|
+
"@wordpress/block-editor": "^12.1.0",
|
|
33
|
+
"@wordpress/block-library": "^8.10.0",
|
|
34
|
+
"@wordpress/blocks": "^12.10.0",
|
|
35
|
+
"@wordpress/commands": "^0.4.0",
|
|
36
|
+
"@wordpress/components": "^24.0.0",
|
|
37
|
+
"@wordpress/compose": "^6.10.0",
|
|
38
|
+
"@wordpress/core-commands": "^0.2.0",
|
|
39
|
+
"@wordpress/core-data": "^6.10.0",
|
|
40
|
+
"@wordpress/data": "^9.3.0",
|
|
41
|
+
"@wordpress/deprecated": "^3.33.0",
|
|
42
|
+
"@wordpress/dom": "^3.33.0",
|
|
43
|
+
"@wordpress/editor": "^13.10.0",
|
|
44
|
+
"@wordpress/element": "^5.10.0",
|
|
45
|
+
"@wordpress/hooks": "^3.33.0",
|
|
46
|
+
"@wordpress/i18n": "^4.33.0",
|
|
47
|
+
"@wordpress/icons": "^9.24.0",
|
|
48
|
+
"@wordpress/interface": "^5.10.0",
|
|
49
|
+
"@wordpress/keyboard-shortcuts": "^4.10.0",
|
|
50
|
+
"@wordpress/keycodes": "^3.33.0",
|
|
51
|
+
"@wordpress/media-utils": "^4.24.0",
|
|
52
|
+
"@wordpress/notices": "^4.1.0",
|
|
53
|
+
"@wordpress/plugins": "^6.1.0",
|
|
54
|
+
"@wordpress/preferences": "^3.10.0",
|
|
55
|
+
"@wordpress/private-apis": "^0.15.0",
|
|
56
|
+
"@wordpress/url": "^3.34.0",
|
|
57
|
+
"@wordpress/viewport": "^5.10.0",
|
|
58
|
+
"@wordpress/warning": "^2.33.0",
|
|
59
|
+
"@wordpress/widgets": "^3.10.0",
|
|
58
60
|
"classnames": "^2.3.1",
|
|
59
61
|
"memize": "^1.1.0",
|
|
60
62
|
"rememo": "^4.0.2"
|
|
@@ -66,5 +68,5 @@
|
|
|
66
68
|
"publishConfig": {
|
|
67
69
|
"access": "public"
|
|
68
70
|
},
|
|
69
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "e936127e1e13881f1a940b7bd1593a9e500147f3"
|
|
70
72
|
}
|
|
@@ -41,27 +41,15 @@ function HeaderToolbar() {
|
|
|
41
41
|
showIconLabels,
|
|
42
42
|
isListViewOpen,
|
|
43
43
|
listViewShortcut,
|
|
44
|
-
selectedBlockId,
|
|
45
|
-
hasFixedToolbar,
|
|
46
44
|
} = useSelect( ( select ) => {
|
|
47
|
-
const {
|
|
48
|
-
|
|
49
|
-
getBlockRootClientId,
|
|
50
|
-
getBlockSelectionEnd,
|
|
51
|
-
getSelectedBlockClientId,
|
|
52
|
-
getFirstMultiSelectedBlockClientId,
|
|
53
|
-
getSettings,
|
|
54
|
-
} = select( blockEditorStore );
|
|
45
|
+
const { hasInserterItems, getBlockRootClientId, getBlockSelectionEnd } =
|
|
46
|
+
select( blockEditorStore );
|
|
55
47
|
const { getEditorSettings } = select( editorStore );
|
|
56
48
|
const { getEditorMode, isFeatureActive, isListViewOpened } =
|
|
57
49
|
select( editPostStore );
|
|
58
50
|
const { getShortcutRepresentation } = select( keyboardShortcutsStore );
|
|
59
51
|
|
|
60
52
|
return {
|
|
61
|
-
hasFixedToolbar: getSettings().hasFixedToolbar,
|
|
62
|
-
selectedBlockId:
|
|
63
|
-
getSelectedBlockClientId() ||
|
|
64
|
-
getFirstMultiSelectedBlockClientId(),
|
|
65
53
|
// This setting (richEditingEnabled) should not live in the block editor's setting.
|
|
66
54
|
isInserterEnabled:
|
|
67
55
|
getEditorMode() === 'visual' &&
|
|
@@ -83,14 +71,17 @@ function HeaderToolbar() {
|
|
|
83
71
|
|
|
84
72
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
85
73
|
const isWideViewport = useViewportMatch( 'wide' );
|
|
86
|
-
const {
|
|
87
|
-
|
|
74
|
+
const {
|
|
75
|
+
shouldShowContextualToolbar,
|
|
76
|
+
canFocusHiddenToolbar,
|
|
77
|
+
fixedToolbarCanBeFocused,
|
|
78
|
+
} = useShouldContextualToolbarShow();
|
|
88
79
|
// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
|
|
89
80
|
// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.
|
|
90
81
|
const blockToolbarCanBeFocused =
|
|
91
82
|
shouldShowContextualToolbar ||
|
|
92
83
|
canFocusHiddenToolbar ||
|
|
93
|
-
|
|
84
|
+
fixedToolbarCanBeFocused;
|
|
94
85
|
/* translators: accessibility text for the editor toolbar */
|
|
95
86
|
const toolbarAriaLabel = __( 'Document tools' );
|
|
96
87
|
|
|
@@ -15,6 +15,7 @@ import HeaderToolbar from './header-toolbar';
|
|
|
15
15
|
import MoreMenu from './more-menu';
|
|
16
16
|
import PostPublishButtonOrToggle from './post-publish-button-or-toggle';
|
|
17
17
|
import { default as DevicePreview } from '../device-preview';
|
|
18
|
+
import ViewLink from '../view-link';
|
|
18
19
|
import MainDashboardButton from './main-dashboard-button';
|
|
19
20
|
import { store as editPostStore } from '../../store';
|
|
20
21
|
import TemplateTitle from './template-title';
|
|
@@ -88,6 +89,7 @@ function Header( { setEntitiesSavedStatesCallback } ) {
|
|
|
88
89
|
showIconLabels={ showIconLabels }
|
|
89
90
|
/>
|
|
90
91
|
) }
|
|
92
|
+
<ViewLink />
|
|
91
93
|
<DevicePreview />
|
|
92
94
|
<PostPreviewButton
|
|
93
95
|
forceIsAutosaveable={ hasActiveMetaboxes }
|
|
@@ -43,7 +43,9 @@ exports[`KeyboardShortcutHelpModal should match snapshot when the modal is activ
|
|
|
43
43
|
</svg>
|
|
44
44
|
</button>
|
|
45
45
|
</div>
|
|
46
|
-
<div
|
|
46
|
+
<div
|
|
47
|
+
class="components-modal__children-container"
|
|
48
|
+
>
|
|
47
49
|
<section
|
|
48
50
|
class="edit-post-keyboard-shortcut-help-modal__section edit-post-keyboard-shortcut-help-modal__main-shortcuts"
|
|
49
51
|
>
|
|
@@ -130,7 +130,7 @@ function KeyboardShortcuts() {
|
|
|
130
130
|
registerShortcut( {
|
|
131
131
|
name: 'core/edit-post/toggle-sidebar',
|
|
132
132
|
category: 'global',
|
|
133
|
-
description: __( 'Show or hide the
|
|
133
|
+
description: __( 'Show or hide the Settings sidebar.' ),
|
|
134
134
|
keyCombination: {
|
|
135
135
|
modifier: 'primaryShift',
|
|
136
136
|
character: ',',
|
|
@@ -102,7 +102,9 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
|
|
|
102
102
|
</svg>
|
|
103
103
|
</button>
|
|
104
104
|
</div>
|
|
105
|
-
<div
|
|
105
|
+
<div
|
|
106
|
+
class="components-modal__children-container"
|
|
107
|
+
>
|
|
106
108
|
<div
|
|
107
109
|
class="interface-preferences__tabs"
|
|
108
110
|
>
|
|
@@ -608,13 +610,13 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
|
|
|
608
610
|
}
|
|
609
611
|
|
|
610
612
|
.emotion-13:hover {
|
|
611
|
-
color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #
|
|
613
|
+
color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
612
614
|
}
|
|
613
615
|
|
|
614
616
|
.emotion-13:focus {
|
|
615
617
|
background-color: transparent;
|
|
616
|
-
color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #
|
|
617
|
-
border-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #
|
|
618
|
+
color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
619
|
+
border-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
618
620
|
outline: 3px solid transparent;
|
|
619
621
|
}
|
|
620
622
|
|
|
@@ -723,7 +725,9 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
|
|
|
723
725
|
</svg>
|
|
724
726
|
</button>
|
|
725
727
|
</div>
|
|
726
|
-
<div
|
|
728
|
+
<div
|
|
729
|
+
class="components-modal__children-container"
|
|
730
|
+
>
|
|
727
731
|
<div
|
|
728
732
|
class="components-navigator-provider interface-preferences__provider emotion-0 emotion-1"
|
|
729
733
|
data-wp-c16t="true"
|
|
@@ -17,7 +17,7 @@ import warning from '@wordpress/warning';
|
|
|
17
17
|
import { EnablePluginDocumentSettingPanelOption } from '../../preferences-modal/options';
|
|
18
18
|
import { store as editPostStore } from '../../../store';
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
const { Fill, Slot } = createSlotFill( 'PluginDocumentSettingPanel' );
|
|
21
21
|
|
|
22
22
|
const PluginDocumentSettingFill = ( {
|
|
23
23
|
isEnabled,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { createSlotFill, PanelRow } from '@wordpress/components';
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const { Fill, Slot } = createSlotFill( 'PluginPostStatusInfo' );
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Renders a row in the Summary panel of the Document sidebar.
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
__experimentalHStack as HStack,
|
|
7
|
+
PanelBody,
|
|
8
|
+
} from '@wordpress/components';
|
|
6
9
|
import { withSelect, withDispatch } from '@wordpress/data';
|
|
7
10
|
import { compose, ifCondition } from '@wordpress/compose';
|
|
11
|
+
import { PostSwitchToDraftButton } from '@wordpress/editor';
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
14
|
* Internal dependencies
|
|
@@ -48,7 +52,15 @@ function PostStatus( { isOpened, onTogglePanel } ) {
|
|
|
48
52
|
<PostSlug />
|
|
49
53
|
<PostAuthor />
|
|
50
54
|
{ fills }
|
|
51
|
-
<
|
|
55
|
+
<HStack
|
|
56
|
+
style={ {
|
|
57
|
+
marginTop: '16px',
|
|
58
|
+
} }
|
|
59
|
+
spacing={ 4 }
|
|
60
|
+
>
|
|
61
|
+
<PostSwitchToDraftButton />
|
|
62
|
+
<PostTrash />
|
|
63
|
+
</HStack>
|
|
52
64
|
</>
|
|
53
65
|
) }
|
|
54
66
|
</PluginPostStatusInfo.Slot>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { PanelRow } from '@wordpress/components';
|
|
5
4
|
import { PostTrash as PostTrashLink, PostTrashCheck } from '@wordpress/editor';
|
|
5
|
+
import { FlexItem } from '@wordpress/components';
|
|
6
6
|
|
|
7
7
|
export default function PostTrash() {
|
|
8
8
|
return (
|
|
9
9
|
<PostTrashCheck>
|
|
10
|
-
<
|
|
10
|
+
<FlexItem isBlock>
|
|
11
11
|
<PostTrashLink />
|
|
12
|
-
</
|
|
12
|
+
</FlexItem>
|
|
13
13
|
</PostTrashCheck>
|
|
14
14
|
);
|
|
15
15
|
}
|
|
@@ -73,7 +73,7 @@ const SettingsSidebar = () => {
|
|
|
73
73
|
<PluginSidebarEditPost
|
|
74
74
|
identifier={ sidebarName }
|
|
75
75
|
header={ <SettingsHeader sidebarName={ sidebarName } /> }
|
|
76
|
-
closeLabel={ __( 'Close
|
|
76
|
+
closeLabel={ __( 'Close Settings' ) }
|
|
77
77
|
headerClassName="edit-post-sidebar__panel-tabs"
|
|
78
78
|
/* translators: button label text should, if possible, be under 16 characters. */
|
|
79
79
|
title={ __( 'Settings' ) }
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { Button } from '@wordpress/components';
|
|
6
|
+
import { external } from '@wordpress/icons';
|
|
7
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
8
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
9
|
+
import { useSelect } from '@wordpress/data';
|
|
10
|
+
|
|
11
|
+
export default function ViewLink() {
|
|
12
|
+
const { permalink, isPublished, label } = useSelect( ( select ) => {
|
|
13
|
+
// Grab post type to retrieve the view_item label.
|
|
14
|
+
const postTypeSlug = select( editorStore ).getCurrentPostType();
|
|
15
|
+
const postType = select( coreStore ).getPostType( postTypeSlug );
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
permalink: select( editorStore ).getPermalink(),
|
|
19
|
+
isPublished: select( editorStore ).isCurrentPostPublished(),
|
|
20
|
+
label: postType?.labels.view_item,
|
|
21
|
+
};
|
|
22
|
+
}, [] );
|
|
23
|
+
|
|
24
|
+
// Only render the view button if the post is published and has a permalink.
|
|
25
|
+
if ( ! isPublished || ! permalink ) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Button
|
|
31
|
+
icon={ external }
|
|
32
|
+
label={ label || __( 'View post' ) }
|
|
33
|
+
href={ permalink }
|
|
34
|
+
target="_blank"
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
@@ -6,8 +11,10 @@ import { __ } from '@wordpress/i18n';
|
|
|
6
11
|
import { withDispatch, withSelect } from '@wordpress/data';
|
|
7
12
|
import { compose, withPreferredColorScheme } from '@wordpress/compose';
|
|
8
13
|
import { PostTitle } from '@wordpress/editor';
|
|
9
|
-
import {
|
|
10
|
-
|
|
14
|
+
import {
|
|
15
|
+
store as blockEditorStore,
|
|
16
|
+
useEditorWrapperStyles,
|
|
17
|
+
} from '@wordpress/block-editor';
|
|
11
18
|
|
|
12
19
|
/**
|
|
13
20
|
* Internal dependencies
|
|
@@ -21,12 +28,13 @@ const Header = memo(
|
|
|
21
28
|
title,
|
|
22
29
|
getStylesFromColorScheme,
|
|
23
30
|
} ) {
|
|
31
|
+
const [ wrapperStyles ] = useEditorWrapperStyles();
|
|
24
32
|
const blockHolderFocusedStyle = getStylesFromColorScheme(
|
|
25
33
|
styles.blockHolderFocused,
|
|
26
34
|
styles.blockHolderFocusedDark
|
|
27
35
|
);
|
|
28
36
|
return (
|
|
29
|
-
<
|
|
37
|
+
<View style={ wrapperStyles }>
|
|
30
38
|
<PostTitle
|
|
31
39
|
innerRef={ setTitleRef }
|
|
32
40
|
title={ title }
|
|
@@ -36,7 +44,7 @@ const Header = memo(
|
|
|
36
44
|
focusedBorderColor={ blockHolderFocusedStyle.borderColor }
|
|
37
45
|
accessibilityLabel="post-title"
|
|
38
46
|
/>
|
|
39
|
-
</
|
|
47
|
+
</View>
|
|
40
48
|
);
|
|
41
49
|
},
|
|
42
50
|
( prevProps, nextProps ) => prevProps.title === nextProps.title
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// Gray preview overlay (desktop/tablet/mobile) is intentionally not set on an element with scrolling content like
|
|
8
8
|
// interface-interface-skeleton__content. This causes graphical glitches (flashes of the background color)
|
|
9
9
|
// when scrolling in Safari due to incorrect ordering of large compositing layers (GPU acceleration).
|
|
10
|
-
background-color: $gray-
|
|
10
|
+
background-color: $gray-900;
|
|
11
11
|
|
|
12
12
|
// The button element easily inherits styles that are meant for the editor style.
|
|
13
13
|
// These rules enhance the specificity to reduce that inheritance.
|