@wordpress/editor 13.19.12 → 13.19.13
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-sync-status/index.js +1 -1
- package/build/components/post-sync-status/index.js.map +1 -1
- package/build-module/components/post-sync-status/index.js +2 -2
- package/build-module/components/post-sync-status/index.js.map +1 -1
- package/package.json +31 -31
- package/src/components/post-sync-status/index.js +5 -2
|
@@ -98,7 +98,7 @@ function PostSyncStatusModal() {
|
|
|
98
98
|
}, (0, _element.createElement)(_components.__experimentalVStack, {
|
|
99
99
|
spacing: "5"
|
|
100
100
|
}, (0, _element.createElement)(ReusableBlocksRenameHint, null), (0, _element.createElement)(_components.ToggleControl, {
|
|
101
|
-
label: (0, _i18n.
|
|
101
|
+
label: (0, _i18n._x)('Synced', 'Option that makes an individual pattern synchronized'),
|
|
102
102
|
help: (0, _i18n.__)('Editing the pattern will update it anywhere it is used.'),
|
|
103
103
|
checked: !syncType,
|
|
104
104
|
onChange: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_data","_i18n","_components","_blockEditor","_store","_lockUnlock","ReusableBlocksRenameHint","unlock","blockEditorPrivateApis","PostSyncStatus","syncStatus","postType","useSelect","select","getEditedPostAttribute","editorStore","meta","currentSyncStatus","wp_pattern_sync_status","createElement","PanelRow","className","__","PostSyncStatusModal","editPost","useDispatch","isModalOpen","setIsModalOpen","useState","syncType","setSyncType","undefined","isNewPost","isCleanNewPost","useEffect","setSyncStatus","Fragment","Modal","title","onRequestClose","overlayClassName","onSubmit","event","preventDefault","__experimentalVStack","spacing","ToggleControl","label","help","checked","onChange","__experimentalHStack","justify","Button","variant","type"],"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"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\nconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\nexport default function PostSyncStatus() {\n\tconst { syncStatus, postType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst meta = getEditedPostAttribute( 'meta' );\n\n\t\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\t\tconst currentSyncStatus =\n\t\t\tmeta?.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t? 'unsynced'\n\t\t\t\t: getEditedPostAttribute( 'wp_pattern_sync_status' );\n\n\t\treturn {\n\t\t\tsyncStatus: currentSyncStatus,\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t};\n\t} );\n\n\tif ( postType !== 'wp_block' ) {\n\t\treturn null;\n\t}\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{ syncStatus === '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\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={
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_i18n","_components","_blockEditor","_store","_lockUnlock","ReusableBlocksRenameHint","unlock","blockEditorPrivateApis","PostSyncStatus","syncStatus","postType","useSelect","select","getEditedPostAttribute","editorStore","meta","currentSyncStatus","wp_pattern_sync_status","createElement","PanelRow","className","__","PostSyncStatusModal","editPost","useDispatch","isModalOpen","setIsModalOpen","useState","syncType","setSyncType","undefined","isNewPost","isCleanNewPost","useEffect","setSyncStatus","Fragment","Modal","title","onRequestClose","overlayClassName","onSubmit","event","preventDefault","__experimentalVStack","spacing","ToggleControl","label","_x","help","checked","onChange","__experimentalHStack","justify","Button","variant","type"],"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } 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\nconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\nexport default function PostSyncStatus() {\n\tconst { syncStatus, postType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst meta = getEditedPostAttribute( 'meta' );\n\n\t\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\t\tconst currentSyncStatus =\n\t\t\tmeta?.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t? 'unsynced'\n\t\t\t\t: getEditedPostAttribute( 'wp_pattern_sync_status' );\n\n\t\treturn {\n\t\t\tsyncStatus: currentSyncStatus,\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t};\n\t} );\n\n\tif ( postType !== 'wp_block' ) {\n\t\treturn null;\n\t}\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{ syncStatus === '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\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={ _x(\n\t\t\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t\t\t'Option that makes an individual pattern synchronized'\n\t\t\t\t\t\t\t\t) }\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"],"mappings":";;;;;;;AAaA,IAAAA,QAAA,GAAAC,OAAA;AAVA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AASA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AApBA;AACA;AACA;;AAcA;AACA;AACA;;AAIA,MAAM;EAAEO;AAAyB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAEtD,SAASC,cAAcA,CAAA,EAAG;EACxC,MAAM;IAAEC,UAAU;IAAEC;EAAS,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzD,MAAM;MAAEC;IAAuB,CAAC,GAAGD,MAAM,CAAEE,YAAY,CAAC;IACxD,MAAMC,IAAI,GAAGF,sBAAsB,CAAE,MAAO,CAAC;;IAE7C;IACA,MAAMG,iBAAiB,GACtBD,IAAI,EAAEE,sBAAsB,KAAK,UAAU,GACxC,UAAU,GACVJ,sBAAsB,CAAE,wBAAyB,CAAC;IAEtD,OAAO;MACNJ,UAAU,EAAEO,iBAAiB;MAC7BN,QAAQ,EAAEG,s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A,CAAAqB,aAAA,EAACjB,WAAA,CAAAoD,MAAM;IAACC,OAAO,EAAC,SAAS;IAACC,IAAI,EAAC;EAAQ,GACpC,IAAAlC,QAAE,EAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAEP,CAAC;AAEL"}
|
|
@@ -3,7 +3,7 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { __, _x } from '@wordpress/i18n';
|
|
7
7
|
import { PanelRow, Modal, Button, __experimentalHStack as HStack, __experimentalVStack as VStack, ToggleControl } from '@wordpress/components';
|
|
8
8
|
import { useEffect, useState } from '@wordpress/element';
|
|
9
9
|
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
@@ -91,7 +91,7 @@ export function PostSyncStatusModal() {
|
|
|
91
91
|
}, createElement(VStack, {
|
|
92
92
|
spacing: "5"
|
|
93
93
|
}, createElement(ReusableBlocksRenameHint, null), createElement(ToggleControl, {
|
|
94
|
-
label:
|
|
94
|
+
label: _x('Synced', 'Option that makes an individual pattern synchronized'),
|
|
95
95
|
help: __('Editing the pattern will update it anywhere it is used.'),
|
|
96
96
|
checked: !syncType,
|
|
97
97
|
onChange: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","__","PanelRow","Modal","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","ToggleControl","useEffect","useState","privateApis","blockEditorPrivateApis","store","editorStore","unlock","ReusableBlocksRenameHint","PostSyncStatus","syncStatus","postType","select","getEditedPostAttribute","meta","currentSyncStatus","wp_pattern_sync_status","createElement","className","PostSyncStatusModal","editPost","isModalOpen","setIsModalOpen","syncType","setSyncType","undefined","isNewPost","isCleanNewPost","setSyncStatus","Fragment","title","onRequestClose","overlayClassName","onSubmit","event","preventDefault","spacing","label","help","checked","onChange","justify","variant","type"],"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"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\nconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\nexport default function PostSyncStatus() {\n\tconst { syncStatus, postType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst meta = getEditedPostAttribute( 'meta' );\n\n\t\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\t\tconst currentSyncStatus =\n\t\t\tmeta?.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t? 'unsynced'\n\t\t\t\t: getEditedPostAttribute( 'wp_pattern_sync_status' );\n\n\t\treturn {\n\t\t\tsyncStatus: currentSyncStatus,\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t};\n\t} );\n\n\tif ( postType !== 'wp_block' ) {\n\t\treturn null;\n\t}\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{ syncStatus === '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\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={
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","__","_x","PanelRow","Modal","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","ToggleControl","useEffect","useState","privateApis","blockEditorPrivateApis","store","editorStore","unlock","ReusableBlocksRenameHint","PostSyncStatus","syncStatus","postType","select","getEditedPostAttribute","meta","currentSyncStatus","wp_pattern_sync_status","createElement","className","PostSyncStatusModal","editPost","isModalOpen","setIsModalOpen","syncType","setSyncType","undefined","isNewPost","isCleanNewPost","setSyncStatus","Fragment","title","onRequestClose","overlayClassName","onSubmit","event","preventDefault","spacing","label","help","checked","onChange","justify","variant","type"],"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } 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\nconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\nexport default function PostSyncStatus() {\n\tconst { syncStatus, postType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst meta = getEditedPostAttribute( 'meta' );\n\n\t\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\t\tconst currentSyncStatus =\n\t\t\tmeta?.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t? 'unsynced'\n\t\t\t\t: getEditedPostAttribute( 'wp_pattern_sync_status' );\n\n\t\treturn {\n\t\t\tsyncStatus: currentSyncStatus,\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t};\n\t} );\n\n\tif ( postType !== 'wp_block' ) {\n\t\treturn null;\n\t}\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{ syncStatus === '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\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={ _x(\n\t\t\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t\t\t'Option that makes an individual pattern synchronized'\n\t\t\t\t\t\t\t\t) }\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"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SACCC,QAAQ,EACRC,KAAK,EACLC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,aAAa,QACP,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAE/E;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAyB,CAAC,GAAGD,MAAM,CAAEH,sBAAuB,CAAC;AAErE,eAAe,SAASK,cAAcA,CAAA,EAAG;EACxC,MAAM;IAAEC,UAAU;IAAEC;EAAS,CAAC,GAAGtB,SAAS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,SAAS;IAACC,IAAI,EAAC;EAAQ,GACpCpD,EAAE,CAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAEP,CAAC;AAEL"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "13.19.
|
|
3
|
+
"version": "13.19.13",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,35 +31,35 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/a11y": "^3.42.
|
|
35
|
-
"@wordpress/api-fetch": "^6.39.
|
|
36
|
-
"@wordpress/blob": "^3.42.
|
|
37
|
-
"@wordpress/block-editor": "^12.10.
|
|
38
|
-
"@wordpress/blocks": "^12.19.
|
|
39
|
-
"@wordpress/components": "^25.8.
|
|
40
|
-
"@wordpress/compose": "^6.19.
|
|
41
|
-
"@wordpress/core-data": "^6.19.
|
|
42
|
-
"@wordpress/data": "^9.12.
|
|
43
|
-
"@wordpress/date": "^4.42.
|
|
44
|
-
"@wordpress/deprecated": "^3.42.
|
|
45
|
-
"@wordpress/dom": "^3.42.
|
|
46
|
-
"@wordpress/element": "^5.19.
|
|
47
|
-
"@wordpress/hooks": "^3.42.
|
|
48
|
-
"@wordpress/html-entities": "^3.42.
|
|
49
|
-
"@wordpress/i18n": "^4.42.
|
|
50
|
-
"@wordpress/icons": "^9.33.
|
|
51
|
-
"@wordpress/keyboard-shortcuts": "^4.19.
|
|
52
|
-
"@wordpress/keycodes": "^3.42.
|
|
53
|
-
"@wordpress/media-utils": "^4.33.
|
|
54
|
-
"@wordpress/notices": "^4.10.
|
|
55
|
-
"@wordpress/patterns": "^1.3.
|
|
56
|
-
"@wordpress/preferences": "^3.19.
|
|
57
|
-
"@wordpress/private-apis": "^0.24.
|
|
58
|
-
"@wordpress/reusable-blocks": "^4.19.
|
|
59
|
-
"@wordpress/rich-text": "^6.19.
|
|
60
|
-
"@wordpress/server-side-render": "^4.19.
|
|
61
|
-
"@wordpress/url": "^3.43.
|
|
62
|
-
"@wordpress/wordcount": "^3.42.
|
|
34
|
+
"@wordpress/a11y": "^3.42.13",
|
|
35
|
+
"@wordpress/api-fetch": "^6.39.13",
|
|
36
|
+
"@wordpress/blob": "^3.42.13",
|
|
37
|
+
"@wordpress/block-editor": "^12.10.13",
|
|
38
|
+
"@wordpress/blocks": "^12.19.13",
|
|
39
|
+
"@wordpress/components": "^25.8.13",
|
|
40
|
+
"@wordpress/compose": "^6.19.13",
|
|
41
|
+
"@wordpress/core-data": "^6.19.13",
|
|
42
|
+
"@wordpress/data": "^9.12.13",
|
|
43
|
+
"@wordpress/date": "^4.42.13",
|
|
44
|
+
"@wordpress/deprecated": "^3.42.13",
|
|
45
|
+
"@wordpress/dom": "^3.42.13",
|
|
46
|
+
"@wordpress/element": "^5.19.13",
|
|
47
|
+
"@wordpress/hooks": "^3.42.13",
|
|
48
|
+
"@wordpress/html-entities": "^3.42.13",
|
|
49
|
+
"@wordpress/i18n": "^4.42.13",
|
|
50
|
+
"@wordpress/icons": "^9.33.13",
|
|
51
|
+
"@wordpress/keyboard-shortcuts": "^4.19.13",
|
|
52
|
+
"@wordpress/keycodes": "^3.42.13",
|
|
53
|
+
"@wordpress/media-utils": "^4.33.13",
|
|
54
|
+
"@wordpress/notices": "^4.10.13",
|
|
55
|
+
"@wordpress/patterns": "^1.3.13",
|
|
56
|
+
"@wordpress/preferences": "^3.19.13",
|
|
57
|
+
"@wordpress/private-apis": "^0.24.13",
|
|
58
|
+
"@wordpress/reusable-blocks": "^4.19.13",
|
|
59
|
+
"@wordpress/rich-text": "^6.19.13",
|
|
60
|
+
"@wordpress/server-side-render": "^4.19.13",
|
|
61
|
+
"@wordpress/url": "^3.43.13",
|
|
62
|
+
"@wordpress/wordcount": "^3.42.13",
|
|
63
63
|
"classnames": "^2.3.1",
|
|
64
64
|
"date-fns": "^2.28.0",
|
|
65
65
|
"memize": "^2.1.0",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "70b30e9461372ae518e3d0e50f7e5085eda8b46e"
|
|
78
78
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { __, _x } from '@wordpress/i18n';
|
|
6
6
|
import {
|
|
7
7
|
PanelRow,
|
|
8
8
|
Modal,
|
|
@@ -109,7 +109,10 @@ export function PostSyncStatusModal() {
|
|
|
109
109
|
<VStack spacing="5">
|
|
110
110
|
<ReusableBlocksRenameHint />
|
|
111
111
|
<ToggleControl
|
|
112
|
-
label={
|
|
112
|
+
label={ _x(
|
|
113
|
+
'Synced',
|
|
114
|
+
'Option that makes an individual pattern synchronized'
|
|
115
|
+
) }
|
|
113
116
|
help={ __(
|
|
114
117
|
'Editing the pattern will update it anywhere it is used.'
|
|
115
118
|
) }
|