@wordpress/editor 14.8.5 → 14.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/bindings/api.js +2 -5
- package/build/bindings/api.js.map +1 -1
- package/build/bindings/pattern-overrides.js +7 -6
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/bindings/post-meta.js +16 -16
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +15 -18
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build/components/document-tools/index.js +1 -6
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/header/index.js +22 -17
- package/build/components/header/index.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +8 -9
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/provider/disable-non-page-content-blocks.js +17 -18
- package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/provider/use-post-content-blocks.js +34 -0
- package/build/components/provider/use-post-content-blocks.js.map +1 -0
- package/build/components/resizable-editor/resize-handle.js +4 -0
- package/build/components/resizable-editor/resize-handle.js.map +1 -1
- package/build/components/zoom-out-toggle/index.js +1 -1
- package/build/components/zoom-out-toggle/index.js.map +1 -1
- package/build/dataviews/store/private-actions.js +2 -7
- package/build/dataviews/store/private-actions.js.map +1 -1
- package/build/hooks/pattern-overrides.js +1 -4
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/store/actions.js +20 -5
- package/build/store/actions.js.map +1 -1
- package/build/store/private-selectors.js +3 -3
- package/build/store/private-selectors.js.map +1 -1
- package/build-module/bindings/api.js +1 -4
- package/build-module/bindings/api.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js +7 -6
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/bindings/post-meta.js +16 -16
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +14 -18
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build-module/components/document-tools/index.js +1 -6
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/header/index.js +22 -17
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +8 -9
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/provider/disable-non-page-content-blocks.js +17 -18
- package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/provider/use-post-content-blocks.js +27 -0
- package/build-module/components/provider/use-post-content-blocks.js.map +1 -0
- package/build-module/components/resizable-editor/resize-handle.js +4 -0
- package/build-module/components/resizable-editor/resize-handle.js.map +1 -1
- package/build-module/components/zoom-out-toggle/index.js +1 -1
- package/build-module/components/zoom-out-toggle/index.js.map +1 -1
- package/build-module/dataviews/store/private-actions.js +4 -8
- package/build-module/dataviews/store/private-actions.js.map +1 -1
- package/build-module/hooks/pattern-overrides.js +1 -4
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/store/actions.js +18 -5
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-selectors.js +2 -2
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-style/style-rtl.css +10 -1
- package/build-style/style.css +10 -1
- package/build-types/bindings/api.d.ts.map +1 -1
- package/build-types/bindings/pattern-overrides.d.ts +5 -4
- package/build-types/bindings/pattern-overrides.d.ts.map +1 -1
- package/build-types/bindings/post-meta.d.ts +8 -8
- package/build-types/bindings/post-meta.d.ts.map +1 -1
- package/build-types/components/document-tools/index.d.ts.map +1 -1
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
- package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
- package/build-types/components/provider/use-post-content-blocks.d.ts +2 -0
- package/build-types/components/provider/use-post-content-blocks.d.ts.map +1 -0
- package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -1
- package/build-types/store/actions.d.ts +1 -13
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +2 -2
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/package.json +37 -37
- package/src/bindings/api.js +1 -2
- package/src/bindings/pattern-overrides.js +27 -30
- package/src/bindings/post-meta.js +28 -30
- package/src/components/block-settings-menu/content-only-settings-menu.js +19 -19
- package/src/components/document-tools/index.js +1 -4
- package/src/components/header/index.js +30 -14
- package/src/components/inserter-sidebar/index.js +8 -11
- package/src/components/provider/disable-non-page-content-blocks.js +20 -34
- package/src/components/provider/use-post-content-blocks.js +42 -0
- package/src/components/resizable-editor/resize-handle.js +5 -0
- package/src/components/zoom-out-toggle/index.js +1 -1
- package/src/dataviews/store/private-actions.ts +7 -7
- package/src/hooks/pattern-overrides.js +1 -2
- package/src/store/actions.js +23 -6
- package/src/store/private-selectors.js +2 -2
- package/src/store/test/actions.js +76 -0
- package/src/store/test/reducer.js +0 -22
- package/tsconfig.tsbuildinfo +1 -1
- package/build/dataviews/actions/delete-post.js +0 -98
- package/build/dataviews/actions/delete-post.js.map +0 -1
- package/build/dataviews/actions/rename-post.js +0 -125
- package/build/dataviews/actions/rename-post.js.map +0 -1
- package/build/dataviews/actions/reset-post.js +0 -113
- package/build/dataviews/actions/reset-post.js.map +0 -1
- package/build/dataviews/actions/restore-post.js +0 -112
- package/build/dataviews/actions/restore-post.js.map +0 -1
- package/build/dataviews/actions/trash-post.js +0 -144
- package/build/dataviews/actions/trash-post.js.map +0 -1
- package/build/dataviews/fields/index.js +0 -32
- package/build/dataviews/fields/index.js.map +0 -1
- package/build-module/dataviews/actions/delete-post.js +0 -89
- package/build-module/dataviews/actions/delete-post.js.map +0 -1
- package/build-module/dataviews/actions/rename-post.js +0 -118
- package/build-module/dataviews/actions/rename-post.js.map +0 -1
- package/build-module/dataviews/actions/reset-post.js +0 -106
- package/build-module/dataviews/actions/reset-post.js.map +0 -1
- package/build-module/dataviews/actions/restore-post.js +0 -104
- package/build-module/dataviews/actions/restore-post.js.map +0 -1
- package/build-module/dataviews/actions/trash-post.js +0 -137
- package/build-module/dataviews/actions/trash-post.js.map +0 -1
- package/build-module/dataviews/fields/index.js +0 -26
- package/build-module/dataviews/fields/index.js.map +0 -1
- package/build-types/dataviews/actions/delete-post.d.ts +0 -5
- package/build-types/dataviews/actions/delete-post.d.ts.map +0 -1
- package/build-types/dataviews/actions/rename-post.d.ts +0 -5
- package/build-types/dataviews/actions/rename-post.d.ts.map +0 -1
- package/build-types/dataviews/actions/reset-post.d.ts +0 -5
- package/build-types/dataviews/actions/reset-post.d.ts.map +0 -1
- package/build-types/dataviews/actions/restore-post.d.ts +0 -5
- package/build-types/dataviews/actions/restore-post.d.ts.map +0 -1
- package/build-types/dataviews/actions/trash-post.d.ts +0 -5
- package/build-types/dataviews/actions/trash-post.d.ts.map +0 -1
- package/build-types/dataviews/fields/index.d.ts +0 -8
- package/build-types/dataviews/fields/index.d.ts.map +0 -1
- package/src/dataviews/actions/delete-post.tsx +0 -109
- package/src/dataviews/actions/rename-post.tsx +0 -146
- package/src/dataviews/actions/reset-post.tsx +0 -147
- package/src/dataviews/actions/restore-post.tsx +0 -134
- package/src/dataviews/actions/trash-post.tsx +0 -198
- package/src/dataviews/fields/index.ts +0 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["fastDeepEqual","store","blockEditorStore","createSelector","createRegistrySelector","layout","symbol","navigation","page","pageIcon","verse","coreStore","getRenderingMode","getCurrentPost","__experimentalGetDefaultTemplatePartAreas","getEntityActions","_getEntityActions","isEntityReady","_isEntityReady","EMPTY_INSERTION_POINT","rootClientId","undefined","insertionIndex","filterValue","getInsertionPoint","select","state","blockInserterPanel","postContentClientId","getBlocksByName","getListViewToggleRef","listViewToggleRef","getInserterSidebarToggleRef","inserterSidebarToggleRef","CARD_ICONS","wp_block","wp_navigation","post","getPostIcon","postType","options","find","item","area","icon","postTypeEntity","getPostType","startsWith","slice","hasPostMetaChanges","postId","type","currentPostType","id","currentPostId","edits","getEntityRecordNonTransientEdits","meta","originalPostMeta","getEntityRecord","footnotes","args","dataviews","getPostBlocksByName","blockNames","Array","isArray","getBlockParents","getBlockName","filter","clientId","every","parentClientId","parentBlockName","includes","getBlocks"],"sources":["@wordpress/editor/src/store/private-selectors.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal';\n\n/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport {\n\tlayout,\n\tsymbol,\n\tnavigation,\n\tpage as pageIcon,\n\tverse,\n} from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetRenderingMode,\n\tgetCurrentPost,\n\t__experimentalGetDefaultTemplatePartAreas,\n} from './selectors';\nimport {\n\tgetEntityActions as _getEntityActions,\n\tisEntityReady as _isEntityReady,\n} from '../dataviews/store/private-selectors';\n\nconst EMPTY_INSERTION_POINT = {\n\trootClientId: undefined,\n\tinsertionIndex: undefined,\n\tfilterValue: undefined,\n};\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const getInsertionPoint = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tif ( typeof state.blockInserterPanel === 'object' ) {\n\t\t\t\treturn state.blockInserterPanel;\n\t\t\t}\n\n\t\t\tif ( getRenderingMode( state ) === 'template-locked' ) {\n\t\t\t\tconst [ postContentClientId ] =\n\t\t\t\t\tselect( blockEditorStore ).getBlocksByName(\n\t\t\t\t\t\t'core/post-content'\n\t\t\t\t\t);\n\t\t\t\tif ( postContentClientId ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trootClientId: postContentClientId,\n\t\t\t\t\t\tinsertionIndex: undefined,\n\t\t\t\t\t\tfilterValue: undefined,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn EMPTY_INSERTION_POINT;\n\t\t},\n\t\t( state ) => {\n\t\t\tconst [ postContentClientId ] =\n\t\t\t\tselect( blockEditorStore ).getBlocksByName(\n\t\t\t\t\t'core/post-content'\n\t\t\t\t);\n\t\t\treturn [\n\t\t\t\tstate.blockInserterPanel,\n\t\t\t\tgetRenderingMode( state ),\n\t\t\t\tpostContentClientId,\n\t\t\t];\n\t\t}\n\t)\n);\n\nexport function getListViewToggleRef( state ) {\n\treturn state.listViewToggleRef;\n}\nexport function getInserterSidebarToggleRef( state ) {\n\treturn state.inserterSidebarToggleRef;\n}\nconst CARD_ICONS = {\n\twp_block: symbol,\n\twp_navigation: navigation,\n\tpage: pageIcon,\n\tpost: verse,\n};\n\nexport const getPostIcon = createRegistrySelector(\n\t( select ) => ( state, postType, options ) => {\n\t\t{\n\t\t\tif (\n\t\t\t\tpostType === 'wp_template_part' ||\n\t\t\t\tpostType === 'wp_template'\n\t\t\t) {\n\t\t\t\treturn (\n\t\t\t\t\t__experimentalGetDefaultTemplatePartAreas( state ).find(\n\t\t\t\t\t\t( item ) => options.area === item.area\n\t\t\t\t\t)?.icon || layout\n\t\t\t\t);\n\t\t\t}\n\t\t\tif ( CARD_ICONS[ postType ] ) {\n\t\t\t\treturn CARD_ICONS[ postType ];\n\t\t\t}\n\t\t\tconst postTypeEntity = select( coreStore ).getPostType( postType );\n\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t// also supports urls and svg as values.\n\t\t\tif (\n\t\t\t\ttypeof postTypeEntity?.icon === 'string' &&\n\t\t\t\tpostTypeEntity.icon.startsWith( 'dashicons-' )\n\t\t\t) {\n\t\t\t\treturn postTypeEntity.icon.slice( 10 );\n\t\t\t}\n\t\t\treturn pageIcon;\n\t\t}\n\t}\n);\n\n/**\n * Returns true if there are unsaved changes to the\n * post's meta fields, and false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} postType The post type of the post.\n * @param {number} postId The ID of the post.\n *\n * @return {boolean} Whether there are edits or not in the meta fields of the relevant post.\n */\nexport const hasPostMetaChanges = createRegistrySelector(\n\t( select ) => ( state, postType, postId ) => {\n\t\tconst { type: currentPostType, id: currentPostId } =\n\t\t\tgetCurrentPost( state );\n\t\t// If no postType or postId is passed, use the current post.\n\t\tconst edits = select( coreStore ).getEntityRecordNonTransientEdits(\n\t\t\t'postType',\n\t\t\tpostType || currentPostType,\n\t\t\tpostId || currentPostId\n\t\t);\n\n\t\tif ( ! edits?.meta ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Compare if anything apart from `footnotes` has changed.\n\t\tconst originalPostMeta = select( coreStore ).getEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType || currentPostType,\n\t\t\tpostId || currentPostId\n\t\t)?.meta;\n\n\t\treturn ! fastDeepEqual(\n\t\t\t{ ...originalPostMeta, footnotes: undefined },\n\t\t\t{ ...edits.meta, footnotes: undefined }\n\t\t);\n\t}\n);\n\nexport function getEntityActions( state, ...args ) {\n\treturn _getEntityActions( state.dataviews, ...args );\n}\n\nexport function isEntityReady( state, ...args ) {\n\treturn _isEntityReady( state.dataviews, ...args );\n}\n\n/**\n * Similar to getBlocksByName in @wordpress/block-editor, but only returns the top-most\n * blocks that aren't descendants of the query block.\n *\n * @param {Object} state Global application state.\n * @param {Array|string} blockNames Block names of the blocks to retrieve.\n *\n * @return {Array} Block client IDs.\n */\nexport const getPostBlocksByName = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state, blockNames ) => {\n\t\t\tblockNames = Array.isArray( blockNames )\n\t\t\t\t? blockNames\n\t\t\t\t: [ blockNames ];\n\t\t\tconst { getBlocksByName, getBlockParents, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn getBlocksByName( blockNames ).filter( ( clientId ) =>\n\t\t\t\tgetBlockParents( clientId ).every( ( parentClientId ) => {\n\t\t\t\t\tconst parentBlockName = getBlockName( parentClientId );\n\t\t\t\t\treturn (\n\t\t\t\t\t\t// Ignore descendents of the query block.\n\t\t\t\t\t\tparentBlockName !== 'core/query' &&\n\t\t\t\t\t\t// Enable only the top-most block.\n\t\t\t\t\t\t! blockNames.includes( parentBlockName )\n\t\t\t\t\t);\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t\t() => [ select( blockEditorStore ).getBlocks() ]\n\t)\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,cAAc,EAAEC,sBAAsB,QAAQ,iBAAiB;AACxE,SACCC,MAAM,EACNC,MAAM,EACNC,UAAU,EACVC,IAAI,IAAIC,QAAQ,EAChBC,KAAK,QACC,kBAAkB;AACzB,SAAST,KAAK,IAAIU,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SACCC,gBAAgB,EAChBC,cAAc,EACdC,yCAAyC,QACnC,aAAa;AACpB,SACCC,gBAAgB,IAAIC,iBAAiB,EACrCC,aAAa,IAAIC,cAAc,QACzB,sCAAsC;AAE7C,MAAMC,qBAAqB,GAAG;EAC7BC,YAAY,EAAEC,SAAS;EACvBC,cAAc,EAAED,SAAS;EACzBE,WAAW,EAAEF;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,iBAAiB,GAAGpB,sBAAsB,CAAIqB,MAAM,IAChEtB,cAAc,CACXuB,KAAK,IAAM;EACZ,IAAK,OAAOA,KAAK,CAACC,kBAAkB,KAAK,QAAQ,EAAG;IACnD,OAAOD,KAAK,CAACC,kBAAkB;EAChC;EAEA,IAAKf,gBAAgB,CAAEc,KAAM,CAAC,KAAK,iBAAiB,EAAG;IACtD,MAAM,CAAEE,mBAAmB,CAAE,GAC5BH,MAAM,CAAEvB,gBAAiB,CAAC,CAAC2B,eAAe,CACzC,mBACD,CA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AS5C,aAAaA,CAAES,KAAK,EAAE,GAAGmC,IAAI,EAAG;EAC/C,OAAO3C,cAAc,CAAEQ,KAAK,CAACoC,SAAS,EAAE,GAAGD,IAAK,CAAC;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,mBAAmB,GAAG3D,sBAAsB,CAAIqB,MAAM,IAClEtB,cAAc,CACb,CAAEuB,KAAK,EAAEsC,UAAU,KAAM;EACxBA,UAAU,GAAGC,KAAK,CAACC,OAAO,CAAEF,UAAW,CAAC,GACrCA,UAAU,GACV,CAAEA,UAAU,CAAE;EACjB,MAAM;IAAEnC,eAAe;IAAEsC,eAAe;IAAEC;EAAa,CAAC,GACvD3C,MAAM,CAAEvB,gBAAiB,CAAC;EAC3B,OAAO2B,eAAe,CAAEmC,UAAW,CAAC,CAACK,MAAM,CAAIC,QAAQ,IACtDH,eAAe,CAAEG,QAAS,CAAC,CAACC,KAAK,CAAIC,cAAc,IAAM;IACxD,MAAMC,eAAe,GAAGL,YAAY,CAAEI,cAAe,CAAC;IACtD;MACC;MACAC,eAAe,KAAK,YAAY;MAChC;MACA,CAAET,UAAU,CAACU,QAAQ,CAAED,eAAgB;IAAC;EAE1C,CAAE,CACH,CAAC;AACF,CAAC,EACD,MAAM,CAAEhD,MAAM,CAAEvB,gBAAiB,CAAC,CAACyE,SAAS,CAAC,CAAC,CAC/C,CACD,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["fastDeepEqual","store","blockEditorStore","createSelector","createRegistrySelector","layout","symbol","navigation","page","pageIcon","verse","coreStore","getRenderingMode","getCurrentPost","__experimentalGetDefaultTemplatePartAreas","getEntityActions","_getEntityActions","isEntityReady","_isEntityReady","EMPTY_INSERTION_POINT","rootClientId","undefined","insertionIndex","filterValue","getInserter","select","state","blockInserterPanel","postContentClientId","getBlocksByName","getListViewToggleRef","listViewToggleRef","getInserterSidebarToggleRef","inserterSidebarToggleRef","CARD_ICONS","wp_block","wp_navigation","post","getPostIcon","postType","options","find","item","area","icon","postTypeEntity","getPostType","startsWith","slice","hasPostMetaChanges","postId","type","currentPostType","id","currentPostId","edits","getEntityRecordNonTransientEdits","meta","originalPostMeta","getEntityRecord","footnotes","args","dataviews","getPostBlocksByName","blockNames","Array","isArray","getBlockParents","getBlockName","filter","clientId","every","parentClientId","parentBlockName","includes","getBlocks"],"sources":["@wordpress/editor/src/store/private-selectors.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal';\n\n/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport {\n\tlayout,\n\tsymbol,\n\tnavigation,\n\tpage as pageIcon,\n\tverse,\n} from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetRenderingMode,\n\tgetCurrentPost,\n\t__experimentalGetDefaultTemplatePartAreas,\n} from './selectors';\nimport {\n\tgetEntityActions as _getEntityActions,\n\tisEntityReady as _isEntityReady,\n} from '../dataviews/store/private-selectors';\n\nconst EMPTY_INSERTION_POINT = {\n\trootClientId: undefined,\n\tinsertionIndex: undefined,\n\tfilterValue: undefined,\n};\n\n/**\n * Get the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const getInserter = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tif ( typeof state.blockInserterPanel === 'object' ) {\n\t\t\t\treturn state.blockInserterPanel;\n\t\t\t}\n\n\t\t\tif ( getRenderingMode( state ) === 'template-locked' ) {\n\t\t\t\tconst [ postContentClientId ] =\n\t\t\t\t\tselect( blockEditorStore ).getBlocksByName(\n\t\t\t\t\t\t'core/post-content'\n\t\t\t\t\t);\n\t\t\t\tif ( postContentClientId ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trootClientId: postContentClientId,\n\t\t\t\t\t\tinsertionIndex: undefined,\n\t\t\t\t\t\tfilterValue: undefined,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn EMPTY_INSERTION_POINT;\n\t\t},\n\t\t( state ) => {\n\t\t\tconst [ postContentClientId ] =\n\t\t\t\tselect( blockEditorStore ).getBlocksByName(\n\t\t\t\t\t'core/post-content'\n\t\t\t\t);\n\t\t\treturn [\n\t\t\t\tstate.blockInserterPanel,\n\t\t\t\tgetRenderingMode( state ),\n\t\t\t\tpostContentClientId,\n\t\t\t];\n\t\t}\n\t)\n);\n\nexport function getListViewToggleRef( state ) {\n\treturn state.listViewToggleRef;\n}\nexport function getInserterSidebarToggleRef( state ) {\n\treturn state.inserterSidebarToggleRef;\n}\nconst CARD_ICONS = {\n\twp_block: symbol,\n\twp_navigation: navigation,\n\tpage: pageIcon,\n\tpost: verse,\n};\n\nexport const getPostIcon = createRegistrySelector(\n\t( select ) => ( state, postType, options ) => {\n\t\t{\n\t\t\tif (\n\t\t\t\tpostType === 'wp_template_part' ||\n\t\t\t\tpostType === 'wp_template'\n\t\t\t) {\n\t\t\t\treturn (\n\t\t\t\t\t__experimentalGetDefaultTemplatePartAreas( state ).find(\n\t\t\t\t\t\t( item ) => options.area === item.area\n\t\t\t\t\t)?.icon || layout\n\t\t\t\t);\n\t\t\t}\n\t\t\tif ( CARD_ICONS[ postType ] ) {\n\t\t\t\treturn CARD_ICONS[ postType ];\n\t\t\t}\n\t\t\tconst postTypeEntity = select( coreStore ).getPostType( postType );\n\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t// also supports urls and svg as values.\n\t\t\tif (\n\t\t\t\ttypeof postTypeEntity?.icon === 'string' &&\n\t\t\t\tpostTypeEntity.icon.startsWith( 'dashicons-' )\n\t\t\t) {\n\t\t\t\treturn postTypeEntity.icon.slice( 10 );\n\t\t\t}\n\t\t\treturn pageIcon;\n\t\t}\n\t}\n);\n\n/**\n * Returns true if there are unsaved changes to the\n * post's meta fields, and false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} postType The post type of the post.\n * @param {number} postId The ID of the post.\n *\n * @return {boolean} Whether there are edits or not in the meta fields of the relevant post.\n */\nexport const hasPostMetaChanges = createRegistrySelector(\n\t( select ) => ( state, postType, postId ) => {\n\t\tconst { type: currentPostType, id: currentPostId } =\n\t\t\tgetCurrentPost( state );\n\t\t// If no postType or postId is passed, use the current post.\n\t\tconst edits = select( coreStore ).getEntityRecordNonTransientEdits(\n\t\t\t'postType',\n\t\t\tpostType || currentPostType,\n\t\t\tpostId || currentPostId\n\t\t);\n\n\t\tif ( ! edits?.meta ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Compare if anything apart from `footnotes` has changed.\n\t\tconst originalPostMeta = select( coreStore ).getEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType || currentPostType,\n\t\t\tpostId || currentPostId\n\t\t)?.meta;\n\n\t\treturn ! fastDeepEqual(\n\t\t\t{ ...originalPostMeta, footnotes: undefined },\n\t\t\t{ ...edits.meta, footnotes: undefined }\n\t\t);\n\t}\n);\n\nexport function getEntityActions( state, ...args ) {\n\treturn _getEntityActions( state.dataviews, ...args );\n}\n\nexport function isEntityReady( state, ...args ) {\n\treturn _isEntityReady( state.dataviews, ...args );\n}\n\n/**\n * Similar to getBlocksByName in @wordpress/block-editor, but only returns the top-most\n * blocks that aren't descendants of the query block.\n *\n * @param {Object} state Global application state.\n * @param {Array|string} blockNames Block names of the blocks to retrieve.\n *\n * @return {Array} Block client IDs.\n */\nexport const getPostBlocksByName = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state, blockNames ) => {\n\t\t\tblockNames = Array.isArray( blockNames )\n\t\t\t\t? blockNames\n\t\t\t\t: [ blockNames ];\n\t\t\tconst { getBlocksByName, getBlockParents, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn getBlocksByName( blockNames ).filter( ( clientId ) =>\n\t\t\t\tgetBlockParents( clientId ).every( ( parentClientId ) => {\n\t\t\t\t\tconst parentBlockName = getBlockName( parentClientId );\n\t\t\t\t\treturn (\n\t\t\t\t\t\t// Ignore descendents of the query block.\n\t\t\t\t\t\tparentBlockName !== 'core/query' &&\n\t\t\t\t\t\t// Enable only the top-most block.\n\t\t\t\t\t\t! blockNames.includes( parentBlockName )\n\t\t\t\t\t);\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t\t() => [ select( blockEditorStore ).getBlocks() ]\n\t)\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,cAAc,EAAEC,sBAAsB,QAAQ,iBAAiB;AACxE,SACCC,MAAM,EACNC,MAAM,EACNC,UAAU,EACVC,IAAI,IAAIC,QAAQ,EAChBC,KAAK,QACC,kBAAkB;AACzB,SAAST,KAAK,IAAIU,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SACCC,gBAAgB,EAChBC,cAAc,EACdC,yCAAyC,QACnC,aAAa;AACpB,SACCC,gBAAgB,IAAIC,iBAAiB,EACrCC,aAAa,IAAIC,cAAc,QACzB,sCAAsC;AAE7C,MAAMC,qBAAqB,GAAG;EAC7BC,YAAY,EAAEC,SAAS;EACvBC,cAAc,EAAED,SAAS;EACzBE,WAAW,EAAEF;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,WAAW,GAAGpB,sBAAsB,CAAIqB,MAAM,IAC1DtB,cAAc,CACXuB,KAAK,IAAM;EACZ,IAAK,OAAOA,KAAK,CAACC,kBAAkB,KAAK,QAAQ,EAAG;IACnD,OAAOD,KAAK,CAACC,kBAAkB;EAChC;EAEA,IAAKf,gBAAgB,CAAEc,KAAM,CAAC,KAAK,iBAAiB,EAAG;IACtD,MAAM,CAAEE,mBAAmB,CAAE,G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KAAK,CAACoC,SAAS,EAAE,GAAGD,IAAK,CAAC;AACrD;AAEA,OAAO,SAAS5C,aAAaA,CAAES,KAAK,EAAE,GAAGmC,IAAI,EAAG;EAC/C,OAAO3C,cAAc,CAAEQ,KAAK,CAACoC,SAAS,EAAE,GAAGD,IAAK,CAAC;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,mBAAmB,GAAG3D,sBAAsB,CAAIqB,MAAM,IAClEtB,cAAc,CACb,CAAEuB,KAAK,EAAEsC,UAAU,KAAM;EACxBA,UAAU,GAAGC,KAAK,CAACC,OAAO,CAAEF,UAAW,CAAC,GACrCA,UAAU,GACV,CAAEA,UAAU,CAAE;EACjB,MAAM;IAAEnC,eAAe;IAAEsC,eAAe;IAAEC;EAAa,CAAC,GACvD3C,MAAM,CAAEvB,gBAAiB,CAAC;EAC3B,OAAO2B,eAAe,CAAEmC,UAAW,CAAC,CAACK,MAAM,CAAIC,QAAQ,IACtDH,eAAe,CAAEG,QAAS,CAAC,CAACC,KAAK,CAAIC,cAAc,IAAM;IACxD,MAAMC,eAAe,GAAGL,YAAY,CAAEI,cAAe,CAAC;IACtD;MACC;MACAC,eAAe,KAAK,YAAY;MAChC;MACA,CAAET,UAAU,CAACU,QAAQ,CAAED,eAAgB;IAAC;EAE1C,CAAE,CACH,CAAC;AACF,CAAC,EACD,MAAM,CAAEhD,MAAM,CAAEvB,gBAAiB,CAAC,CAACyE,SAAS,CAAC,CAAC,CAC/C,CACD,CAAC","ignoreList":[]}
|
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
/**
|
|
31
31
|
* Fonts & basic variables.
|
|
32
32
|
*/
|
|
33
|
+
/**
|
|
34
|
+
* Typography
|
|
35
|
+
*/
|
|
33
36
|
/**
|
|
34
37
|
* Grid System.
|
|
35
38
|
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
|
|
@@ -44,7 +47,10 @@
|
|
|
44
47
|
* Dimensions.
|
|
45
48
|
*/
|
|
46
49
|
/**
|
|
47
|
-
*
|
|
50
|
+
* Mobile specific styles
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* Editor styles.
|
|
48
54
|
*/
|
|
49
55
|
/**
|
|
50
56
|
* Block & Editor UI.
|
|
@@ -68,6 +74,9 @@
|
|
|
68
74
|
* Creates a fading overlay to signify that the content is longer
|
|
69
75
|
* than the space allows.
|
|
70
76
|
*/
|
|
77
|
+
/**
|
|
78
|
+
* Typography
|
|
79
|
+
*/
|
|
71
80
|
/**
|
|
72
81
|
* Breakpoint mixins
|
|
73
82
|
*/
|
package/build-style/style.css
CHANGED
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
/**
|
|
31
31
|
* Fonts & basic variables.
|
|
32
32
|
*/
|
|
33
|
+
/**
|
|
34
|
+
* Typography
|
|
35
|
+
*/
|
|
33
36
|
/**
|
|
34
37
|
* Grid System.
|
|
35
38
|
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
|
|
@@ -44,7 +47,10 @@
|
|
|
44
47
|
* Dimensions.
|
|
45
48
|
*/
|
|
46
49
|
/**
|
|
47
|
-
*
|
|
50
|
+
* Mobile specific styles
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* Editor styles.
|
|
48
54
|
*/
|
|
49
55
|
/**
|
|
50
56
|
* Block & Editor UI.
|
|
@@ -68,6 +74,9 @@
|
|
|
68
74
|
* Creates a fading overlay to signify that the content is longer
|
|
69
75
|
* than the space allows.
|
|
70
76
|
*/
|
|
77
|
+
/**
|
|
78
|
+
* Typography
|
|
79
|
+
*/
|
|
71
80
|
/**
|
|
72
81
|
* Breakpoint mixins
|
|
73
82
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/bindings/api.js"],"names":[],"mappings":"AAgBA;;;;;;;;;GASG;AACH,
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/bindings/api.js"],"names":[],"mappings":"AAgBA;;;;;;;;;GASG;AACH,yDAGC;AAED;;;;;;;;;;;GAWG;AACH,iEATW,MAAM,QAqBhB"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
declare namespace _default {
|
|
2
2
|
let name: string;
|
|
3
|
-
function getValues({
|
|
4
|
-
|
|
3
|
+
function getValues({ select, clientId, context, bindings }: {
|
|
4
|
+
select: any;
|
|
5
5
|
clientId: any;
|
|
6
6
|
context: any;
|
|
7
7
|
bindings: any;
|
|
8
8
|
}): {};
|
|
9
|
-
function setValues({
|
|
10
|
-
|
|
9
|
+
function setValues({ select, dispatch, clientId, bindings }: {
|
|
10
|
+
select: any;
|
|
11
|
+
dispatch: any;
|
|
11
12
|
clientId: any;
|
|
12
13
|
bindings: any;
|
|
13
14
|
}): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pattern-overrides.d.ts","sourceRoot":"","sources":["../../src/bindings/pattern-overrides.js"],"names":[],"mappings":";;IASC;;;;;WAwBC;IACD
|
|
1
|
+
{"version":3,"file":"pattern-overrides.d.ts","sourceRoot":"","sources":["../../src/bindings/pattern-overrides.js"],"names":[],"mappings":";;IASC;;;;;WAwBC;IACD;;;;;aA+DC;IACiB,qCAAU"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
declare namespace _default {
|
|
2
2
|
let name: string;
|
|
3
|
-
function getValues({
|
|
4
|
-
|
|
3
|
+
function getValues({ select, context, bindings }: {
|
|
4
|
+
select: any;
|
|
5
5
|
context: any;
|
|
6
6
|
bindings: any;
|
|
7
7
|
}): {};
|
|
8
|
-
function setValues({
|
|
9
|
-
|
|
8
|
+
function setValues({ dispatch, context, bindings }: {
|
|
9
|
+
dispatch: any;
|
|
10
10
|
context: any;
|
|
11
11
|
bindings: any;
|
|
12
12
|
}): void;
|
|
13
|
-
function canUserEditValue({
|
|
14
|
-
|
|
13
|
+
function canUserEditValue({ select, context, args }: {
|
|
14
|
+
select: any;
|
|
15
15
|
context: any;
|
|
16
16
|
args: any;
|
|
17
17
|
}): boolean;
|
|
18
|
-
function getFieldsList({
|
|
19
|
-
|
|
18
|
+
function getFieldsList({ select, context }: {
|
|
19
|
+
select: any;
|
|
20
20
|
context: any;
|
|
21
21
|
}): Object;
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-meta.d.ts","sourceRoot":"","sources":["../../src/bindings/post-meta.js"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"post-meta.d.ts","sourceRoot":"","sources":["../../src/bindings/post-meta.js"],"names":[],"mappings":";;IA2EC;;;;WAYC;IACD;;;;aAcC;IACD;;;;gBAsCC;IACD;;;eAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/document-tools/index.js"],"names":[],"mappings":";AA8BA;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/document-tools/index.js"],"names":[],"mappings":";AA8BA;;;gCA0JC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/header/index.js"],"names":[],"mappings":";AA2CA;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/header/index.js"],"names":[],"mappings":";AA2CA;;;;;;;gCA2IC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/inserter-sidebar/index.js"],"names":[],"mappings":"AAsBA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/inserter-sidebar/index.js"],"names":[],"mappings":"AAsBA,uEA0FC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disable-non-page-content-blocks.d.ts","sourceRoot":"","sources":["../../../src/components/provider/disable-non-page-content-blocks.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"disable-non-page-content-blocks.d.ts","sourceRoot":"","sources":["../../../src/components/provider/disable-non-page-content-blocks.js"],"names":[],"mappings":"AAYA;;;GAGG;AACH,4DAoDC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-post-content-blocks.d.ts","sourceRoot":"","sources":["../../../src/components/provider/use-post-content-blocks.js"],"names":[],"mappings":"AAmBA,oDAsBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resize-handle.d.ts","sourceRoot":"","sources":["../../../src/components/resizable-editor/resize-handle.js"],"names":[],"mappings":"AAaA;;;
|
|
1
|
+
{"version":3,"file":"resize-handle.d.ts","sourceRoot":"","sources":["../../../src/components/resizable-editor/resize-handle.js"],"names":[],"mappings":"AAaA;;;gCAqDC"}
|
|
@@ -170,19 +170,6 @@ export function setDeviceType(deviceType: string): Object;
|
|
|
170
170
|
* @return {Object} Action object.
|
|
171
171
|
*/
|
|
172
172
|
export function removeEditorPanel(panelName: string): Object;
|
|
173
|
-
/**
|
|
174
|
-
* Returns an action object used to open/close the inserter.
|
|
175
|
-
*
|
|
176
|
-
* @param {boolean|Object} value Whether the inserter should be
|
|
177
|
-
* opened (true) or closed (false).
|
|
178
|
-
* To specify an insertion point,
|
|
179
|
-
* use an object.
|
|
180
|
-
* @param {string} value.rootClientId The root client ID to insert at.
|
|
181
|
-
* @param {number} value.insertionIndex The index to insert at.
|
|
182
|
-
*
|
|
183
|
-
* @return {Object} Action object.
|
|
184
|
-
*/
|
|
185
|
-
export function setIsInserterOpened(value: boolean | Object): Object;
|
|
186
173
|
/**
|
|
187
174
|
* Returns an action object used to open/close the list view.
|
|
188
175
|
*
|
|
@@ -263,6 +250,7 @@ export function toggleEditorPanelEnabled(panelName: string): Object;
|
|
|
263
250
|
export function toggleEditorPanelOpened(panelName: string): ({ registry }: {
|
|
264
251
|
registry: any;
|
|
265
252
|
}) => void;
|
|
253
|
+
export function setIsInserterOpened(value: boolean | Object): Object;
|
|
266
254
|
export function toggleDistractionFree(): ({ dispatch, registry }: {
|
|
267
255
|
dispatch: any;
|
|
268
256
|
registry: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/store/actions.js"],"names":[],"mappings":"AA0EA;;;;;;;GAOG;AACH,gDAFY,MAAM,CAUjB;AAED;;;;;GAKG;AACH;;EAOC;AAED;;;;;;GAMG;AACH,8BAHY,MAAM,CAWjB;AAED;;;;;;GAMG;AACH,uCAFW,MAAM,UAQhB;AAED;;;;;;;GAOG;AACH,wCALW,MAAM,UACN,MAAM,GAEL,MAAM,CAQjB;AAiJD;;;;GAIG;AACH;;EAOC;AAqGD;;;;GAIG;AACH;;EAOC;AAED;;;;;GAKG;AACH,qCAHW,MAAM,GACL,MAAM,CAOjB;AAwBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,yCAxCW,MAAM,GAsCL,MAAM,CAOjB;AAED;;;;;;;;;;;;GAYG;AACH,2CAVW,MAAM,GAQL,MAAM,CAOjB;AAED;;;;;;;;;;;;GAYG;AACH,6CAVW,MAAM,GAQL,MAAM,CAOjB;AAED;;;;;;;;;;;;GAYG;AACH,+CAVW,MAAM,GAQL,MAAM,CAOjB;AA6CD;;;EAKC;AAyBD;;;;;;GAMG;AACH,0CAJW,MAAM,GAEL,MAAM,CAOjB;AAiED;;;;;;GAMG;AACH,6CAJW,MAAM,GAEL,MAAM,CAOjB;
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/store/actions.js"],"names":[],"mappings":"AA0EA;;;;;;;GAOG;AACH,gDAFY,MAAM,CAUjB;AAED;;;;;GAKG;AACH;;EAOC;AAED;;;;;;GAMG;AACH,8BAHY,MAAM,CAWjB;AAED;;;;;;GAMG;AACH,uCAFW,MAAM,UAQhB;AAED;;;;;;;GAOG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Bf;AA2CD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC"}
|
|
@@ -3,13 +3,13 @@ export function getInserterSidebarToggleRef(state: any): any;
|
|
|
3
3
|
export function getEntityActions(state: any, ...args: any[]): import("@wordpress/dataviews").Action<any>[];
|
|
4
4
|
export function isEntityReady(state: any, ...args: any[]): boolean;
|
|
5
5
|
/**
|
|
6
|
-
* Get the
|
|
6
|
+
* Get the inserter.
|
|
7
7
|
*
|
|
8
8
|
* @param {Object} state Global application state.
|
|
9
9
|
*
|
|
10
10
|
* @return {Object} The root client ID, index to insert at and starting filter value.
|
|
11
11
|
*/
|
|
12
|
-
export const
|
|
12
|
+
export const getInserter: Function;
|
|
13
13
|
export const getPostIcon: Function;
|
|
14
14
|
/**
|
|
15
15
|
* Returns true if there are unsaved changes to the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-selectors.d.ts","sourceRoot":"","sources":["../../src/store/private-selectors.js"],"names":[],"mappings":"AAkFA,sDAEC;AACD,6DAEC;AA8ED,2GAEC;AAED,mEAEC;AArID;;;;;;GAMG;AACH,
|
|
1
|
+
{"version":3,"file":"private-selectors.d.ts","sourceRoot":"","sources":["../../src/store/private-selectors.js"],"names":[],"mappings":"AAkFA,sDAEC;AACD,6DAEC;AA8ED,2GAEC;AAED,mEAEC;AArID;;;;;;GAMG;AACH,mCAmCE;AAeF,mCA6BE;AAEF;;;;;;;;;GASG;AACH,0CA2BE;AAUF;;;;;;;;GAQG;AACH,2CAsBE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.9.0",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -32,41 +32,41 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.16.0",
|
|
35
|
-
"@wordpress/a11y": "^4.
|
|
36
|
-
"@wordpress/api-fetch": "^7.
|
|
37
|
-
"@wordpress/blob": "^4.
|
|
38
|
-
"@wordpress/block-editor": "^14.
|
|
39
|
-
"@wordpress/blocks": "^13.
|
|
40
|
-
"@wordpress/commands": "^1.
|
|
41
|
-
"@wordpress/components": "^28.
|
|
42
|
-
"@wordpress/compose": "^7.
|
|
43
|
-
"@wordpress/core-data": "^7.
|
|
44
|
-
"@wordpress/data": "^10.
|
|
45
|
-
"@wordpress/dataviews": "^4.
|
|
46
|
-
"@wordpress/date": "^5.
|
|
47
|
-
"@wordpress/deprecated": "^4.
|
|
48
|
-
"@wordpress/dom": "^4.
|
|
49
|
-
"@wordpress/element": "^6.
|
|
50
|
-
"@wordpress/fields": "^0.0
|
|
51
|
-
"@wordpress/hooks": "^4.
|
|
52
|
-
"@wordpress/html-entities": "^4.
|
|
53
|
-
"@wordpress/i18n": "^5.
|
|
54
|
-
"@wordpress/icons": "^10.
|
|
55
|
-
"@wordpress/interface": "^6.
|
|
56
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
57
|
-
"@wordpress/keycodes": "^4.
|
|
58
|
-
"@wordpress/media-utils": "^5.
|
|
59
|
-
"@wordpress/notices": "^5.
|
|
60
|
-
"@wordpress/patterns": "^2.
|
|
61
|
-
"@wordpress/plugins": "^7.
|
|
62
|
-
"@wordpress/preferences": "^4.
|
|
63
|
-
"@wordpress/private-apis": "^1.
|
|
64
|
-
"@wordpress/reusable-blocks": "^5.
|
|
65
|
-
"@wordpress/rich-text": "^7.
|
|
66
|
-
"@wordpress/server-side-render": "^5.
|
|
67
|
-
"@wordpress/url": "^4.
|
|
68
|
-
"@wordpress/warning": "^3.
|
|
69
|
-
"@wordpress/wordcount": "^4.
|
|
35
|
+
"@wordpress/a11y": "^4.9.0",
|
|
36
|
+
"@wordpress/api-fetch": "^7.9.0",
|
|
37
|
+
"@wordpress/blob": "^4.9.0",
|
|
38
|
+
"@wordpress/block-editor": "^14.4.0",
|
|
39
|
+
"@wordpress/blocks": "^13.9.0",
|
|
40
|
+
"@wordpress/commands": "^1.9.0",
|
|
41
|
+
"@wordpress/components": "^28.9.0",
|
|
42
|
+
"@wordpress/compose": "^7.9.0",
|
|
43
|
+
"@wordpress/core-data": "^7.9.0",
|
|
44
|
+
"@wordpress/data": "^10.9.0",
|
|
45
|
+
"@wordpress/dataviews": "^4.5.0",
|
|
46
|
+
"@wordpress/date": "^5.9.0",
|
|
47
|
+
"@wordpress/deprecated": "^4.9.0",
|
|
48
|
+
"@wordpress/dom": "^4.9.0",
|
|
49
|
+
"@wordpress/element": "^6.9.0",
|
|
50
|
+
"@wordpress/fields": "^0.1.0",
|
|
51
|
+
"@wordpress/hooks": "^4.9.0",
|
|
52
|
+
"@wordpress/html-entities": "^4.9.0",
|
|
53
|
+
"@wordpress/i18n": "^5.9.0",
|
|
54
|
+
"@wordpress/icons": "^10.9.0",
|
|
55
|
+
"@wordpress/interface": "^6.9.0",
|
|
56
|
+
"@wordpress/keyboard-shortcuts": "^5.9.0",
|
|
57
|
+
"@wordpress/keycodes": "^4.9.0",
|
|
58
|
+
"@wordpress/media-utils": "^5.9.0",
|
|
59
|
+
"@wordpress/notices": "^5.9.0",
|
|
60
|
+
"@wordpress/patterns": "^2.9.0",
|
|
61
|
+
"@wordpress/plugins": "^7.9.0",
|
|
62
|
+
"@wordpress/preferences": "^4.9.0",
|
|
63
|
+
"@wordpress/private-apis": "^1.9.0",
|
|
64
|
+
"@wordpress/reusable-blocks": "^5.9.0",
|
|
65
|
+
"@wordpress/rich-text": "^7.9.0",
|
|
66
|
+
"@wordpress/server-side-render": "^5.9.0",
|
|
67
|
+
"@wordpress/url": "^4.9.0",
|
|
68
|
+
"@wordpress/warning": "^3.9.0",
|
|
69
|
+
"@wordpress/wordcount": "^4.9.0",
|
|
70
70
|
"change-case": "^4.1.2",
|
|
71
71
|
"client-zip": "^2.4.5",
|
|
72
72
|
"clsx": "^2.1.1",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "2e5495c635910cb34bfaca3c6258d2e989f66214"
|
|
90
90
|
}
|
package/src/bindings/api.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
privateApis as blocksPrivateApis,
|
|
6
5
|
store as blocksStore,
|
|
6
|
+
registerBlockBindingsSource,
|
|
7
7
|
} from '@wordpress/blocks';
|
|
8
8
|
import { dispatch } from '@wordpress/data';
|
|
9
9
|
|
|
@@ -25,7 +25,6 @@ import { unlock } from '../lock-unlock';
|
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
export function registerCoreBlockBindingsSources() {
|
|
28
|
-
const { registerBlockBindingsSource } = unlock( blocksPrivateApis );
|
|
29
28
|
registerBlockBindingsSource( patternOverrides );
|
|
30
29
|
registerBlockBindingsSource( postMeta );
|
|
31
30
|
}
|
|
@@ -7,9 +7,9 @@ const CONTENT = 'content';
|
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
9
|
name: 'core/pattern-overrides',
|
|
10
|
-
getValues( {
|
|
10
|
+
getValues( { select, clientId, context, bindings } ) {
|
|
11
11
|
const patternOverridesContent = context[ 'pattern/overrides' ];
|
|
12
|
-
const { getBlockAttributes } =
|
|
12
|
+
const { getBlockAttributes } = select( blockEditorStore );
|
|
13
13
|
const currentBlockAttributes = getBlockAttributes( clientId );
|
|
14
14
|
|
|
15
15
|
const overridesValues = {};
|
|
@@ -32,9 +32,9 @@ export default {
|
|
|
32
32
|
}
|
|
33
33
|
return overridesValues;
|
|
34
34
|
},
|
|
35
|
-
setValues( {
|
|
35
|
+
setValues( { select, dispatch, clientId, bindings } ) {
|
|
36
36
|
const { getBlockAttributes, getBlockParentsByBlockName, getBlocks } =
|
|
37
|
-
|
|
37
|
+
select( blockEditorStore );
|
|
38
38
|
const currentBlockAttributes = getBlockAttributes( clientId );
|
|
39
39
|
const blockName = currentBlockAttributes?.metadata?.name;
|
|
40
40
|
if ( ! blockName ) {
|
|
@@ -61,12 +61,10 @@ export default {
|
|
|
61
61
|
const syncBlocksWithSameName = ( blocks ) => {
|
|
62
62
|
for ( const block of blocks ) {
|
|
63
63
|
if ( block.attributes?.metadata?.name === blockName ) {
|
|
64
|
-
|
|
65
|
-
.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
attributes
|
|
69
|
-
);
|
|
64
|
+
dispatch( blockEditorStore ).updateBlockAttributes(
|
|
65
|
+
block.clientId,
|
|
66
|
+
attributes
|
|
67
|
+
);
|
|
70
68
|
}
|
|
71
69
|
syncBlocksWithSameName( block.innerBlocks );
|
|
72
70
|
}
|
|
@@ -77,27 +75,26 @@ export default {
|
|
|
77
75
|
}
|
|
78
76
|
const currentBindingValue =
|
|
79
77
|
getBlockAttributes( patternClientId )?.[ CONTENT ];
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
[ blockName ]
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
),
|
|
98
|
-
},
|
|
78
|
+
|
|
79
|
+
dispatch( blockEditorStore ).updateBlockAttributes( patternClientId, {
|
|
80
|
+
[ CONTENT ]: {
|
|
81
|
+
...currentBindingValue,
|
|
82
|
+
[ blockName ]: {
|
|
83
|
+
...currentBindingValue?.[ blockName ],
|
|
84
|
+
...Object.entries( attributes ).reduce(
|
|
85
|
+
( acc, [ key, value ] ) => {
|
|
86
|
+
// TODO: We need a way to represent `undefined` in the serialized overrides.
|
|
87
|
+
// Also see: https://github.com/WordPress/gutenberg/pull/57249#discussion_r1452987871
|
|
88
|
+
// We use an empty string to represent undefined for now until
|
|
89
|
+
// we support a richer format for overrides and the block bindings API.
|
|
90
|
+
acc[ key ] = value === undefined ? '' : value;
|
|
91
|
+
return acc;
|
|
92
|
+
},
|
|
93
|
+
{}
|
|
94
|
+
),
|
|
99
95
|
},
|
|
100
|
-
}
|
|
96
|
+
},
|
|
97
|
+
} );
|
|
101
98
|
},
|
|
102
99
|
canUserEditValue: () => true,
|
|
103
100
|
};
|
|
@@ -15,8 +15,8 @@ import { unlock } from '../lock-unlock';
|
|
|
15
15
|
* If the value is not available based on context, like in templates,
|
|
16
16
|
* it falls back to the default value, label, or key.
|
|
17
17
|
*
|
|
18
|
-
* @param {Object}
|
|
19
|
-
* @param {Object} context
|
|
18
|
+
* @param {Object} select The select function from the data store.
|
|
19
|
+
* @param {Object} context The context provided.
|
|
20
20
|
* @return {Object} List of post meta fields with their value and label.
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
@@ -34,11 +34,9 @@ import { unlock } from '../lock-unlock';
|
|
|
34
34
|
* }
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
function getPostMetaFields(
|
|
38
|
-
const { getEditedEntityRecord } =
|
|
39
|
-
const { getRegisteredPostMeta } = unlock(
|
|
40
|
-
registry.select( coreDataStore )
|
|
41
|
-
);
|
|
37
|
+
function getPostMetaFields( select, context ) {
|
|
38
|
+
const { getEditedEntityRecord } = select( coreDataStore );
|
|
39
|
+
const { getRegisteredPostMeta } = unlock( select( coreDataStore ) );
|
|
42
40
|
|
|
43
41
|
let entityMetaValues;
|
|
44
42
|
// Try to get the current entity meta values.
|
|
@@ -75,8 +73,8 @@ function getPostMetaFields( registry, context ) {
|
|
|
75
73
|
|
|
76
74
|
export default {
|
|
77
75
|
name: 'core/post-meta',
|
|
78
|
-
getValues( {
|
|
79
|
-
const metaFields = getPostMetaFields(
|
|
76
|
+
getValues( { select, context, bindings } ) {
|
|
77
|
+
const metaFields = getPostMetaFields( select, context );
|
|
80
78
|
|
|
81
79
|
const newValues = {};
|
|
82
80
|
for ( const [ attributeName, source ] of Object.entries( bindings ) ) {
|
|
@@ -88,61 +86,61 @@ export default {
|
|
|
88
86
|
}
|
|
89
87
|
return newValues;
|
|
90
88
|
},
|
|
91
|
-
setValues( {
|
|
89
|
+
setValues( { dispatch, context, bindings } ) {
|
|
92
90
|
const newMeta = {};
|
|
93
91
|
Object.values( bindings ).forEach( ( { args, newValue } ) => {
|
|
94
92
|
newMeta[ args.key ] = newValue;
|
|
95
93
|
} );
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
|
|
95
|
+
dispatch( coreDataStore ).editEntityRecord(
|
|
96
|
+
'postType',
|
|
97
|
+
context?.postType,
|
|
98
|
+
context?.postId,
|
|
99
|
+
{
|
|
99
100
|
meta: newMeta,
|
|
100
|
-
}
|
|
101
|
+
}
|
|
102
|
+
);
|
|
101
103
|
},
|
|
102
|
-
canUserEditValue( {
|
|
104
|
+
canUserEditValue( { select, context, args } ) {
|
|
103
105
|
// Lock editing in query loop.
|
|
104
106
|
if ( context?.query || context?.queryId ) {
|
|
105
107
|
return false;
|
|
106
108
|
}
|
|
107
109
|
|
|
108
110
|
const postType =
|
|
109
|
-
context?.postType ||
|
|
110
|
-
registry.select( editorStore ).getCurrentPostType();
|
|
111
|
+
context?.postType || select( editorStore ).getCurrentPostType();
|
|
111
112
|
|
|
112
113
|
// Check that editing is happening in the post editor and not a template.
|
|
113
114
|
if ( postType === 'wp_template' ) {
|
|
114
115
|
return false;
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
const fieldValue = getPostMetaFields(
|
|
118
|
+
const fieldValue = getPostMetaFields( select, context )?.[ args.key ]
|
|
118
119
|
?.value;
|
|
119
120
|
// Empty string or `false` could be a valid value, so we need to check if the field value is undefined.
|
|
120
121
|
if ( fieldValue === undefined ) {
|
|
121
122
|
return false;
|
|
122
123
|
}
|
|
123
124
|
// Check that custom fields metabox is not enabled.
|
|
124
|
-
const areCustomFieldsEnabled =
|
|
125
|
-
|
|
126
|
-
.getEditorSettings().enableCustomFields;
|
|
125
|
+
const areCustomFieldsEnabled =
|
|
126
|
+
select( editorStore ).getEditorSettings().enableCustomFields;
|
|
127
127
|
if ( areCustomFieldsEnabled ) {
|
|
128
128
|
return false;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
// Check that the user has the capability to edit post meta.
|
|
132
|
-
const canUserEdit =
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
id: context?.postId,
|
|
138
|
-
} );
|
|
132
|
+
const canUserEdit = select( coreDataStore ).canUser( 'update', {
|
|
133
|
+
kind: 'postType',
|
|
134
|
+
name: context?.postType,
|
|
135
|
+
id: context?.postId,
|
|
136
|
+
} );
|
|
139
137
|
if ( ! canUserEdit ) {
|
|
140
138
|
return false;
|
|
141
139
|
}
|
|
142
140
|
|
|
143
141
|
return true;
|
|
144
142
|
},
|
|
145
|
-
getFieldsList( {
|
|
146
|
-
return getPostMetaFields(
|
|
143
|
+
getFieldsList( { select, context } ) {
|
|
144
|
+
return getPostMetaFields( select, context );
|
|
147
145
|
},
|
|
148
146
|
};
|