@wordpress/editor 13.12.6 → 13.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.
@@ -54,6 +54,7 @@ var _exportNames = {
54
54
  PostStickyCheck: true,
55
55
  PostSwitchToDraftButton: true,
56
56
  PostSyncStatus: true,
57
+ PostSyncStatusModal: true,
57
58
  PostTaxonomies: true,
58
59
  PostTaxonomiesFlatTermSelector: true,
59
60
  PostTaxonomiesHierarchicalTermSelector: true,
@@ -355,6 +356,12 @@ Object.defineProperty(exports, "PostSyncStatus", {
355
356
  return _postSyncStatus.default;
356
357
  }
357
358
  });
359
+ Object.defineProperty(exports, "PostSyncStatusModal", {
360
+ enumerable: true,
361
+ get: function () {
362
+ return _postSyncStatus.PostSyncStatusModal;
363
+ }
364
+ });
358
365
  Object.defineProperty(exports, "PostTaxonomies", {
359
366
  enumerable: true,
360
367
  get: function () {
@@ -618,7 +625,7 @@ var _check11 = _interopRequireDefault(require("./post-sticky/check"));
618
625
 
619
626
  var _postSwitchToDraftButton = _interopRequireDefault(require("./post-switch-to-draft-button"));
620
627
 
621
- var _postSyncStatus = _interopRequireDefault(require("./post-sync-status"));
628
+ var _postSyncStatus = _interopRequireWildcard(require("./post-sync-status"));
622
629
 
623
630
  var _postTaxonomies = _interopRequireDefault(require("./post-taxonomies"));
624
631
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AAEA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["// Block Creation Components.\nexport * from './autocompleters';\n\n// Post Related Components.\nexport { default as AutosaveMonitor } from './autosave-monitor';\nexport { default as DocumentOutline } from './document-outline';\nexport { default as DocumentOutlineCheck } from './document-outline/check';\nexport { default as VisualEditorGlobalKeyboardShortcuts } from './global-keyboard-shortcuts/visual-editor-shortcuts';\nexport { default as TextEditorGlobalKeyboardShortcuts } from './global-keyboard-shortcuts/text-editor-shortcuts';\nexport { default as EditorKeyboardShortcutsRegister } from './global-keyboard-shortcuts/register-shortcuts';\nexport { default as EditorHistoryRedo } from './editor-history/redo';\nexport { default as EditorHistoryUndo } from './editor-history/undo';\nexport { default as EditorNotices } from './editor-notices';\nexport { default as EditorSnackbars } from './editor-snackbars';\nexport { default as EntitiesSavedStates } from './entities-saved-states';\nexport { useIsDirty as useEntitiesSavedStatesIsDirty } from './entities-saved-states/hooks/use-is-dirty';\nexport { default as ErrorBoundary } from './error-boundary';\nexport { default as LocalAutosaveMonitor } from './local-autosave-monitor';\nexport { default as PageAttributesCheck } from './page-attributes/check';\nexport { default as PageAttributesOrder } from './page-attributes/order';\nexport { default as PageAttributesParent } from './page-attributes/parent';\nexport { default as PageTemplate } from './post-template';\nexport { default as PostAuthor } from './post-author';\nexport { default as PostAuthorCheck } from './post-author/check';\nexport { default as PostComments } from './post-comments';\nexport { default as PostExcerpt } from './post-excerpt';\nexport { default as PostExcerptCheck } from './post-excerpt/check';\nexport { default as PostFeaturedImage } from './post-featured-image';\nexport { default as PostFeaturedImageCheck } from './post-featured-image/check';\nexport { default as PostFormat } from './post-format';\nexport { default as PostFormatCheck } from './post-format/check';\nexport { default as PostLastRevision } from './post-last-revision';\nexport { default as PostLastRevisionCheck } from './post-last-revision/check';\nexport { default as PostLockedModal } from './post-locked-modal';\nexport { default as PostPendingStatus } from './post-pending-status';\nexport { default as PostPendingStatusCheck } from './post-pending-status/check';\nexport { default as PostPingbacks } from './post-pingbacks';\nexport { default as PostPreviewButton } from './post-preview-button';\nexport { default as PostPublishButton } from './post-publish-button';\nexport { default as PostPublishButtonLabel } from './post-publish-button/label';\nexport { default as PostPublishPanel } from './post-publish-panel';\nexport { default as PostSavedState } from './post-saved-state';\nexport { default as PostSchedule } from './post-schedule';\nexport { default as PostScheduleCheck } from './post-schedule/check';\nexport {\n\tdefault as PostScheduleLabel,\n\tusePostScheduleLabel,\n} from './post-schedule/label';\nexport { default as PostSlug } from './post-slug';\nexport { default as PostSlugCheck } from './post-slug/check';\nexport { default as PostSticky } from './post-sticky';\nexport { default as PostStickyCheck } from './post-sticky/check';\nexport { default as PostSwitchToDraftButton } from './post-switch-to-draft-button';\nexport { default as PostSyncStatus } from './post-sync-status';\nexport { default as PostTaxonomies } from './post-taxonomies';\nexport { FlatTermSelector as PostTaxonomiesFlatTermSelector } from './post-taxonomies/flat-term-selector';\nexport { HierarchicalTermSelector as PostTaxonomiesHierarchicalTermSelector } from './post-taxonomies/hierarchical-term-selector';\nexport { default as PostTaxonomiesCheck } from './post-taxonomies/check';\nexport { default as PostTextEditor } from './post-text-editor';\nexport { default as PostTitle } from './post-title';\nexport { default as PostTrash } from './post-trash';\nexport { default as PostTrashCheck } from './post-trash/check';\nexport { default as PostTypeSupportCheck } from './post-type-support-check';\nexport { default as PostURL } from './post-url';\nexport { default as PostURLCheck } from './post-url/check';\nexport { default as PostURLLabel, usePostURLLabel } from './post-url/label';\nexport { default as PostVisibility } from './post-visibility';\nexport {\n\tdefault as PostVisibilityLabel,\n\tusePostVisibilityLabel,\n} from './post-visibility/label';\nexport { default as PostVisibilityCheck } from './post-visibility/check';\nexport { default as TableOfContents } from './table-of-contents';\nexport { default as ThemeSupportCheck } from './theme-support-check';\nexport { default as UnsavedChangesWarning } from './unsaved-changes-warning';\nexport { default as WordCount } from './word-count';\nexport { default as TimeToRead } from './time-to-read';\nexport { default as CharacterCount } from './character-count';\n\n// State Related Components.\nexport { default as EditorProvider } from './provider';\n\nexport * from './deprecated';\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AAEA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["// Block Creation Components.\nexport * from './autocompleters';\n\n// Post Related Components.\nexport { default as AutosaveMonitor } from './autosave-monitor';\nexport { default as DocumentOutline } from './document-outline';\nexport { default as DocumentOutlineCheck } from './document-outline/check';\nexport { default as VisualEditorGlobalKeyboardShortcuts } from './global-keyboard-shortcuts/visual-editor-shortcuts';\nexport { default as TextEditorGlobalKeyboardShortcuts } from './global-keyboard-shortcuts/text-editor-shortcuts';\nexport { default as EditorKeyboardShortcutsRegister } from './global-keyboard-shortcuts/register-shortcuts';\nexport { default as EditorHistoryRedo } from './editor-history/redo';\nexport { default as EditorHistoryUndo } from './editor-history/undo';\nexport { default as EditorNotices } from './editor-notices';\nexport { default as EditorSnackbars } from './editor-snackbars';\nexport { default as EntitiesSavedStates } from './entities-saved-states';\nexport { useIsDirty as useEntitiesSavedStatesIsDirty } from './entities-saved-states/hooks/use-is-dirty';\nexport { default as ErrorBoundary } from './error-boundary';\nexport { default as LocalAutosaveMonitor } from './local-autosave-monitor';\nexport { default as PageAttributesCheck } from './page-attributes/check';\nexport { default as PageAttributesOrder } from './page-attributes/order';\nexport { default as PageAttributesParent } from './page-attributes/parent';\nexport { default as PageTemplate } from './post-template';\nexport { default as PostAuthor } from './post-author';\nexport { default as PostAuthorCheck } from './post-author/check';\nexport { default as PostComments } from './post-comments';\nexport { default as PostExcerpt } from './post-excerpt';\nexport { default as PostExcerptCheck } from './post-excerpt/check';\nexport { default as PostFeaturedImage } from './post-featured-image';\nexport { default as PostFeaturedImageCheck } from './post-featured-image/check';\nexport { default as PostFormat } from './post-format';\nexport { default as PostFormatCheck } from './post-format/check';\nexport { default as PostLastRevision } from './post-last-revision';\nexport { default as PostLastRevisionCheck } from './post-last-revision/check';\nexport { default as PostLockedModal } from './post-locked-modal';\nexport { default as PostPendingStatus } from './post-pending-status';\nexport { default as PostPendingStatusCheck } from './post-pending-status/check';\nexport { default as PostPingbacks } from './post-pingbacks';\nexport { default as PostPreviewButton } from './post-preview-button';\nexport { default as PostPublishButton } from './post-publish-button';\nexport { default as PostPublishButtonLabel } from './post-publish-button/label';\nexport { default as PostPublishPanel } from './post-publish-panel';\nexport { default as PostSavedState } from './post-saved-state';\nexport { default as PostSchedule } from './post-schedule';\nexport { default as PostScheduleCheck } from './post-schedule/check';\nexport {\n\tdefault as PostScheduleLabel,\n\tusePostScheduleLabel,\n} from './post-schedule/label';\nexport { default as PostSlug } from './post-slug';\nexport { default as PostSlugCheck } from './post-slug/check';\nexport { default as PostSticky } from './post-sticky';\nexport { default as PostStickyCheck } from './post-sticky/check';\nexport { default as PostSwitchToDraftButton } from './post-switch-to-draft-button';\nexport {\n\tdefault as PostSyncStatus,\n\tPostSyncStatusModal,\n} from './post-sync-status';\nexport { default as PostTaxonomies } from './post-taxonomies';\nexport { FlatTermSelector as PostTaxonomiesFlatTermSelector } from './post-taxonomies/flat-term-selector';\nexport { HierarchicalTermSelector as PostTaxonomiesHierarchicalTermSelector } from './post-taxonomies/hierarchical-term-selector';\nexport { default as PostTaxonomiesCheck } from './post-taxonomies/check';\nexport { default as PostTextEditor } from './post-text-editor';\nexport { default as PostTitle } from './post-title';\nexport { default as PostTrash } from './post-trash';\nexport { default as PostTrashCheck } from './post-trash/check';\nexport { default as PostTypeSupportCheck } from './post-type-support-check';\nexport { default as PostURL } from './post-url';\nexport { default as PostURLCheck } from './post-url/check';\nexport { default as PostURLLabel, usePostURLLabel } from './post-url/label';\nexport { default as PostVisibility } from './post-visibility';\nexport {\n\tdefault as PostVisibilityLabel,\n\tusePostVisibilityLabel,\n} from './post-visibility/label';\nexport { default as PostVisibilityCheck } from './post-visibility/check';\nexport { default as TableOfContents } from './table-of-contents';\nexport { default as ThemeSupportCheck } from './theme-support-check';\nexport { default as UnsavedChangesWarning } from './unsaved-changes-warning';\nexport { default as WordCount } from './word-count';\nexport { default as TimeToRead } from './time-to-read';\nexport { default as CharacterCount } from './character-count';\n\n// State Related Components.\nexport { default as EditorProvider } from './provider';\n\nexport * from './deprecated';\n"]}
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.PostSyncStatusModal = PostSyncStatusModal;
6
7
  exports.default = PostSyncStatus;
7
8
 
8
9
  var _element = require("@wordpress/element");
@@ -13,8 +14,12 @@ var _i18n = require("@wordpress/i18n");
13
14
 
14
15
  var _components = require("@wordpress/components");
15
16
 
17
+ var _blockEditor = require("@wordpress/block-editor");
18
+
16
19
  var _store = require("../../store");
17
20
 
21
+ var _lockUnlock = require("../../lock-unlock");
22
+
18
23
  /**
19
24
  * WordPress dependencies
20
25
  */
@@ -25,24 +30,98 @@ var _store = require("../../store");
25
30
  function PostSyncStatus() {
26
31
  const {
27
32
  syncStatus,
28
- postType
33
+ postType,
34
+ meta
29
35
  } = (0, _data.useSelect)(select => {
30
36
  const {
31
37
  getEditedPostAttribute
32
38
  } = select(_store.store);
33
39
  return {
34
40
  syncStatus: getEditedPostAttribute('wp_pattern_sync_status'),
41
+ meta: getEditedPostAttribute('meta'),
35
42
  postType: getEditedPostAttribute('type')
36
43
  };
37
- }, []);
44
+ });
38
45
 
39
46
  if (postType !== 'wp_block') {
40
47
  return null;
41
- }
48
+ } // When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.
49
+
42
50
 
43
- const isFullySynced = !syncStatus;
51
+ const currentSyncStatus = meta?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : syncStatus;
44
52
  return (0, _element.createElement)(_components.PanelRow, {
45
53
  className: "edit-post-sync-status"
46
- }, (0, _element.createElement)("span", null, (0, _i18n.__)('Sync status')), (0, _element.createElement)("div", null, isFullySynced ? (0, _i18n.__)('Fully synced') : (0, _i18n.__)('Not synced')));
54
+ }, (0, _element.createElement)("span", null, (0, _i18n.__)('Sync status')), (0, _element.createElement)("div", null, currentSyncStatus === 'unsynced' ? (0, _i18n.__)('Not synced') : (0, _i18n.__)('Fully synced')));
55
+ }
56
+
57
+ function PostSyncStatusModal() {
58
+ const {
59
+ editPost
60
+ } = (0, _data.useDispatch)(_store.store);
61
+ const [isModalOpen, setIsModalOpen] = (0, _element.useState)(false);
62
+ const [syncType, setSyncType] = (0, _element.useState)(undefined);
63
+ const {
64
+ postType,
65
+ isNewPost
66
+ } = (0, _data.useSelect)(select => {
67
+ const {
68
+ getEditedPostAttribute,
69
+ isCleanNewPost
70
+ } = select(_store.store);
71
+ return {
72
+ postType: getEditedPostAttribute('type'),
73
+ isNewPost: isCleanNewPost()
74
+ };
75
+ }, []);
76
+ (0, _element.useEffect)(() => {
77
+ if (isNewPost && postType === 'wp_block') {
78
+ setIsModalOpen(true);
79
+ } // We only want the modal to open when the page is first loaded.
80
+ // eslint-disable-next-line react-hooks/exhaustive-deps
81
+
82
+ }, []);
83
+
84
+ const setSyncStatus = () => {
85
+ editPost({
86
+ meta: {
87
+ wp_pattern_sync_status: syncType
88
+ }
89
+ });
90
+ };
91
+
92
+ if (postType !== 'wp_block' || !isNewPost) {
93
+ return null;
94
+ }
95
+
96
+ const {
97
+ ReusableBlocksRenameHint
98
+ } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
99
+ return (0, _element.createElement)(_element.Fragment, null, isModalOpen && (0, _element.createElement)(_components.Modal, {
100
+ title: (0, _i18n.__)('Set pattern sync status'),
101
+ onRequestClose: () => {
102
+ setIsModalOpen(false);
103
+ },
104
+ overlayClassName: "reusable-blocks-menu-items__convert-modal"
105
+ }, (0, _element.createElement)("form", {
106
+ onSubmit: event => {
107
+ event.preventDefault();
108
+ setIsModalOpen(false);
109
+ setSyncStatus();
110
+ }
111
+ }, (0, _element.createElement)(_components.__experimentalVStack, {
112
+ spacing: "5"
113
+ }, (0, _element.createElement)(ReusableBlocksRenameHint, null), (0, _element.createElement)(_components.ToggleControl, {
114
+ label: (0, _i18n.__)('Synced'),
115
+ help: (0, _i18n.__)('Editing the pattern will update it anywhere it is used.'),
116
+ checked: !syncType,
117
+ onChange: () => {
118
+ setSyncType(!syncType ? 'unsynced' : undefined);
119
+ }
120
+ }), (0, _element.createElement)(_components.__experimentalHStack, {
121
+ justify: "right"
122
+ }, (0, _element.createElement)(_components.Button, {
123
+ variant: "primary",
124
+ type: "submit"
125
+ }, (0, _i18n.__)('Create')))))));
47
126
  }
48
127
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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
+ {"version":3,"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"names":["PostSyncStatus","syncStatus","postType","meta","select","getEditedPostAttribute","editorStore","currentSyncStatus","wp_pattern_sync_status","PostSyncStatusModal","editPost","isModalOpen","setIsModalOpen","syncType","setSyncType","undefined","isNewPost","isCleanNewPost","setSyncStatus","ReusableBlocksRenameHint","blockEditorPrivateApis","event","preventDefault"],"mappings":";;;;;;;;AAaA;;AAVA;;AACA;;AACA;;AASA;;AAKA;;AACA;;AApBA;AACA;AACA;;AAcA;AACA;AACA;AAIe,SAASA,cAAT,GAA0B;AACxC,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,QAAd;AAAwBC,IAAAA;AAAxB,MAAiC,qBAAaC,MAAF,IAAc;AAC/D,UAAM;AAAEC,MAAAA;AAAF,QAA6BD,MAAM,CAAEE,YAAF,CAAzC;AACA,WAAO;AACNL,MAAAA,UAAU,EAAEI,sBAAsB,CAAE,wBAAF,CAD5B;AAENF,MAAAA,IAAI,EAAEE,sBAAsB,CAAE,MAAF,CAFtB;AAGNH,MAAAA,QAAQ,EAAEG,sBAAsB,CAAE,MAAF;AAH1B,KAAP;AAKA,GAPsC,CAAvC;;AASA,MAAKH,QAAQ,KAAK,UAAlB,EAA+B;AAC9B,WAAO,IAAP;AACA,GAZuC,CAaxC;;;AACA,QAAMK,iBAAiB,GACtBJ,IAAI,EAAEK,sBAAN,KAAiC,UAAjC,GAA8C,UAA9C,GAA2DP,UAD5D;AAGA,SACC,4BAAC,oBAAD;AAAU,IAAA,SAAS,EAAC;AAApB,KACC,0CAAQ,cAAI,aAAJ,CAAR,CADD,EAEC,yCACGM,iBAAiB,KAAK,UAAtB,GACC,cAAI,YAAJ,CADD,GAEC,cAAI,cAAJ,CAHJ,CAFD,CADD;AAUA;;AAEM,SAASE,mBAAT,GAA+B;AACrC,QAAM;AAAEC,IAAAA;AAAF,MAAe,uBAAaJ,YAAb,CAArB;AACA,QAAM,CAAEK,WAAF,EAAeC,cAAf,IAAkC,uBAAU,KAAV,C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AhB,KACC,4BAAC,wBAAD,OADD,EAEC,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAG,cAAI,QAAJ,CADT;AAEC,IAAA,IAAI,EAAG,cACN,yDADM,CAFR;AAKC,IAAA,OAAO,EAAG,CAAEL,QALb;AAMC,IAAA,QAAQ,EAAG,MAAM;AAChBC,MAAAA,WAAW,CACV,CAAED,QAAF,GAAa,UAAb,GAA0BE,SADhB,CAAX;AAGA;AAVF,IAFD,EAcC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,4BAAC,kBAAD;AAAQ,IAAA,OAAO,EAAC,SAAhB;AAA0B,IAAA,IAAI,EAAC;AAA/B,KACG,cAAI,QAAJ,CADH,CADD,CAdD,CAPD,CAPD,CAFF,CADD;AA0CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tPanelRow,\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n} from '@wordpress/components';\nimport { useEffect, useState } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PostSyncStatus() {\n\tconst { syncStatus, postType, meta } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\treturn {\n\t\t\tsyncStatus: getEditedPostAttribute( 'wp_pattern_sync_status' ),\n\t\t\tmeta: getEditedPostAttribute( 'meta' ),\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t};\n\t} );\n\n\tif ( postType !== 'wp_block' ) {\n\t\treturn null;\n\t}\n\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\tconst currentSyncStatus =\n\t\tmeta?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : 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{ currentSyncStatus === 'unsynced'\n\t\t\t\t\t? __( 'Not synced' )\n\t\t\t\t\t: __( 'Fully synced' ) }\n\t\t\t</div>\n\t\t</PanelRow>\n\t);\n}\n\nexport function PostSyncStatusModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\n\tconst { postType, isNewPost } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, isCleanNewPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisNewPost: isCleanNewPost(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( isNewPost && postType === 'wp_block' ) {\n\t\t\tsetIsModalOpen( true );\n\t\t}\n\t\t// We only want the modal to open when the page is first loaded.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst setSyncStatus = () => {\n\t\teditPost( {\n\t\t\tmeta: {\n\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t},\n\t\t} );\n\t};\n\n\tif ( postType !== 'wp_block' || ! isNewPost ) {\n\t\treturn null;\n\t}\n\tconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\treturn (\n\t\t<>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Set pattern sync status' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tsetSyncStatus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<ReusableBlocksRenameHint />\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Synced' ) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Editing the pattern will update it anywhere it is used.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\t\t\t! syncType ? 'unsynced' : undefined\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t\t\t<Button variant=\"primary\" type=\"submit\">\n\t\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
@@ -47,7 +47,7 @@ export { default as PostSlugCheck } from './post-slug/check';
47
47
  export { default as PostSticky } from './post-sticky';
48
48
  export { default as PostStickyCheck } from './post-sticky/check';
49
49
  export { default as PostSwitchToDraftButton } from './post-switch-to-draft-button';
50
- export { default as PostSyncStatus } from './post-sync-status';
50
+ export { default as PostSyncStatus, PostSyncStatusModal } from './post-sync-status';
51
51
  export { default as PostTaxonomies } from './post-taxonomies';
52
52
  export { FlatTermSelector as PostTaxonomiesFlatTermSelector } from './post-taxonomies/flat-term-selector';
53
53
  export { HierarchicalTermSelector as PostTaxonomiesHierarchicalTermSelector } from './post-taxonomies/hierarchical-term-selector';
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/index.js"],"names":["default","AutosaveMonitor","DocumentOutline","DocumentOutlineCheck","VisualEditorGlobalKeyboardShortcuts","TextEditorGlobalKeyboardShortcuts","EditorKeyboardShortcutsRegister","EditorHistoryRedo","EditorHistoryUndo","EditorNotices","EditorSnackbars","EntitiesSavedStates","useIsDirty","useEntitiesSavedStatesIsDirty","ErrorBoundary","LocalAutosaveMonitor","PageAttributesCheck","PageAttributesOrder","PageAttributesParent","PageTemplate","PostAuthor","PostAuthorCheck","PostComments","PostExcerpt","PostExcerptCheck","PostFeaturedImage","PostFeaturedImageCheck","PostFormat","PostFormatCheck","PostLastRevision","PostLastRevisionCheck","PostLockedModal","PostPendingStatus","PostPendingStatusCheck","PostPingbacks","PostPreviewButton","PostPublishButton","PostPublishButtonLabel","PostPublishPanel","PostSavedState","PostSchedule","PostScheduleCheck","PostScheduleLabel","usePostScheduleLabel","PostSlug","PostSlugCheck","PostSticky","PostStickyCheck","PostSwitchToDraftButton","PostSyncStatus","PostTaxonomies","FlatTermSelector","PostTaxonomiesFlatTermSelector","HierarchicalTermSelector","PostTaxonomiesHierarchicalTermSelector","PostTaxonomiesCheck","PostTextEditor","PostTitle","PostTrash","PostTrashCheck","PostTypeSupportCheck","PostURL","PostURLCheck","PostURLLabel","usePostURLLabel","PostVisibility","PostVisibilityLabel","usePostVisibilityLabel","PostVisibilityCheck","TableOfContents","ThemeSupportCheck","UnsavedChangesWarning","WordCount","TimeToRead","CharacterCount","EditorProvider"],"mappings":"AAAA;AACA,cAAc,kBAAd,C,CAEA;;AACA,SAASA,OAAO,IAAIC,eAApB,QAA2C,oBAA3C;AACA,SAASD,OAAO,IAAIE,eAApB,QAA2C,oBAA3C;AACA,SAASF,OAAO,IAAIG,oBAApB,QAAgD,0BAAhD;AACA,SAASH,OAAO,IAAII,mCAApB,QAA+D,qDAA/D;AACA,SAASJ,OAAO,IAAIK,iCAApB,QAA6D,mDAA7D;AACA,SAASL,OAAO,IAAIM,+BAApB,QAA2D,gDAA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D,OAApB,QAAmC,YAAnC;AACA,SAAS7D,OAAO,IAAI8D,YAApB,QAAwC,kBAAxC;AACA,SAAS9D,OAAO,IAAI+D,YAApB,EAAkCC,eAAlC,QAAyD,kBAAzD;AACA,SAAShE,OAAO,IAAIiE,cAApB,QAA0C,mBAA1C;AACA,SACCjE,OAAO,IAAIkE,mBADZ,EAECC,sBAFD,QAGO,yBAHP;AAIA,SAASnE,OAAO,IAAIoE,mBAApB,QAA+C,yBAA/C;AACA,SAASpE,OAAO,IAAIqE,eAApB,QAA2C,qBAA3C;AACA,SAASrE,OAAO,IAAIsE,iBAApB,QAA6C,uBAA7C;AACA,SAAStE,OAAO,IAAIuE,qBAApB,QAAiD,2BAAjD;AACA,SAASvE,OAAO,IAAIwE,SAApB,QAAqC,cAArC;AACA,SAASxE,OAAO,IAAIyE,UAApB,QAAsC,gBAAtC;AACA,SAASzE,OAAO,IAAI0E,cAApB,QAA0C,mBAA1C,C,CAEA;;AACA,SAAS1E,OAAO,IAAI2E,cAApB,QAA0C,YAA1C;AAEA,cAAc,cAAd","sourcesContent":["// Block Creation Components.\nexport * from './autocompleters';\n\n// Post Related Components.\nexport { default as AutosaveMonitor } from './autosave-monitor';\nexport { default as DocumentOutline } from './document-outline';\nexport { default as DocumentOutlineCheck } from './document-outline/check';\nexport { default as VisualEditorGlobalKeyboardShortcuts } from './global-keyboard-shortcuts/visual-editor-shortcuts';\nexport { default as TextEditorGlobalKeyboardShortcuts } from './global-keyboard-shortcuts/text-editor-shortcuts';\nexport { default as EditorKeyboardShortcutsRegister } from './global-keyboard-shortcuts/register-shortcuts';\nexport { default as EditorHistoryRedo } from './editor-history/redo';\nexport { default as EditorHistoryUndo } from './editor-history/undo';\nexport { default as EditorNotices } from './editor-notices';\nexport { default as EditorSnackbars } from './editor-snackbars';\nexport { default as EntitiesSavedStates } from './entities-saved-states';\nexport { useIsDirty as useEntitiesSavedStatesIsDirty } from './entities-saved-states/hooks/use-is-dirty';\nexport { default as ErrorBoundary } from './error-boundary';\nexport { default as LocalAutosaveMonitor } from './local-autosave-monitor';\nexport { default as PageAttributesCheck } from './page-attributes/check';\nexport { default as PageAttributesOrder } from './page-attributes/order';\nexport { default as PageAttributesParent } from './page-attributes/parent';\nexport { default as PageTemplate } from './post-template';\nexport { default as PostAuthor } from './post-author';\nexport { default as PostAuthorCheck } from './post-author/check';\nexport { default as PostComments } from './post-comments';\nexport { default as PostExcerpt } from './post-excerpt';\nexport { default as PostExcerptCheck } from './post-excerpt/check';\nexport { default as PostFeaturedImage } from './post-featured-image';\nexport { default as PostFeaturedImageCheck } from './post-featured-image/check';\nexport { default as PostFormat } from './post-format';\nexport { default as PostFormatCheck } from './post-format/check';\nexport { default as PostLastRevision } from './post-last-revision';\nexport { default as PostLastRevisionCheck } from './post-last-revision/check';\nexport { default as PostLockedModal } from './post-locked-modal';\nexport { default as PostPendingStatus } from './post-pending-status';\nexport { default as PostPendingStatusCheck } from './post-pending-status/check';\nexport { default as PostPingbacks } from './post-pingbacks';\nexport { default as PostPreviewButton } from './post-preview-button';\nexport { default as PostPublishButton } from './post-publish-button';\nexport { default as PostPublishButtonLabel } from './post-publish-button/label';\nexport { default as PostPublishPanel } from './post-publish-panel';\nexport { default as PostSavedState } from './post-saved-state';\nexport { default as PostSchedule } from './post-schedule';\nexport { default as PostScheduleCheck } from './post-schedule/check';\nexport {\n\tdefault as PostScheduleLabel,\n\tusePostScheduleLabel,\n} from './post-schedule/label';\nexport { default as PostSlug } from './post-slug';\nexport { default as PostSlugCheck } from './post-slug/check';\nexport { default as PostSticky } from './post-sticky';\nexport { default as PostStickyCheck } from './post-sticky/check';\nexport { default as PostSwitchToDraftButton } from './post-switch-to-draft-button';\nexport { default as PostSyncStatus } from './post-sync-status';\nexport { default as PostTaxonomies } from './post-taxonomies';\nexport { FlatTermSelector as PostTaxonomiesFlatTermSelector } from './post-taxonomies/flat-term-selector';\nexport { HierarchicalTermSelector as PostTaxonomiesHierarchicalTermSelector } from './post-taxonomies/hierarchical-term-selector';\nexport { default as PostTaxonomiesCheck } from './post-taxonomies/check';\nexport { default as PostTextEditor } from './post-text-editor';\nexport { default as PostTitle } from './post-title';\nexport { default as PostTrash } from './post-trash';\nexport { default as PostTrashCheck } from './post-trash/check';\nexport { default as PostTypeSupportCheck } from './post-type-support-check';\nexport { default as PostURL } from './post-url';\nexport { default as PostURLCheck } from './post-url/check';\nexport { default as PostURLLabel, usePostURLLabel } from './post-url/label';\nexport { default as PostVisibility } from './post-visibility';\nexport {\n\tdefault as PostVisibilityLabel,\n\tusePostVisibilityLabel,\n} from './post-visibility/label';\nexport { default as PostVisibilityCheck } from './post-visibility/check';\nexport { default as TableOfContents } from './table-of-contents';\nexport { default as ThemeSupportCheck } from './theme-support-check';\nexport { default as UnsavedChangesWarning } from './unsaved-changes-warning';\nexport { default as WordCount } from './word-count';\nexport { default as TimeToRead } from './time-to-read';\nexport { default as CharacterCount } from './character-count';\n\n// State Related Components.\nexport { default as EditorProvider } from './provider';\n\nexport * from './deprecated';\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/index.js"],"names":["default","AutosaveMonitor","DocumentOutline","DocumentOutlineCheck","VisualEditorGlobalKeyboardShortcuts","TextEditorGlobalKeyboardShortcuts","EditorKeyboardShortcutsRegister","EditorHistoryRedo","EditorHistoryUndo","EditorNotices","EditorSnackbars","EntitiesSavedStates","useIsDirty","useEntitiesSavedStatesIsDirty","ErrorBoundary","LocalAutosaveMonitor","PageAttributesCheck","PageAttributesOrder","PageAttributesParent","PageTemplate","PostAuthor","PostAuthorCheck","PostComments","PostExcerpt","PostExcerptCheck","PostFeaturedImage","PostFeaturedImageCheck","PostFormat","PostFormatCheck","PostLastRevision","PostLastRevisionCheck","PostLockedModal","PostPendingStatus","PostPendingStatusCheck","PostPingbacks","PostPreviewButton","PostPublishButton","PostPublishButtonLabel","PostPublishPanel","PostSavedState","PostSchedule","PostScheduleCheck","PostScheduleLabel","usePostScheduleLabel","PostSlug","PostSlugCheck","PostSticky","PostStickyCheck","PostSwitchToDraftButton","PostSyncStatus","PostSyncStatusModal","PostTaxonomies","FlatTermSelector","PostTaxonomiesFlatTermSelector","HierarchicalTermSelector","PostTaxonomiesHierarchicalTermSelector","PostTaxonomiesCheck","PostTextEditor","PostTitle","PostTrash","PostTrashCheck","PostTypeSupportCheck","PostURL","PostURLCheck","PostURLLabel","usePostURLLabel","PostVisibility","PostVisibilityLabel","usePostVisibilityLabel","PostVisibilityCheck","TableOfContents","ThemeSupportCheck","UnsavedChangesWarning","WordCount","TimeToRead","CharacterCount","EditorProvider"],"mappings":"AAAA;AACA,cAAc,kBAAd,C,CAEA;;AACA,SAASA,OAAO,IAAIC,eAApB,QAA2C,oBAA3C;AACA,SAASD,OAAO,IAAIE,eAApB,QAA2C,oBAA3C;AACA,SAASF,OAAO,IAAIG,oBAApB,QAAgD,0BAAhD;AACA,SAASH,OAAO,IAAII,mCAApB,QAA+D,qDAA/D;AACA,SAASJ,OAAO,IAAIK,iCAApB,QAA6D,mDAA7D;AACA,SAASL,OAAO,IAAIM,+BAApB,QAA2D,gDAA3D;AACA,SAASN,OAAO,IAAIO,iBAApB,QAA6C,uBAA7C;AACA,SAASP,OAAO,IAAIQ,iBAApB,QAA6C,uBAA7C;AACA,SAASR,OAAO,IAAIS,aAApB,QAAyC,kBAAzC;AACA,SAAST,OAAO,IAAIU,eAApB,QAA2C,oBAA3C;AACA,SAASV,OAAO,IAAIW,mBAApB,QAA+C,yBAA/C;AACA,SAASC,UAAU,IAAIC,6BAAvB,QAA4D,4CAA5D;AACA,SAASb,OAAO,IAAIc,aAApB,QAAyC,kBAAzC;AACA,SAASd,OAAO,IAAIe,oBAApB,QAAgD,0BAAhD;AACA,SAASf,OAAO,IAAIgB,mBAApB,QAA+C,yBAA/C;AACA,SAAShB,OAAO,IAAIiB,mBAApB,QAA+C,yBAA/C;AACA,SAASjB,OAAO,IAAIkB,oBAApB,QAAgD,0BAAhD;AACA,SAASlB,OAAO,IAAImB,YAApB,QAAwC,iBAA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I2E,cAApB,QAA0C,mBAA1C,C,CAEA;;AACA,SAAS3E,OAAO,IAAI4E,cAApB,QAA0C,YAA1C;AAEA,cAAc,cAAd","sourcesContent":["// Block Creation Components.\nexport * from './autocompleters';\n\n// Post Related Components.\nexport { default as AutosaveMonitor } from './autosave-monitor';\nexport { default as DocumentOutline } from './document-outline';\nexport { default as DocumentOutlineCheck } from './document-outline/check';\nexport { default as VisualEditorGlobalKeyboardShortcuts } from './global-keyboard-shortcuts/visual-editor-shortcuts';\nexport { default as TextEditorGlobalKeyboardShortcuts } from './global-keyboard-shortcuts/text-editor-shortcuts';\nexport { default as EditorKeyboardShortcutsRegister } from './global-keyboard-shortcuts/register-shortcuts';\nexport { default as EditorHistoryRedo } from './editor-history/redo';\nexport { default as EditorHistoryUndo } from './editor-history/undo';\nexport { default as EditorNotices } from './editor-notices';\nexport { default as EditorSnackbars } from './editor-snackbars';\nexport { default as EntitiesSavedStates } from './entities-saved-states';\nexport { useIsDirty as useEntitiesSavedStatesIsDirty } from './entities-saved-states/hooks/use-is-dirty';\nexport { default as ErrorBoundary } from './error-boundary';\nexport { default as LocalAutosaveMonitor } from './local-autosave-monitor';\nexport { default as PageAttributesCheck } from './page-attributes/check';\nexport { default as PageAttributesOrder } from './page-attributes/order';\nexport { default as PageAttributesParent } from './page-attributes/parent';\nexport { default as PageTemplate } from './post-template';\nexport { default as PostAuthor } from './post-author';\nexport { default as PostAuthorCheck } from './post-author/check';\nexport { default as PostComments } from './post-comments';\nexport { default as PostExcerpt } from './post-excerpt';\nexport { default as PostExcerptCheck } from './post-excerpt/check';\nexport { default as PostFeaturedImage } from './post-featured-image';\nexport { default as PostFeaturedImageCheck } from './post-featured-image/check';\nexport { default as PostFormat } from './post-format';\nexport { default as PostFormatCheck } from './post-format/check';\nexport { default as PostLastRevision } from './post-last-revision';\nexport { default as PostLastRevisionCheck } from './post-last-revision/check';\nexport { default as PostLockedModal } from './post-locked-modal';\nexport { default as PostPendingStatus } from './post-pending-status';\nexport { default as PostPendingStatusCheck } from './post-pending-status/check';\nexport { default as PostPingbacks } from './post-pingbacks';\nexport { default as PostPreviewButton } from './post-preview-button';\nexport { default as PostPublishButton } from './post-publish-button';\nexport { default as PostPublishButtonLabel } from './post-publish-button/label';\nexport { default as PostPublishPanel } from './post-publish-panel';\nexport { default as PostSavedState } from './post-saved-state';\nexport { default as PostSchedule } from './post-schedule';\nexport { default as PostScheduleCheck } from './post-schedule/check';\nexport {\n\tdefault as PostScheduleLabel,\n\tusePostScheduleLabel,\n} from './post-schedule/label';\nexport { default as PostSlug } from './post-slug';\nexport { default as PostSlugCheck } from './post-slug/check';\nexport { default as PostSticky } from './post-sticky';\nexport { default as PostStickyCheck } from './post-sticky/check';\nexport { default as PostSwitchToDraftButton } from './post-switch-to-draft-button';\nexport {\n\tdefault as PostSyncStatus,\n\tPostSyncStatusModal,\n} from './post-sync-status';\nexport { default as PostTaxonomies } from './post-taxonomies';\nexport { FlatTermSelector as PostTaxonomiesFlatTermSelector } from './post-taxonomies/flat-term-selector';\nexport { HierarchicalTermSelector as PostTaxonomiesHierarchicalTermSelector } from './post-taxonomies/hierarchical-term-selector';\nexport { default as PostTaxonomiesCheck } from './post-taxonomies/check';\nexport { default as PostTextEditor } from './post-text-editor';\nexport { default as PostTitle } from './post-title';\nexport { default as PostTrash } from './post-trash';\nexport { default as PostTrashCheck } from './post-trash/check';\nexport { default as PostTypeSupportCheck } from './post-type-support-check';\nexport { default as PostURL } from './post-url';\nexport { default as PostURLCheck } from './post-url/check';\nexport { default as PostURLLabel, usePostURLLabel } from './post-url/label';\nexport { default as PostVisibility } from './post-visibility';\nexport {\n\tdefault as PostVisibilityLabel,\n\tusePostVisibilityLabel,\n} from './post-visibility/label';\nexport { default as PostVisibilityCheck } from './post-visibility/check';\nexport { default as TableOfContents } from './table-of-contents';\nexport { default as ThemeSupportCheck } from './theme-support-check';\nexport { default as UnsavedChangesWarning } from './unsaved-changes-warning';\nexport { default as WordCount } from './word-count';\nexport { default as TimeToRead } from './time-to-read';\nexport { default as CharacterCount } from './character-count';\n\n// State Related Components.\nexport { default as EditorProvider } from './provider';\n\nexport * from './deprecated';\n"]}
@@ -1,37 +1,113 @@
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 { useSelect } from '@wordpress/data';
6
+ import { useSelect, useDispatch } from '@wordpress/data';
7
7
  import { __ } from '@wordpress/i18n';
8
- import { PanelRow } from '@wordpress/components';
8
+ import { PanelRow, Modal, Button, __experimentalHStack as HStack, __experimentalVStack as VStack, ToggleControl } from '@wordpress/components';
9
+ import { useEffect, useState } from '@wordpress/element';
10
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
9
11
  /**
10
12
  * Internal dependencies
11
13
  */
12
14
 
13
15
  import { store as editorStore } from '../../store';
16
+ import { unlock } from '../../lock-unlock';
14
17
  export default function PostSyncStatus() {
15
18
  const {
16
19
  syncStatus,
17
- postType
20
+ postType,
21
+ meta
18
22
  } = useSelect(select => {
19
23
  const {
20
24
  getEditedPostAttribute
21
25
  } = select(editorStore);
22
26
  return {
23
27
  syncStatus: getEditedPostAttribute('wp_pattern_sync_status'),
28
+ meta: getEditedPostAttribute('meta'),
24
29
  postType: getEditedPostAttribute('type')
25
30
  };
26
- }, []);
31
+ });
27
32
 
28
33
  if (postType !== 'wp_block') {
29
34
  return null;
30
- }
35
+ } // When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.
36
+
31
37
 
32
- const isFullySynced = !syncStatus;
38
+ const currentSyncStatus = meta?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : syncStatus;
33
39
  return createElement(PanelRow, {
34
40
  className: "edit-post-sync-status"
35
- }, createElement("span", null, __('Sync status')), createElement("div", null, isFullySynced ? __('Fully synced') : __('Not synced')));
41
+ }, createElement("span", null, __('Sync status')), createElement("div", null, currentSyncStatus === 'unsynced' ? __('Not synced') : __('Fully synced')));
42
+ }
43
+ export function PostSyncStatusModal() {
44
+ const {
45
+ editPost
46
+ } = useDispatch(editorStore);
47
+ const [isModalOpen, setIsModalOpen] = useState(false);
48
+ const [syncType, setSyncType] = useState(undefined);
49
+ const {
50
+ postType,
51
+ isNewPost
52
+ } = useSelect(select => {
53
+ const {
54
+ getEditedPostAttribute,
55
+ isCleanNewPost
56
+ } = select(editorStore);
57
+ return {
58
+ postType: getEditedPostAttribute('type'),
59
+ isNewPost: isCleanNewPost()
60
+ };
61
+ }, []);
62
+ useEffect(() => {
63
+ if (isNewPost && postType === 'wp_block') {
64
+ setIsModalOpen(true);
65
+ } // We only want the modal to open when the page is first loaded.
66
+ // eslint-disable-next-line react-hooks/exhaustive-deps
67
+
68
+ }, []);
69
+
70
+ const setSyncStatus = () => {
71
+ editPost({
72
+ meta: {
73
+ wp_pattern_sync_status: syncType
74
+ }
75
+ });
76
+ };
77
+
78
+ if (postType !== 'wp_block' || !isNewPost) {
79
+ return null;
80
+ }
81
+
82
+ const {
83
+ ReusableBlocksRenameHint
84
+ } = unlock(blockEditorPrivateApis);
85
+ return createElement(Fragment, null, isModalOpen && createElement(Modal, {
86
+ title: __('Set pattern sync status'),
87
+ onRequestClose: () => {
88
+ setIsModalOpen(false);
89
+ },
90
+ overlayClassName: "reusable-blocks-menu-items__convert-modal"
91
+ }, createElement("form", {
92
+ onSubmit: event => {
93
+ event.preventDefault();
94
+ setIsModalOpen(false);
95
+ setSyncStatus();
96
+ }
97
+ }, createElement(VStack, {
98
+ spacing: "5"
99
+ }, createElement(ReusableBlocksRenameHint, null), createElement(ToggleControl, {
100
+ label: __('Synced'),
101
+ help: __('Editing the pattern will update it anywhere it is used.'),
102
+ checked: !syncType,
103
+ onChange: () => {
104
+ setSyncType(!syncType ? 'unsynced' : undefined);
105
+ }
106
+ }), createElement(HStack, {
107
+ justify: "right"
108
+ }, createElement(Button, {
109
+ variant: "primary",
110
+ type: "submit"
111
+ }, __('Create')))))));
36
112
  }
37
113
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"names":["useSelect","useDispatch","__","PanelRow","Modal","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","ToggleControl","useEffect","useState","privateApis","blockEditorPrivateApis","store","editorStore","unlock","PostSyncStatus","syncStatus","postType","meta","select","getEditedPostAttribute","currentSyncStatus","wp_pattern_sync_status","PostSyncStatusModal","editPost","isModalOpen","setIsModalOpen","syncType","setSyncType","undefined","isNewPost","isCleanNewPost","setSyncStatus","ReusableBlocksRenameHint","event","preventDefault"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,QADD,EAECC,KAFD,EAGCC,MAHD,EAICC,oBAAoB,IAAIC,MAJzB,EAKCC,oBAAoB,IAAIC,MALzB,EAMCC,aAND,QAOO,uBAPP;AAQA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,WAAW,IAAIC,sBAAxB,QAAsD,yBAAtD;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,eAAe,SAASC,cAAT,GAA0B;AACxC,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,QAAd;AAAwBC,IAAAA;AAAxB,MAA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AQ,IAAA,OAAO,EAAC;AAAhB,KACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,SAAhB;AAA0B,IAAA,IAAI,EAAC;AAA/B,KACG9B,EAAE,CAAE,QAAF,CADL,CADD,CAdD,CAPD,CAPD,CAFF,CADD;AA0CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tPanelRow,\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n} from '@wordpress/components';\nimport { useEffect, useState } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PostSyncStatus() {\n\tconst { syncStatus, postType, meta } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\treturn {\n\t\t\tsyncStatus: getEditedPostAttribute( 'wp_pattern_sync_status' ),\n\t\t\tmeta: getEditedPostAttribute( 'meta' ),\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t};\n\t} );\n\n\tif ( postType !== 'wp_block' ) {\n\t\treturn null;\n\t}\n\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\tconst currentSyncStatus =\n\t\tmeta?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : 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{ currentSyncStatus === 'unsynced'\n\t\t\t\t\t? __( 'Not synced' )\n\t\t\t\t\t: __( 'Fully synced' ) }\n\t\t\t</div>\n\t\t</PanelRow>\n\t);\n}\n\nexport function PostSyncStatusModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\n\tconst { postType, isNewPost } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, isCleanNewPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisNewPost: isCleanNewPost(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( isNewPost && postType === 'wp_block' ) {\n\t\t\tsetIsModalOpen( true );\n\t\t}\n\t\t// We only want the modal to open when the page is first loaded.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst setSyncStatus = () => {\n\t\teditPost( {\n\t\t\tmeta: {\n\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t},\n\t\t} );\n\t};\n\n\tif ( postType !== 'wp_block' || ! isNewPost ) {\n\t\treturn null;\n\t}\n\tconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\treturn (\n\t\t<>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Set pattern sync status' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tsetSyncStatus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<ReusableBlocksRenameHint />\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Synced' ) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Editing the pattern will update it anywhere it is used.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\t\t\t! syncType ? 'unsynced' : undefined\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t\t\t<Button variant=\"primary\" type=\"submit\">\n\t\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "13.12.6",
3
+ "version": "13.12.8",
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.6",
38
- "@wordpress/blocks": "^12.12.3",
39
- "@wordpress/components": "^25.1.6",
37
+ "@wordpress/block-editor": "^12.3.8",
38
+ "@wordpress/blocks": "^12.12.4",
39
+ "@wordpress/components": "^25.1.8",
40
40
  "@wordpress/compose": "^6.12.1",
41
- "@wordpress/core-data": "^6.12.6",
42
- "@wordpress/data": "^9.5.3",
41
+ "@wordpress/core-data": "^6.12.8",
42
+ "@wordpress/data": "^9.5.4",
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.3",
51
+ "@wordpress/keyboard-shortcuts": "^4.12.4",
52
52
  "@wordpress/keycodes": "^3.35.1",
53
53
  "@wordpress/media-utils": "^4.26.1",
54
- "@wordpress/notices": "^4.3.3",
55
- "@wordpress/preferences": "^3.12.6",
56
- "@wordpress/private-apis": "^0.17.1",
57
- "@wordpress/reusable-blocks": "^4.12.6",
58
- "@wordpress/rich-text": "^6.12.4",
59
- "@wordpress/server-side-render": "^4.12.6",
54
+ "@wordpress/notices": "^4.3.4",
55
+ "@wordpress/preferences": "^3.12.8",
56
+ "@wordpress/private-apis": "^0.17.2",
57
+ "@wordpress/reusable-blocks": "^4.12.8",
58
+ "@wordpress/rich-text": "^6.12.5",
59
+ "@wordpress/server-side-render": "^4.12.8",
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": "86ecd96b3bcada6b4cc35bb2455b3029cebb0ff3"
76
+ "gitHead": "cedb8caa943db47c16bdb4fa8880d506ce938fab"
77
77
  }
@@ -51,7 +51,10 @@ export { default as PostSlugCheck } from './post-slug/check';
51
51
  export { default as PostSticky } from './post-sticky';
52
52
  export { default as PostStickyCheck } from './post-sticky/check';
53
53
  export { default as PostSwitchToDraftButton } from './post-switch-to-draft-button';
54
- export { default as PostSyncStatus } from './post-sync-status';
54
+ export {
55
+ default as PostSyncStatus,
56
+ PostSyncStatusModal,
57
+ } from './post-sync-status';
55
58
  export { default as PostTaxonomies } from './post-taxonomies';
56
59
  export { FlatTermSelector as PostTaxonomiesFlatTermSelector } from './post-taxonomies/flat-term-selector';
57
60
  export { HierarchicalTermSelector as PostTaxonomiesHierarchicalTermSelector } from './post-taxonomies/hierarchical-term-selector';
@@ -1,34 +1,128 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useSelect } from '@wordpress/data';
4
+ import { useSelect, useDispatch } from '@wordpress/data';
5
5
  import { __ } from '@wordpress/i18n';
6
- import { PanelRow } from '@wordpress/components';
6
+ import {
7
+ PanelRow,
8
+ Modal,
9
+ Button,
10
+ __experimentalHStack as HStack,
11
+ __experimentalVStack as VStack,
12
+ ToggleControl,
13
+ } from '@wordpress/components';
14
+ import { useEffect, useState } from '@wordpress/element';
15
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
7
16
 
8
17
  /**
9
18
  * Internal dependencies
10
19
  */
11
20
  import { store as editorStore } from '../../store';
21
+ import { unlock } from '../../lock-unlock';
12
22
 
13
23
  export default function PostSyncStatus() {
14
- const { syncStatus, postType } = useSelect( ( select ) => {
24
+ const { syncStatus, postType, meta } = useSelect( ( select ) => {
15
25
  const { getEditedPostAttribute } = select( editorStore );
16
26
  return {
17
27
  syncStatus: getEditedPostAttribute( 'wp_pattern_sync_status' ),
28
+ meta: getEditedPostAttribute( 'meta' ),
18
29
  postType: getEditedPostAttribute( 'type' ),
19
30
  };
20
- }, [] );
31
+ } );
32
+
21
33
  if ( postType !== 'wp_block' ) {
22
34
  return null;
23
35
  }
24
- const isFullySynced = ! syncStatus;
36
+ // When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.
37
+ const currentSyncStatus =
38
+ meta?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : syncStatus;
25
39
 
26
40
  return (
27
41
  <PanelRow className="edit-post-sync-status">
28
42
  <span>{ __( 'Sync status' ) }</span>
29
43
  <div>
30
- { isFullySynced ? __( 'Fully synced' ) : __( 'Not synced' ) }
44
+ { currentSyncStatus === 'unsynced'
45
+ ? __( 'Not synced' )
46
+ : __( 'Fully synced' ) }
31
47
  </div>
32
48
  </PanelRow>
33
49
  );
34
50
  }
51
+
52
+ export function PostSyncStatusModal() {
53
+ const { editPost } = useDispatch( editorStore );
54
+ const [ isModalOpen, setIsModalOpen ] = useState( false );
55
+ const [ syncType, setSyncType ] = useState( undefined );
56
+
57
+ const { postType, isNewPost } = useSelect( ( select ) => {
58
+ const { getEditedPostAttribute, isCleanNewPost } =
59
+ select( editorStore );
60
+ return {
61
+ postType: getEditedPostAttribute( 'type' ),
62
+ isNewPost: isCleanNewPost(),
63
+ };
64
+ }, [] );
65
+
66
+ useEffect( () => {
67
+ if ( isNewPost && postType === 'wp_block' ) {
68
+ setIsModalOpen( true );
69
+ }
70
+ // We only want the modal to open when the page is first loaded.
71
+ // eslint-disable-next-line react-hooks/exhaustive-deps
72
+ }, [] );
73
+
74
+ const setSyncStatus = () => {
75
+ editPost( {
76
+ meta: {
77
+ wp_pattern_sync_status: syncType,
78
+ },
79
+ } );
80
+ };
81
+
82
+ if ( postType !== 'wp_block' || ! isNewPost ) {
83
+ return null;
84
+ }
85
+ const { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );
86
+ return (
87
+ <>
88
+ { isModalOpen && (
89
+ <Modal
90
+ title={ __( 'Set pattern sync status' ) }
91
+ onRequestClose={ () => {
92
+ setIsModalOpen( false );
93
+ } }
94
+ overlayClassName="reusable-blocks-menu-items__convert-modal"
95
+ >
96
+ <form
97
+ onSubmit={ ( event ) => {
98
+ event.preventDefault();
99
+ setIsModalOpen( false );
100
+ setSyncStatus();
101
+ } }
102
+ >
103
+ <VStack spacing="5">
104
+ <ReusableBlocksRenameHint />
105
+ <ToggleControl
106
+ label={ __( 'Synced' ) }
107
+ help={ __(
108
+ 'Editing the pattern will update it anywhere it is used.'
109
+ ) }
110
+ checked={ ! syncType }
111
+ onChange={ () => {
112
+ setSyncType(
113
+ ! syncType ? 'unsynced' : undefined
114
+ );
115
+ } }
116
+ />
117
+ <HStack justify="right">
118
+ <Button variant="primary" type="submit">
119
+ { __( 'Create' ) }
120
+ </Button>
121
+ </HStack>
122
+ </VStack>
123
+ </form>
124
+ </Modal>
125
+ ) }
126
+ </>
127
+ );
128
+ }