@wordpress/editor 13.12.3 → 13.12.5
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/post-switch-to-draft-button/index.js +3 -5
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-sync-status/index.js +3 -22
- package/build/components/post-sync-status/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +5 -7
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-sync-status/index.js +5 -24
- package/build-module/components/post-sync-status/index.js.map +1 -1
- package/build-style/style-rtl.css +4 -4
- package/build-style/style.css +4 -4
- package/package.json +13 -13
- package/src/components/post-switch-to-draft-button/index.js +3 -4
- package/src/components/post-sync-status/index.js +8 -29
- package/src/components/post-sync-status/style.scss +2 -2
- package/src/components/post-trash/style.scss +2 -2
|
@@ -49,9 +49,7 @@ function PostSwitchToDraftButton({
|
|
|
49
49
|
onClick();
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
return (0, _element.createElement)(_components.
|
|
53
|
-
isBlock: true
|
|
54
|
-
}, (0, _element.createElement)(_components.Button, {
|
|
52
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.Button, {
|
|
55
53
|
className: "editor-post-switch-to-draft",
|
|
56
54
|
onClick: () => {
|
|
57
55
|
setShowConfirmDialog(true);
|
|
@@ -59,8 +57,8 @@ function PostSwitchToDraftButton({
|
|
|
59
57
|
disabled: isSaving,
|
|
60
58
|
variant: "secondary",
|
|
61
59
|
style: {
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
flexGrow: '1',
|
|
61
|
+
justifyContent: 'center'
|
|
64
62
|
}
|
|
65
63
|
}, (0, _i18n.__)('Switch to draft')), (0, _element.createElement)(_components.__experimentalConfirmDialog, {
|
|
66
64
|
isOpen: showConfirmDialog,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-switch-to-draft-button/index.js"],"names":["PostSwitchToDraftButton","isSaving","isPublished","isScheduled","onClick","showConfirmDialog","setShowConfirmDialog","alertMessage","handleConfirm","
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-switch-to-draft-button/index.js"],"names":["PostSwitchToDraftButton","isSaving","isPublished","isScheduled","onClick","showConfirmDialog","setShowConfirmDialog","alertMessage","handleConfirm","flexGrow","justifyContent","select","isSavingPost","isCurrentPostPublished","isCurrentPostScheduled","editorStore","dispatch","editPost","savePost","status"],"mappings":";;;;;;;AAUA;;AAPA;;AAIA;;AACA;;AACA;;AAMA;;AAfA;AACA;AACA;;AAUA;AACA;AACA;AAGA,SAASA,uBAAT,CAAkC;AACjCC,EAAAA,QADiC;AAEjCC,EAAAA,WAFiC;AAGjCC,EAAAA,WAHiC;AAIjCC,EAAAA;AAJiC,CAAlC,EAKI;AACH,QAAM,CAAEC,iBAAF,EAAqBC,oBAArB,IAA8C,uBAAU,KAAV,CAApD;;AAEA,MAAK,CAAEJ,WAAF,IAAiB,CAAEC,WAAxB,EAAsC;AACrC,WAAO,IAAP;AACA;;AAED,MAAII,YAAJ;;AACA,MAAKL,WAAL,EAAmB;AAClBK,IAAAA,YAAY,GAAG,cAAI,+CAAJ,CAAf;AACA,GAFD,MAEO,IAAKJ,WAAL,EAAmB;AACzBI,IAAAA,YAAY,GAAG,cAAI,gDAAJ,CAAf;AACA;;AAED,QAAMC,aAAa,GAAG,MAAM;AAC3BF,IAAAA,oBAAoB,CAAE,KAAF,CAApB;AACAF,IAAAA,OAAO;AACP,GAHD;;AAKA,SACC,qDACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,6BADX;AAEC,IAAA,OAAO,EAAG,MAAM;AACfE,MAAAA,oBAAoB,CAAE,IAAF,CAApB;AACA,KAJF;AAKC,IAAA,QAAQ,EAAGL,QALZ;AAMC,IAAA,OAAO,EAAC,WANT;AAOC,IAAA,KAAK,EAAG;AAAEQ,MAAAA,QAAQ,EAAE,GAAZ;AAAiBC,MAAAA,cAAc,EAAE;AAAjC;AAPT,KASG,cAAI,iBAAJ,CATH,CADD,EAYC,4BAAC,uCAAD;AACC,IAAA,MAAM,EAAGL,iBADV;AAEC,IAAA,SAAS,EAAGG,aAFb;AAGC,IAAA,QAAQ,EAAG,MAAMF,oBAAoB,CAAE,KAAF;AAHtC,KAKGC,YALH,CAZD,CADD;AAsBA;;eAEc,sBAAS,CACvB,sBAAcI,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,sBAAhB;AAAwCC,IAAAA;AAAxC,MACLH,MAAM,CAAEI,YAAF,CADP;AAEA,SAAO;AACNd,IAAAA,QAAQ,EAAEW,YAAY,EADhB;AAENV,IAAAA,WAAW,EAAEW,sBAAsB,EAF7B;AAGNV,IAAAA,WAAW,EAAEW,sBAAsB;AAH7B,GAAP;AAKA,CARD,CADuB,EAUvB,wBAAgBE,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyBF,QAAQ,CAAED,YAAF,CAAvC;AACA,SAAO;AACNX,IAAAA,OAAO,EAAE,MAAM;AACda,MAAAA,QAAQ,CAAE;AAAEE,QAAAA,MAAM,EAAE;AAAV,OAAF,CAAR;AACAD,MAAAA,QAAQ;AACR;AAJK,GAAP;AAMA,CARD,CAVuB,CAAT,EAmBVlB,uBAnBU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostSwitchToDraftButton( {\n\tisSaving,\n\tisPublished,\n\tisScheduled,\n\tonClick,\n} ) {\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tif ( ! isPublished && ! isScheduled ) {\n\t\treturn null;\n\t}\n\n\tlet alertMessage;\n\tif ( isPublished ) {\n\t\talertMessage = __( 'Are you sure you want to unpublish this post?' );\n\t} else if ( isScheduled ) {\n\t\talertMessage = __( 'Are you sure you want to unschedule this post?' );\n\t}\n\n\tconst handleConfirm = () => {\n\t\tsetShowConfirmDialog( false );\n\t\tonClick();\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-post-switch-to-draft\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetShowConfirmDialog( true );\n\t\t\t\t} }\n\t\t\t\tdisabled={ isSaving }\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tstyle={ { flexGrow: '1', justifyContent: 'center' } }\n\t\t\t>\n\t\t\t\t{ __( 'Switch to draft' ) }\n\t\t\t</Button>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\tonConfirm={ handleConfirm }\n\t\t\t\tonCancel={ () => setShowConfirmDialog( false ) }\n\t\t\t>\n\t\t\t\t{ alertMessage }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { isSavingPost, isCurrentPostPublished, isCurrentPostScheduled } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, savePost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonClick: () => {\n\t\t\t\teditPost( { status: 'draft' } );\n\t\t\t\tsavePost();\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSwitchToDraftButton );\n"]}
|
|
@@ -24,17 +24,14 @@ var _store = require("../../store");
|
|
|
24
24
|
*/
|
|
25
25
|
function PostSyncStatus() {
|
|
26
26
|
const {
|
|
27
|
-
|
|
28
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
29
|
-
const {
|
|
30
|
-
meta,
|
|
27
|
+
syncStatus,
|
|
31
28
|
postType
|
|
32
29
|
} = (0, _data.useSelect)(select => {
|
|
33
30
|
const {
|
|
34
31
|
getEditedPostAttribute
|
|
35
32
|
} = select(_store.store);
|
|
36
33
|
return {
|
|
37
|
-
|
|
34
|
+
syncStatus: getEditedPostAttribute('wp_pattern_sync_status'),
|
|
38
35
|
postType: getEditedPostAttribute('type')
|
|
39
36
|
};
|
|
40
37
|
}, []);
|
|
@@ -43,25 +40,9 @@ function PostSyncStatus() {
|
|
|
43
40
|
return null;
|
|
44
41
|
}
|
|
45
42
|
|
|
46
|
-
const onUpdateSync = syncStatus => editPost({
|
|
47
|
-
meta: { ...meta,
|
|
48
|
-
wp_block: syncStatus === 'unsynced' ? {
|
|
49
|
-
sync_status: syncStatus
|
|
50
|
-
} : null
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const syncStatus = meta?.wp_block?.sync_status;
|
|
55
43
|
const isFullySynced = !syncStatus;
|
|
56
44
|
return (0, _element.createElement)(_components.PanelRow, {
|
|
57
45
|
className: "edit-post-sync-status"
|
|
58
|
-
}, (0, _element.createElement)("span", null, (0, _i18n.__)('
|
|
59
|
-
__nextHasNoMarginBottom: true,
|
|
60
|
-
label: isFullySynced ? (0, _i18n.__)('Fully synced') : (0, _i18n.__)('Not synced'),
|
|
61
|
-
checked: isFullySynced,
|
|
62
|
-
onChange: () => {
|
|
63
|
-
onUpdateSync(syncStatus === 'unsynced' ? 'fully' : 'unsynced');
|
|
64
|
-
}
|
|
65
|
-
}));
|
|
46
|
+
}, (0, _element.createElement)("span", null, (0, _i18n.__)('Sync status')), (0, _element.createElement)("div", null, isFullySynced ? (0, _i18n.__)('Fully synced') : (0, _i18n.__)('Not synced')));
|
|
66
47
|
}
|
|
67
48
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"names":["PostSyncStatus","
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"names":["PostSyncStatus","syncStatus","postType","select","getEditedPostAttribute","editorStore","isFullySynced"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAGe,SAASA,cAAT,GAA0B;AACxC,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA2B,qBAAaC,MAAF,IAAc;AACzD,UAAM;AAAEC,MAAAA;AAAF,QAA6BD,MAAM,CAAEE,YAAF,CAAzC;AACA,WAAO;AACNJ,MAAAA,UAAU,EAAEG,sBAAsB,CAAE,wBAAF,CAD5B;AAENF,MAAAA,QAAQ,EAAEE,sBAAsB,CAAE,MAAF;AAF1B,KAAP;AAIA,GANgC,EAM9B,EAN8B,CAAjC;;AAOA,MAAKF,QAAQ,KAAK,UAAlB,EAA+B;AAC9B,WAAO,IAAP;AACA;;AACD,QAAMI,aAAa,GAAG,CAAEL,UAAxB;AAEA,SACC,4BAAC,oBAAD;AAAU,IAAA,SAAS,EAAC;AAApB,KACC,0CAAQ,cAAI,aAAJ,CAAR,CADD,EAEC,yCACGK,aAAa,GAAG,cAAI,cAAJ,CAAH,GAA0B,cAAI,YAAJ,CAD1C,CAFD,CADD;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { PanelRow } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostSyncStatus() {\n\tconst { syncStatus, postType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\treturn {\n\t\t\tsyncStatus: getEditedPostAttribute( 'wp_pattern_sync_status' ),\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t};\n\t}, [] );\n\tif ( postType !== 'wp_block' ) {\n\t\treturn null;\n\t}\n\tconst isFullySynced = ! syncStatus;\n\n\treturn (\n\t\t<PanelRow className=\"edit-post-sync-status\">\n\t\t\t<span>{ __( 'Sync status' ) }</span>\n\t\t\t<div>\n\t\t\t\t{ isFullySynced ? __( 'Fully synced' ) : __( 'Not synced' ) }\n\t\t\t</div>\n\t\t</PanelRow>\n\t);\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { Button,
|
|
6
|
+
import { Button, __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
8
|
import { withSelect, withDispatch } from '@wordpress/data';
|
|
9
9
|
import { compose } from '@wordpress/compose';
|
|
@@ -39,9 +39,7 @@ function PostSwitchToDraftButton({
|
|
|
39
39
|
onClick();
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
return createElement(
|
|
43
|
-
isBlock: true
|
|
44
|
-
}, createElement(Button, {
|
|
42
|
+
return createElement(Fragment, null, createElement(Button, {
|
|
45
43
|
className: "editor-post-switch-to-draft",
|
|
46
44
|
onClick: () => {
|
|
47
45
|
setShowConfirmDialog(true);
|
|
@@ -49,8 +47,8 @@ function PostSwitchToDraftButton({
|
|
|
49
47
|
disabled: isSaving,
|
|
50
48
|
variant: "secondary",
|
|
51
49
|
style: {
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
flexGrow: '1',
|
|
51
|
+
justifyContent: 'center'
|
|
54
52
|
}
|
|
55
53
|
}, __('Switch to draft')), createElement(ConfirmDialog, {
|
|
56
54
|
isOpen: showConfirmDialog,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-switch-to-draft-button/index.js"],"names":["Button","
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-switch-to-draft-button/index.js"],"names":["Button","__experimentalConfirmDialog","ConfirmDialog","__","withSelect","withDispatch","compose","useState","store","editorStore","PostSwitchToDraftButton","isSaving","isPublished","isScheduled","onClick","showConfirmDialog","setShowConfirmDialog","alertMessage","handleConfirm","flexGrow","justifyContent","select","isSavingPost","isCurrentPostPublished","isCurrentPostScheduled","dispatch","editPost","savePost","status"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,MADD,EAECC,2BAA2B,IAAIC,aAFhC,QAGO,uBAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,uBAAT,CAAkC;AACjCC,EAAAA,QADiC;AAEjCC,EAAAA,WAFiC;AAGjCC,EAAAA,WAHiC;AAIjCC,EAAAA;AAJiC,CAAlC,EAKI;AACH,QAAM,CAAEC,iBAAF,EAAqBC,oBAArB,IAA8CT,QAAQ,CAAE,KAAF,CAA5D;;AAEA,MAAK,CAAEK,WAAF,IAAiB,CAAEC,WAAxB,EAAsC;AACrC,WAAO,IAAP;AACA;;AAED,MAAII,YAAJ;;AACA,MAAKL,WAAL,EAAmB;AAClBK,IAAAA,YAAY,GAAGd,EAAE,CAAE,+CAAF,CAAjB;AACA,GAFD,MAEO,IAAKU,WAAL,EAAmB;AACzBI,IAAAA,YAAY,GAAGd,EAAE,CAAE,gDAAF,CAAjB;AACA;;AAED,QAAMe,aAAa,GAAG,MAAM;AAC3BF,IAAAA,oBAAoB,CAAE,KAAF,CAApB;AACAF,IAAAA,OAAO;AACP,GAHD;;AAKA,SACC,8BACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,6BADX;AAEC,IAAA,OAAO,EAAG,MAAM;AACfE,MAAAA,oBAAoB,CAAE,IAAF,CAApB;AACA,KAJF;AAKC,IAAA,QAAQ,EAAGL,QALZ;AAMC,IAAA,OAAO,EAAC,WANT;AAOC,IAAA,KAAK,EAAG;AAAEQ,MAAAA,QAAQ,EAAE,GAAZ;AAAiBC,MAAAA,cAAc,EAAE;AAAjC;AAPT,KASGjB,EAAE,CAAE,iBAAF,CATL,CADD,EAYC,cAAC,aAAD;AACC,IAAA,MAAM,EAAGY,iBADV;AAEC,IAAA,SAAS,EAAGG,aAFb;AAGC,IAAA,QAAQ,EAAG,MAAMF,oBAAoB,CAAE,KAAF;AAHtC,KAKGC,YALH,CAZD,CADD;AAsBA;;AAED,eAAeX,OAAO,CAAE,CACvBF,UAAU,CAAIiB,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,sBAAhB;AAAwCC,IAAAA;AAAxC,MACLH,MAAM,CAAEZ,WAAF,CADP;AAEA,SAAO;AACNE,IAAAA,QAAQ,EAAEW,YAAY,EADhB;AAENV,IAAAA,WAAW,EAAEW,sBAAsB,EAF7B;AAGNV,IAAAA,WAAW,EAAEW,sBAAsB;AAH7B,GAAP;AAKA,CARS,CADa,EAUvBnB,YAAY,CAAIoB,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyBF,QAAQ,CAAEhB,WAAF,CAAvC;AACA,SAAO;AACNK,IAAAA,OAAO,EAAE,MAAM;AACdY,MAAAA,QAAQ,CAAE;AAAEE,QAAAA,MAAM,EAAE;AAAV,OAAF,CAAR;AACAD,MAAAA,QAAQ;AACR;AAJK,GAAP;AAMA,CARW,CAVW,CAAF,CAAP,CAmBVjB,uBAnBU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostSwitchToDraftButton( {\n\tisSaving,\n\tisPublished,\n\tisScheduled,\n\tonClick,\n} ) {\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tif ( ! isPublished && ! isScheduled ) {\n\t\treturn null;\n\t}\n\n\tlet alertMessage;\n\tif ( isPublished ) {\n\t\talertMessage = __( 'Are you sure you want to unpublish this post?' );\n\t} else if ( isScheduled ) {\n\t\talertMessage = __( 'Are you sure you want to unschedule this post?' );\n\t}\n\n\tconst handleConfirm = () => {\n\t\tsetShowConfirmDialog( false );\n\t\tonClick();\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-post-switch-to-draft\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetShowConfirmDialog( true );\n\t\t\t\t} }\n\t\t\t\tdisabled={ isSaving }\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tstyle={ { flexGrow: '1', justifyContent: 'center' } }\n\t\t\t>\n\t\t\t\t{ __( 'Switch to draft' ) }\n\t\t\t</Button>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\tonConfirm={ handleConfirm }\n\t\t\t\tonCancel={ () => setShowConfirmDialog( false ) }\n\t\t\t>\n\t\t\t\t{ alertMessage }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { isSavingPost, isCurrentPostPublished, isCurrentPostScheduled } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, savePost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonClick: () => {\n\t\t\t\teditPost( { status: 'draft' } );\n\t\t\t\tsavePost();\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSwitchToDraftButton );\n"]}
|
|
@@ -3,9 +3,9 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { useSelect
|
|
6
|
+
import { useSelect } from '@wordpress/data';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
|
-
import {
|
|
8
|
+
import { PanelRow } from '@wordpress/components';
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
@@ -13,17 +13,14 @@ import { ToggleControl, PanelRow } from '@wordpress/components';
|
|
|
13
13
|
import { store as editorStore } from '../../store';
|
|
14
14
|
export default function PostSyncStatus() {
|
|
15
15
|
const {
|
|
16
|
-
|
|
17
|
-
} = useDispatch(editorStore);
|
|
18
|
-
const {
|
|
19
|
-
meta,
|
|
16
|
+
syncStatus,
|
|
20
17
|
postType
|
|
21
18
|
} = useSelect(select => {
|
|
22
19
|
const {
|
|
23
20
|
getEditedPostAttribute
|
|
24
21
|
} = select(editorStore);
|
|
25
22
|
return {
|
|
26
|
-
|
|
23
|
+
syncStatus: getEditedPostAttribute('wp_pattern_sync_status'),
|
|
27
24
|
postType: getEditedPostAttribute('type')
|
|
28
25
|
};
|
|
29
26
|
}, []);
|
|
@@ -32,25 +29,9 @@ export default function PostSyncStatus() {
|
|
|
32
29
|
return null;
|
|
33
30
|
}
|
|
34
31
|
|
|
35
|
-
const onUpdateSync = syncStatus => editPost({
|
|
36
|
-
meta: { ...meta,
|
|
37
|
-
wp_block: syncStatus === 'unsynced' ? {
|
|
38
|
-
sync_status: syncStatus
|
|
39
|
-
} : null
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
const syncStatus = meta?.wp_block?.sync_status;
|
|
44
32
|
const isFullySynced = !syncStatus;
|
|
45
33
|
return createElement(PanelRow, {
|
|
46
34
|
className: "edit-post-sync-status"
|
|
47
|
-
}, createElement("span", null, __('
|
|
48
|
-
__nextHasNoMarginBottom: true,
|
|
49
|
-
label: isFullySynced ? __('Fully synced') : __('Not synced'),
|
|
50
|
-
checked: isFullySynced,
|
|
51
|
-
onChange: () => {
|
|
52
|
-
onUpdateSync(syncStatus === 'unsynced' ? 'fully' : 'unsynced');
|
|
53
|
-
}
|
|
54
|
-
}));
|
|
35
|
+
}, createElement("span", null, __('Sync status')), createElement("div", null, isFullySynced ? __('Fully synced') : __('Not synced')));
|
|
55
36
|
}
|
|
56
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"names":["useSelect","
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"names":["useSelect","__","PanelRow","store","editorStore","PostSyncStatus","syncStatus","postType","select","getEditedPostAttribute","isFullySynced"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,uBAAzB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,eAAe,SAASC,cAAT,GAA0B;AACxC,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA2BP,SAAS,CAAIQ,MAAF,IAAc;AACzD,UAAM;AAAEC,MAAAA;AAAF,QAA6BD,MAAM,CAAEJ,WAAF,CAAzC;AACA,WAAO;AACNE,MAAAA,UAAU,EAAEG,sBAAsB,CAAE,wBAAF,CAD5B;AAENF,MAAAA,QAAQ,EAAEE,sBAAsB,CAAE,MAAF;AAF1B,KAAP;AAIA,GANyC,EAMvC,EANuC,CAA1C;;AAOA,MAAKF,QAAQ,KAAK,UAAlB,EAA+B;AAC9B,WAAO,IAAP;AACA;;AACD,QAAMG,aAAa,GAAG,CAAEJ,UAAxB;AAEA,SACC,cAAC,QAAD;AAAU,IAAA,SAAS,EAAC;AAApB,KACC,4BAAQL,EAAE,CAAE,aAAF,CAAV,CADD,EAEC,2BACGS,aAAa,GAAGT,EAAE,CAAE,cAAF,CAAL,GAA0BA,EAAE,CAAE,YAAF,CAD5C,CAFD,CADD;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { PanelRow } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostSyncStatus() {\n\tconst { syncStatus, postType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\treturn {\n\t\t\tsyncStatus: getEditedPostAttribute( 'wp_pattern_sync_status' ),\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t};\n\t}, [] );\n\tif ( postType !== 'wp_block' ) {\n\t\treturn null;\n\t}\n\tconst isFullySynced = ! syncStatus;\n\n\treturn (\n\t\t<PanelRow className=\"edit-post-sync-status\">\n\t\t\t<span>{ __( 'Sync status' ) }</span>\n\t\t\t<div>\n\t\t\t\t{ isFullySynced ? __( 'Fully synced' ) : __( 'Not synced' ) }\n\t\t\t</div>\n\t\t</PanelRow>\n\t);\n}\n"]}
|
|
@@ -637,8 +637,8 @@
|
|
|
637
637
|
width: 45%;
|
|
638
638
|
flex-shrink: 0;
|
|
639
639
|
}
|
|
640
|
-
.edit-post-sync-status
|
|
641
|
-
padding-right:
|
|
640
|
+
.edit-post-sync-status > div {
|
|
641
|
+
padding-right: 12px;
|
|
642
642
|
}
|
|
643
643
|
|
|
644
644
|
.editor-post-taxonomies__hierarchical-terms-list {
|
|
@@ -871,8 +871,8 @@
|
|
|
871
871
|
}
|
|
872
872
|
|
|
873
873
|
.editor-post-trash.components-button {
|
|
874
|
-
|
|
875
|
-
|
|
874
|
+
flex-grow: 1;
|
|
875
|
+
justify-content: center;
|
|
876
876
|
}
|
|
877
877
|
|
|
878
878
|
.table-of-contents__popover.components-popover .components-popover__content {
|
package/build-style/style.css
CHANGED
|
@@ -637,8 +637,8 @@
|
|
|
637
637
|
width: 45%;
|
|
638
638
|
flex-shrink: 0;
|
|
639
639
|
}
|
|
640
|
-
.edit-post-sync-status
|
|
641
|
-
padding-left:
|
|
640
|
+
.edit-post-sync-status > div {
|
|
641
|
+
padding-left: 12px;
|
|
642
642
|
}
|
|
643
643
|
|
|
644
644
|
.editor-post-taxonomies__hierarchical-terms-list {
|
|
@@ -875,8 +875,8 @@
|
|
|
875
875
|
}
|
|
876
876
|
|
|
877
877
|
.editor-post-trash.components-button {
|
|
878
|
-
|
|
879
|
-
|
|
878
|
+
flex-grow: 1;
|
|
879
|
+
justify-content: center;
|
|
880
880
|
}
|
|
881
881
|
|
|
882
882
|
.table-of-contents__popover.components-popover .components-popover__content {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "13.12.
|
|
3
|
+
"version": "13.12.5",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"@wordpress/a11y": "^3.35.1",
|
|
35
35
|
"@wordpress/api-fetch": "^6.32.1",
|
|
36
36
|
"@wordpress/blob": "^3.35.1",
|
|
37
|
-
"@wordpress/block-editor": "^12.3.
|
|
38
|
-
"@wordpress/blocks": "^12.12.
|
|
39
|
-
"@wordpress/components": "^25.1.
|
|
37
|
+
"@wordpress/block-editor": "^12.3.5",
|
|
38
|
+
"@wordpress/blocks": "^12.12.3",
|
|
39
|
+
"@wordpress/components": "^25.1.5",
|
|
40
40
|
"@wordpress/compose": "^6.12.1",
|
|
41
|
-
"@wordpress/core-data": "^6.12.
|
|
42
|
-
"@wordpress/data": "^9.5.
|
|
41
|
+
"@wordpress/core-data": "^6.12.5",
|
|
42
|
+
"@wordpress/data": "^9.5.3",
|
|
43
43
|
"@wordpress/date": "^4.35.1",
|
|
44
44
|
"@wordpress/deprecated": "^3.35.1",
|
|
45
45
|
"@wordpress/dom": "^3.35.1",
|
|
@@ -48,15 +48,15 @@
|
|
|
48
48
|
"@wordpress/html-entities": "^3.35.1",
|
|
49
49
|
"@wordpress/i18n": "^4.35.1",
|
|
50
50
|
"@wordpress/icons": "^9.26.2",
|
|
51
|
-
"@wordpress/keyboard-shortcuts": "^4.12.
|
|
51
|
+
"@wordpress/keyboard-shortcuts": "^4.12.3",
|
|
52
52
|
"@wordpress/keycodes": "^3.35.1",
|
|
53
53
|
"@wordpress/media-utils": "^4.26.1",
|
|
54
|
-
"@wordpress/notices": "^4.3.
|
|
55
|
-
"@wordpress/preferences": "^3.12.
|
|
54
|
+
"@wordpress/notices": "^4.3.3",
|
|
55
|
+
"@wordpress/preferences": "^3.12.5",
|
|
56
56
|
"@wordpress/private-apis": "^0.17.1",
|
|
57
|
-
"@wordpress/reusable-blocks": "^4.12.
|
|
58
|
-
"@wordpress/rich-text": "^6.12.
|
|
59
|
-
"@wordpress/server-side-render": "^4.12.
|
|
57
|
+
"@wordpress/reusable-blocks": "^4.12.5",
|
|
58
|
+
"@wordpress/rich-text": "^6.12.3",
|
|
59
|
+
"@wordpress/server-side-render": "^4.12.5",
|
|
60
60
|
"@wordpress/url": "^3.36.1",
|
|
61
61
|
"@wordpress/wordcount": "^3.35.1",
|
|
62
62
|
"classnames": "^2.3.1",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "3eeb607ebb76c3bf06cb8acb462f0dc068f340f9"
|
|
77
77
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
Button,
|
|
6
|
-
FlexItem,
|
|
7
6
|
__experimentalConfirmDialog as ConfirmDialog,
|
|
8
7
|
} from '@wordpress/components';
|
|
9
8
|
import { __ } from '@wordpress/i18n';
|
|
@@ -41,7 +40,7 @@ function PostSwitchToDraftButton( {
|
|
|
41
40
|
};
|
|
42
41
|
|
|
43
42
|
return (
|
|
44
|
-
|
|
43
|
+
<>
|
|
45
44
|
<Button
|
|
46
45
|
className="editor-post-switch-to-draft"
|
|
47
46
|
onClick={ () => {
|
|
@@ -49,7 +48,7 @@ function PostSwitchToDraftButton( {
|
|
|
49
48
|
} }
|
|
50
49
|
disabled={ isSaving }
|
|
51
50
|
variant="secondary"
|
|
52
|
-
style={ {
|
|
51
|
+
style={ { flexGrow: '1', justifyContent: 'center' } }
|
|
53
52
|
>
|
|
54
53
|
{ __( 'Switch to draft' ) }
|
|
55
54
|
</Button>
|
|
@@ -60,7 +59,7 @@ function PostSwitchToDraftButton( {
|
|
|
60
59
|
>
|
|
61
60
|
{ alertMessage }
|
|
62
61
|
</ConfirmDialog>
|
|
63
|
-
|
|
62
|
+
</>
|
|
64
63
|
);
|
|
65
64
|
}
|
|
66
65
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useSelect
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import {
|
|
6
|
+
import { PanelRow } from '@wordpress/components';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
@@ -11,45 +11,24 @@ import { ToggleControl, PanelRow } from '@wordpress/components';
|
|
|
11
11
|
import { store as editorStore } from '../../store';
|
|
12
12
|
|
|
13
13
|
export default function PostSyncStatus() {
|
|
14
|
-
const {
|
|
15
|
-
const { meta, postType } = useSelect( ( select ) => {
|
|
14
|
+
const { syncStatus, postType } = useSelect( ( select ) => {
|
|
16
15
|
const { getEditedPostAttribute } = select( editorStore );
|
|
17
16
|
return {
|
|
18
|
-
|
|
17
|
+
syncStatus: getEditedPostAttribute( 'wp_pattern_sync_status' ),
|
|
19
18
|
postType: getEditedPostAttribute( 'type' ),
|
|
20
19
|
};
|
|
21
20
|
}, [] );
|
|
22
21
|
if ( postType !== 'wp_block' ) {
|
|
23
22
|
return null;
|
|
24
23
|
}
|
|
25
|
-
const onUpdateSync = ( syncStatus ) =>
|
|
26
|
-
editPost( {
|
|
27
|
-
meta: {
|
|
28
|
-
...meta,
|
|
29
|
-
wp_block:
|
|
30
|
-
syncStatus === 'unsynced'
|
|
31
|
-
? { sync_status: syncStatus }
|
|
32
|
-
: null,
|
|
33
|
-
},
|
|
34
|
-
} );
|
|
35
|
-
const syncStatus = meta?.wp_block?.sync_status;
|
|
36
24
|
const isFullySynced = ! syncStatus;
|
|
37
25
|
|
|
38
26
|
return (
|
|
39
27
|
<PanelRow className="edit-post-sync-status">
|
|
40
|
-
<span>{ __( '
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
isFullySynced ? __( 'Fully synced' ) : __( 'Not synced' )
|
|
45
|
-
}
|
|
46
|
-
checked={ isFullySynced }
|
|
47
|
-
onChange={ () => {
|
|
48
|
-
onUpdateSync(
|
|
49
|
-
syncStatus === 'unsynced' ? 'fully' : 'unsynced'
|
|
50
|
-
);
|
|
51
|
-
} }
|
|
52
|
-
/>
|
|
28
|
+
<span>{ __( 'Sync status' ) }</span>
|
|
29
|
+
<div>
|
|
30
|
+
{ isFullySynced ? __( 'Fully synced' ) : __( 'Not synced' ) }
|
|
31
|
+
</div>
|
|
53
32
|
</PanelRow>
|
|
54
33
|
);
|
|
55
34
|
}
|