@wordpress/editor 14.35.2-next.dc3f6d3c1.0 → 14.36.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 +1 -1
- package/build/bindings/post-data.js +15 -15
- package/build/bindings/post-data.js.map +2 -2
- package/build/bindings/term-data.js +97 -95
- package/build/bindings/term-data.js.map +2 -2
- package/build/components/collab-sidebar/comments.js +12 -4
- package/build/components/collab-sidebar/comments.js.map +2 -2
- package/build/components/collab-sidebar/hooks.js +9 -1
- package/build/components/collab-sidebar/hooks.js.map +2 -2
- package/build/components/global-styles/index.js +1 -1
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/post-schedule/panel.js +1 -7
- package/build/components/post-schedule/panel.js.map +2 -2
- package/build/components/post-status/index.js +1 -7
- package/build/components/post-status/index.js.map +2 -2
- package/build/components/post-template/block-theme.js +1 -1
- package/build/components/post-template/block-theme.js.map +2 -2
- package/build/components/post-template/hooks.js +1 -1
- package/build/components/post-template/hooks.js.map +2 -2
- package/build/components/provider/index.js +3 -1
- package/build/components/provider/index.js.map +2 -2
- package/build/components/visual-editor/index.js +1 -7
- package/build/components/visual-editor/index.js.map +2 -2
- package/build/components/visual-editor/use-edit-content-only-section-exit.js +5 -6
- package/build/components/visual-editor/use-edit-content-only-section-exit.js.map +2 -2
- package/build/dataviews/store/private-actions.js +5 -1
- package/build/dataviews/store/private-actions.js.map +2 -2
- package/build/hooks/template-part-navigation-edit-button.js +8 -11
- package/build/hooks/template-part-navigation-edit-button.js.map +3 -3
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +2 -2
- package/build/store/constants.js +8 -0
- package/build/store/constants.js.map +2 -2
- package/build-module/bindings/post-data.js +15 -15
- package/build-module/bindings/post-data.js.map +2 -2
- package/build-module/bindings/term-data.js +93 -95
- package/build-module/bindings/term-data.js.map +2 -2
- package/build-module/components/collab-sidebar/comments.js +12 -4
- package/build-module/components/collab-sidebar/comments.js.map +2 -2
- package/build-module/components/collab-sidebar/hooks.js +9 -1
- package/build-module/components/collab-sidebar/hooks.js.map +2 -2
- package/build-module/components/global-styles/index.js +1 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/post-schedule/panel.js +1 -12
- package/build-module/components/post-schedule/panel.js.map +2 -2
- package/build-module/components/post-status/index.js +1 -12
- package/build-module/components/post-status/index.js.map +2 -2
- package/build-module/components/post-template/block-theme.js +1 -1
- package/build-module/components/post-template/block-theme.js.map +2 -2
- package/build-module/components/post-template/hooks.js +1 -1
- package/build-module/components/post-template/hooks.js.map +2 -2
- package/build-module/components/provider/index.js +3 -1
- package/build-module/components/provider/index.js.map +2 -2
- package/build-module/components/visual-editor/index.js +2 -7
- package/build-module/components/visual-editor/index.js.map +2 -2
- package/build-module/components/visual-editor/use-edit-content-only-section-exit.js +5 -6
- package/build-module/components/visual-editor/use-edit-content-only-section-exit.js.map +2 -2
- package/build-module/dataviews/store/private-actions.js +5 -1
- package/build-module/dataviews/store/private-actions.js.map +2 -2
- package/build-module/hooks/template-part-navigation-edit-button.js +10 -17
- package/build-module/hooks/template-part-navigation-edit-button.js.map +2 -2
- package/build-module/store/actions.js +1 -1
- package/build-module/store/actions.js.map +2 -2
- package/build-module/store/constants.js +7 -0
- package/build-module/store/constants.js.map +2 -2
- package/build-style/style-rtl.css +263 -27
- package/build-style/style.css +263 -27
- package/build-types/bindings/post-data.d.ts +2 -1
- package/build-types/bindings/term-data.d.ts +86 -8
- package/build-types/bindings/term-data.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
- package/build-types/components/post-schedule/panel.d.ts.map +1 -1
- package/build-types/components/post-status/index.d.ts.map +1 -1
- package/build-types/components/post-template/block-theme.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/use-edit-content-only-section-exit.d.ts.map +1 -1
- package/build-types/dataviews/store/private-actions.d.ts +5 -0
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/constants.d.ts +1 -0
- package/build-types/store/constants.d.ts.map +1 -1
- package/package.json +40 -40
- package/src/bindings/post-data.js +21 -20
- package/src/bindings/term-data.js +124 -151
- package/src/bindings/test/post-data.js +31 -20
- package/src/bindings/test/term-data.js +406 -0
- package/src/components/collab-sidebar/comments.js +24 -16
- package/src/components/collab-sidebar/hooks.js +12 -1
- package/src/components/global-styles/index.js +1 -1
- package/src/components/post-schedule/panel.js +1 -13
- package/src/components/post-status/index.js +1 -13
- package/src/components/post-template/block-theme.js +4 -1
- package/src/components/post-template/hooks.js +1 -1
- package/src/components/provider/index.js +7 -2
- package/src/components/visual-editor/index.js +1 -6
- package/src/components/visual-editor/use-edit-content-only-section-exit.js +9 -10
- package/src/dataviews/store/private-actions.ts +17 -1
- package/src/hooks/template-part-navigation-edit-button.js +4 -15
- package/src/store/actions.js +2 -0
- package/src/store/constants.ts +6 -0
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -50,15 +50,12 @@ var postDataFields = [
|
|
|
50
50
|
var post_data_default = {
|
|
51
51
|
name: "core/post-data",
|
|
52
52
|
getValues({ select, context, bindings, clientId }) {
|
|
53
|
-
const allowedFields = postDataFields.map(
|
|
54
|
-
(field) => field.args.field
|
|
55
|
-
);
|
|
56
53
|
const { getBlockAttributes, getBlockName } = select(import_block_editor.store);
|
|
57
|
-
const blockName = getBlockName
|
|
54
|
+
const blockName = getBlockName(clientId);
|
|
58
55
|
const isNavigationBlock = NAVIGATION_BLOCK_TYPES.includes(blockName);
|
|
59
56
|
let postId, postType;
|
|
60
57
|
if (isNavigationBlock) {
|
|
61
|
-
const blockAttributes = getBlockAttributes
|
|
58
|
+
const blockAttributes = getBlockAttributes(clientId);
|
|
62
59
|
postId = blockAttributes?.id;
|
|
63
60
|
postType = blockAttributes?.type;
|
|
64
61
|
} else {
|
|
@@ -73,19 +70,22 @@ var post_data_default = {
|
|
|
73
70
|
);
|
|
74
71
|
const newValues = {};
|
|
75
72
|
for (const [attributeName, binding] of Object.entries(bindings)) {
|
|
76
|
-
|
|
77
|
-
newValues[attributeName] = {};
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
newValues[attributeName] = entityDataValues?.[binding.args.field] ?? postDataFields.find(
|
|
73
|
+
const postDataField = postDataFields.find(
|
|
81
74
|
(field) => field.args.field === binding.args.field
|
|
82
|
-
)
|
|
75
|
+
);
|
|
76
|
+
if (!postDataField) {
|
|
77
|
+
newValues[attributeName] = binding.args.field;
|
|
78
|
+
} else if (!entityDataValues) {
|
|
79
|
+
newValues[attributeName] = postDataField.label;
|
|
80
|
+
} else {
|
|
81
|
+
newValues[attributeName] = entityDataValues[binding.args.field];
|
|
82
|
+
}
|
|
83
83
|
}
|
|
84
84
|
return newValues;
|
|
85
85
|
},
|
|
86
86
|
setValues({ dispatch, context, bindings, clientId, select }) {
|
|
87
87
|
const { getBlockName } = select(import_block_editor.store);
|
|
88
|
-
const blockName = getBlockName
|
|
88
|
+
const blockName = getBlockName(clientId);
|
|
89
89
|
if (NAVIGATION_BLOCK_TYPES.includes(blockName)) {
|
|
90
90
|
return false;
|
|
91
91
|
}
|
|
@@ -103,7 +103,7 @@ var post_data_default = {
|
|
|
103
103
|
canUserEditValue({ select, context }) {
|
|
104
104
|
const { getBlockName, getSelectedBlockClientId } = select(import_block_editor.store);
|
|
105
105
|
const clientId = getSelectedBlockClientId();
|
|
106
|
-
const blockName = getBlockName
|
|
106
|
+
const blockName = getBlockName(clientId);
|
|
107
107
|
if (NAVIGATION_BLOCK_TYPES.includes(blockName)) {
|
|
108
108
|
return false;
|
|
109
109
|
}
|
|
@@ -123,12 +123,12 @@ var post_data_default = {
|
|
|
123
123
|
}
|
|
124
124
|
return true;
|
|
125
125
|
},
|
|
126
|
-
getFieldsList({ select }) {
|
|
126
|
+
getFieldsList({ context, select }) {
|
|
127
127
|
const selectedBlock = select(import_block_editor.store).getSelectedBlock();
|
|
128
128
|
if (selectedBlock?.name !== "core/post-date") {
|
|
129
129
|
return [];
|
|
130
130
|
}
|
|
131
|
-
if (
|
|
131
|
+
if (!context || !context.postId || !context.postType) {
|
|
132
132
|
return [];
|
|
133
133
|
}
|
|
134
134
|
return postDataFields;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/bindings/post-data.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n// Navigation block types that use special handling for backwards compatibility\nconst NAVIGATION_BLOCK_TYPES = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n];\n\nconst postDataFields = [\n\t{\n\t\tlabel: __( 'Post Date' ),\n\t\targs: { field: 'date' },\n\t\ttype: 'string',\n\t},\n\t{\n\t\tlabel: __( 'Post Modified Date' ),\n\t\targs: { field: 'modified' },\n\t\ttype: 'string',\n\t},\n\t{\n\t\tlabel: __( 'Post Link' ),\n\t\targs: { field: 'link' },\n\t\ttype: 'string',\n\t},\n];\n\n/**\n * @type {WPBlockBindingsSource}\n */\nexport default {\n\tname: 'core/post-data',\n\tgetValues( { select, context, bindings, clientId } ) {\n\t\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,uBAAuC;AACvC,0BAA0C;AAG1C,IAAM,yBAAyB;AAAA,EAC9B;AAAA,EACA;AACD;AAEA,IAAM,iBAAiB;AAAA,EACtB;AAAA,IACC,WAAO,gBAAI,WAAY;AAAA,IACvB,MAAM,EAAE,OAAO,OAAO;AAAA,IACtB,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,WAAO,gBAAI,oBAAqB;AAAA,IAChC,MAAM,EAAE,OAAO,WAAW;AAAA,IAC1B,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,WAAO,gBAAI,WAAY;AAAA,IACvB,MAAM,EAAE,OAAO,OAAO;AAAA,IACtB,MAAM;AAAA,EACP;AACD;AAKA,IAAO,oBAAQ;AAAA,EACd,MAAM;AAAA,EACN,UAAW,EAAE,QAAQ,SAAS,UAAU,SAAS,GAAI;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n// Navigation block types that use special handling for backwards compatibility\nconst NAVIGATION_BLOCK_TYPES = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n];\n\nconst postDataFields = [\n\t{\n\t\tlabel: __( 'Post Date' ),\n\t\targs: { field: 'date' },\n\t\ttype: 'string',\n\t},\n\t{\n\t\tlabel: __( 'Post Modified Date' ),\n\t\targs: { field: 'modified' },\n\t\ttype: 'string',\n\t},\n\t{\n\t\tlabel: __( 'Post Link' ),\n\t\targs: { field: 'link' },\n\t\ttype: 'string',\n\t},\n];\n\n/**\n * @type {WPBlockBindingsSource}\n */\nexport default {\n\tname: 'core/post-data',\n\tgetValues( { select, context, bindings, clientId } ) {\n\t\t/*\n\t\t * BACKWARDS COMPATIBILITY: Hardcoded exception for navigation blocks.\n\t\t * Required for WordPress 6.9+ navigation blocks. DO NOT REMOVE.\n\t\t */\n\t\tconst { getBlockAttributes, getBlockName } = select( blockEditorStore );\n\t\tconst blockName = getBlockName( clientId );\n\t\tconst isNavigationBlock = NAVIGATION_BLOCK_TYPES.includes( blockName );\n\n\t\tlet postId, postType;\n\n\t\tif ( isNavigationBlock ) {\n\t\t\t// Navigation blocks: read from block attributes\n\t\t\tconst blockAttributes = getBlockAttributes( clientId );\n\t\t\tpostId = blockAttributes?.id;\n\t\t\tpostType = blockAttributes?.type;\n\t\t} else {\n\t\t\t// All other blocks: use context\n\t\t\tpostId = context?.postId;\n\t\t\tpostType = context?.postType;\n\t\t}\n\n\t\tconst { getEditedEntityRecord } = select( coreDataStore );\n\t\tconst entityDataValues = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType,\n\t\t\tpostId\n\t\t);\n\n\t\tconst newValues = {};\n\t\tfor ( const [ attributeName, binding ] of Object.entries( bindings ) ) {\n\t\t\tconst postDataField = postDataFields.find(\n\t\t\t\t( field ) => field.args.field === binding.args.field\n\t\t\t);\n\n\t\t\tif ( ! postDataField ) {\n\t\t\t\t// If the field is unknown, return the field name.\n\t\t\t\tnewValues[ attributeName ] = binding.args.field;\n\t\t\t} else if ( ! entityDataValues ) {\n\t\t\t\t// If the entity data does not exist, return the field label.\n\t\t\t\tnewValues[ attributeName ] = postDataField.label;\n\t\t\t} else {\n\t\t\t\t// If the entity data exists, return the entity value.\n\t\t\t\tnewValues[ attributeName ] =\n\t\t\t\t\tentityDataValues[ binding.args.field ];\n\t\t\t}\n\t\t}\n\t\treturn newValues;\n\t},\n\tsetValues( { dispatch, context, bindings, clientId, select } ) {\n\t\tconst { getBlockName } = select( blockEditorStore );\n\n\t\tconst blockName = getBlockName( clientId );\n\n\t\t// Navigaton block types are read-only.\n\t\t// See https://github.com/WordPress/gutenberg/pull/72165.\n\t\tif ( NAVIGATION_BLOCK_TYPES.includes( blockName ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst newData = {};\n\t\tObject.values( bindings ).forEach( ( { args, newValue } ) => {\n\t\t\tnewData[ args.field ] = newValue;\n\t\t} );\n\n\t\tdispatch( coreDataStore ).editEntityRecord(\n\t\t\t'postType',\n\t\t\tcontext?.postType,\n\t\t\tcontext?.postId,\n\t\t\tnewData\n\t\t);\n\t},\n\tcanUserEditValue( { select, context } ) {\n\t\tconst { getBlockName, getSelectedBlockClientId } =\n\t\t\tselect( blockEditorStore );\n\t\tconst clientId = getSelectedBlockClientId();\n\t\tconst blockName = getBlockName( clientId );\n\n\t\t// Navigaton block types are read-only.\n\t\t// See https://github.com/WordPress/gutenberg/pull/72165.\n\t\tif ( NAVIGATION_BLOCK_TYPES.includes( blockName ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Lock editing in query loop.\n\t\tif ( context?.query || context?.queryId ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Lock editing when `postType` is not defined.\n\t\tif ( ! context?.postType ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check that the user has the capability to edit post data.\n\t\tconst canUserEdit = select( coreDataStore ).canUser( 'update', {\n\t\t\tkind: 'postType',\n\t\t\tname: context?.postType,\n\t\t\tid: context?.postId,\n\t\t} );\n\t\tif ( ! canUserEdit ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t},\n\tgetFieldsList( { context, select } ) {\n\t\tconst selectedBlock = select( blockEditorStore ).getSelectedBlock();\n\t\tif ( selectedBlock?.name !== 'core/post-date' ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tif ( ! context || ! context.postId || ! context.postType ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn postDataFields;\n\t},\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,uBAAuC;AACvC,0BAA0C;AAG1C,IAAM,yBAAyB;AAAA,EAC9B;AAAA,EACA;AACD;AAEA,IAAM,iBAAiB;AAAA,EACtB;AAAA,IACC,WAAO,gBAAI,WAAY;AAAA,IACvB,MAAM,EAAE,OAAO,OAAO;AAAA,IACtB,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,WAAO,gBAAI,oBAAqB;AAAA,IAChC,MAAM,EAAE,OAAO,WAAW;AAAA,IAC1B,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,WAAO,gBAAI,WAAY;AAAA,IACvB,MAAM,EAAE,OAAO,OAAO;AAAA,IACtB,MAAM;AAAA,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S,CAAE,EAAE,MAAM,SAAS,MAAO;AAC5D,cAAS,KAAK,KAAM,IAAI;AAAA,IACzB,CAAE;AAEF,aAAU,iBAAAC,KAAc,EAAE;AAAA,MACzB;AAAA,MACA,SAAS;AAAA,MACT,SAAS;AAAA,MACT;AAAA,IACD;AAAA,EACD;AAAA,EACA,iBAAkB,EAAE,QAAQ,QAAQ,GAAI;AACvC,UAAM,EAAE,cAAc,yBAAyB,IAC9C,OAAQ,oBAAAD,KAAiB;AAC1B,UAAM,WAAW,yBAAyB;AAC1C,UAAM,YAAY,aAAc,QAAS;AAIzC,QAAK,uBAAuB,SAAU,SAAU,GAAI;AACnD,aAAO;AAAA,IACR;AAGA,QAAK,SAAS,SAAS,SAAS,SAAU;AACzC,aAAO;AAAA,IACR;AAGA,QAAK,CAAE,SAAS,UAAW;AAC1B,aAAO;AAAA,IACR;AAGA,UAAM,cAAc,OAAQ,iBAAAC,KAAc,EAAE,QAAS,UAAU;AAAA,MAC9D,MAAM;AAAA,MACN,MAAM,SAAS;AAAA,MACf,IAAI,SAAS;AAAA,IACd,CAAE;AACF,QAAK,CAAE,aAAc;AACpB,aAAO;AAAA,IACR;AAEA,WAAO;AAAA,EACR;AAAA,EACA,cAAe,EAAE,SAAS,OAAO,GAAI;AACpC,UAAM,gBAAgB,OAAQ,oBAAAD,KAAiB,EAAE,iBAAiB;AAClE,QAAK,eAAe,SAAS,kBAAmB;AAC/C,aAAO,CAAC;AAAA,IACT;AAEA,QAAK,CAAE,WAAW,CAAE,QAAQ,UAAU,CAAE,QAAQ,UAAW;AAC1D,aAAO,CAAC;AAAA,IACT;AAEA,WAAO;AAAA,EACR;AACD;",
|
|
6
6
|
"names": ["blockEditorStore", "coreDataStore"]
|
|
7
7
|
}
|
|
@@ -20,7 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// packages/editor/src/bindings/term-data.js
|
|
21
21
|
var term_data_exports = {};
|
|
22
22
|
__export(term_data_exports, {
|
|
23
|
-
default: () => term_data_default
|
|
23
|
+
default: () => term_data_default,
|
|
24
|
+
termDataFields: () => termDataFields
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(term_data_exports);
|
|
26
27
|
var import_i18n = require("@wordpress/i18n");
|
|
@@ -30,91 +31,85 @@ var NAVIGATION_BLOCK_TYPES = [
|
|
|
30
31
|
"core/navigation-link",
|
|
31
32
|
"core/navigation-submenu"
|
|
32
33
|
];
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
type: "string"
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function getTermDataFields(select, context, clientId) {
|
|
73
|
-
const { getEntityRecord } = select(import_core_data.store);
|
|
74
|
-
const { getBlockAttributes, getBlockName } = select(import_block_editor.store);
|
|
75
|
-
let termDataValues, dataFields;
|
|
76
|
-
const blockName = getBlockName?.(clientId);
|
|
77
|
-
const isNavigationBlock = NAVIGATION_BLOCK_TYPES.includes(blockName);
|
|
78
|
-
let termId, taxonomy;
|
|
79
|
-
if (isNavigationBlock) {
|
|
80
|
-
const blockAttributes = getBlockAttributes?.(clientId);
|
|
81
|
-
termId = blockAttributes?.id;
|
|
82
|
-
const typeFromAttributes = blockAttributes?.type;
|
|
83
|
-
taxonomy = typeFromAttributes === "tag" ? "post_tag" : typeFromAttributes;
|
|
84
|
-
} else {
|
|
85
|
-
termId = context?.termId;
|
|
86
|
-
taxonomy = context?.taxonomy;
|
|
87
|
-
}
|
|
88
|
-
if (taxonomy && termId) {
|
|
89
|
-
termDataValues = getEntityRecord("taxonomy", taxonomy, termId);
|
|
90
|
-
if (!termDataValues && context?.termData) {
|
|
91
|
-
termDataValues = context.termData;
|
|
92
|
-
}
|
|
93
|
-
if (termDataValues) {
|
|
94
|
-
dataFields = createDataFields(termDataValues, termId);
|
|
95
|
-
}
|
|
96
|
-
} else if (context?.termData) {
|
|
97
|
-
termDataValues = context.termData;
|
|
98
|
-
dataFields = createDataFields(
|
|
99
|
-
termDataValues,
|
|
100
|
-
termDataValues?.term_id
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
if (!dataFields || !Object.keys(dataFields).length) {
|
|
104
|
-
return null;
|
|
34
|
+
var termDataFields = [
|
|
35
|
+
{
|
|
36
|
+
label: (0, import_i18n.__)("Term ID"),
|
|
37
|
+
args: { field: "id" },
|
|
38
|
+
type: "string"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
label: (0, import_i18n.__)("Name"),
|
|
42
|
+
args: { field: "name" },
|
|
43
|
+
type: "string"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: (0, import_i18n.__)("Slug"),
|
|
47
|
+
args: { field: "slug" },
|
|
48
|
+
type: "string"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: (0, import_i18n.__)("Link"),
|
|
52
|
+
args: { field: "link" },
|
|
53
|
+
type: "string"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
label: (0, import_i18n.__)("Description"),
|
|
57
|
+
args: { field: "description" },
|
|
58
|
+
type: "string"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: (0, import_i18n.__)("Parent ID"),
|
|
62
|
+
args: { field: "parent" },
|
|
63
|
+
type: "string"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
label: (0, import_i18n.__)("Count"),
|
|
67
|
+
args: { field: "count" },
|
|
68
|
+
type: "string"
|
|
105
69
|
}
|
|
106
|
-
|
|
107
|
-
}
|
|
70
|
+
];
|
|
108
71
|
var term_data_default = {
|
|
109
72
|
name: "core/term-data",
|
|
110
73
|
usesContext: ["taxonomy", "termId", "termData"],
|
|
111
74
|
getValues({ select, context, bindings, clientId }) {
|
|
112
|
-
const
|
|
75
|
+
const { getEntityRecord } = select(import_core_data.store);
|
|
76
|
+
const { getBlockAttributes, getBlockName } = select(import_block_editor.store);
|
|
77
|
+
const blockName = getBlockName(clientId);
|
|
78
|
+
const isNavigationBlock = NAVIGATION_BLOCK_TYPES.includes(blockName);
|
|
79
|
+
let termDataValues;
|
|
80
|
+
if (isNavigationBlock) {
|
|
81
|
+
const blockAttributes = getBlockAttributes(clientId);
|
|
82
|
+
const typeFromAttributes = blockAttributes?.type;
|
|
83
|
+
const taxonomy = typeFromAttributes === "tag" ? "post_tag" : typeFromAttributes;
|
|
84
|
+
termDataValues = getEntityRecord(
|
|
85
|
+
"taxonomy",
|
|
86
|
+
taxonomy,
|
|
87
|
+
blockAttributes?.id
|
|
88
|
+
);
|
|
89
|
+
} else if (context.termId && context.taxonomy) {
|
|
90
|
+
termDataValues = getEntityRecord(
|
|
91
|
+
"taxonomy",
|
|
92
|
+
context.taxonomy,
|
|
93
|
+
context.termId
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
if (!termDataValues && context?.termData && !isNavigationBlock) {
|
|
97
|
+
termDataValues = context.termData;
|
|
98
|
+
}
|
|
113
99
|
const newValues = {};
|
|
114
|
-
for (const [attributeName,
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
100
|
+
for (const [attributeName, binding] of Object.entries(bindings)) {
|
|
101
|
+
const termDataField = termDataFields.find(
|
|
102
|
+
(field) => field.args.field === binding.args.field
|
|
103
|
+
);
|
|
104
|
+
if (!termDataField) {
|
|
105
|
+
newValues[attributeName] = binding.args.field;
|
|
106
|
+
} else if (!termDataValues || termDataValues[binding.args.field] === void 0) {
|
|
107
|
+
newValues[attributeName] = termDataField.label;
|
|
108
|
+
} else if (binding.args.field === "count") {
|
|
109
|
+
newValues[attributeName] = "(" + termDataValues[binding.args.field] + ")";
|
|
110
|
+
} else {
|
|
111
|
+
newValues[attributeName] = termDataValues[binding.args.field];
|
|
112
|
+
}
|
|
118
113
|
}
|
|
119
114
|
return newValues;
|
|
120
115
|
},
|
|
@@ -122,10 +117,10 @@ var term_data_default = {
|
|
|
122
117
|
setValues({ dispatch, context, bindings }) {
|
|
123
118
|
return false;
|
|
124
119
|
},
|
|
125
|
-
canUserEditValue({ select, context
|
|
120
|
+
canUserEditValue({ select, context }) {
|
|
126
121
|
const { getBlockName, getSelectedBlockClientId } = select(import_block_editor.store);
|
|
127
122
|
const clientId = getSelectedBlockClientId();
|
|
128
|
-
const blockName = getBlockName
|
|
123
|
+
const blockName = getBlockName(clientId);
|
|
129
124
|
if (NAVIGATION_BLOCK_TYPES.includes(blockName)) {
|
|
130
125
|
return false;
|
|
131
126
|
}
|
|
@@ -135,23 +130,30 @@ var term_data_default = {
|
|
|
135
130
|
if (!context?.taxonomy || !context?.termId) {
|
|
136
131
|
return false;
|
|
137
132
|
}
|
|
138
|
-
const fieldValue = getTermDataFields(select, context, void 0)?.[args.field]?.value;
|
|
139
|
-
if (fieldValue === void 0) {
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
133
|
return false;
|
|
143
134
|
},
|
|
144
|
-
getFieldsList({
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
|
|
135
|
+
getFieldsList({ context, select }) {
|
|
136
|
+
const { getBlockAttributes, getBlockName, getSelectedBlockClientId } = select(import_block_editor.store);
|
|
137
|
+
const clientId = getSelectedBlockClientId();
|
|
138
|
+
const blockName = getBlockName(clientId);
|
|
139
|
+
if (NAVIGATION_BLOCK_TYPES.includes(blockName)) {
|
|
140
|
+
const blockAttributes = getBlockAttributes(clientId);
|
|
141
|
+
if (!blockAttributes || !blockAttributes.id || !blockAttributes.type) {
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
return termDataFields;
|
|
145
|
+
}
|
|
146
|
+
if (!context) {
|
|
148
147
|
return [];
|
|
149
148
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}));
|
|
149
|
+
if (context.taxonomy && context.termId || context.termData) {
|
|
150
|
+
return termDataFields;
|
|
151
|
+
}
|
|
152
|
+
return [];
|
|
155
153
|
}
|
|
156
154
|
};
|
|
155
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
156
|
+
0 && (module.exports = {
|
|
157
|
+
termDataFields
|
|
158
|
+
});
|
|
157
159
|
//# sourceMappingURL=term-data.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/bindings/term-data.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n// Navigation block types that use special handling for backwards compatibility\nconst NAVIGATION_BLOCK_TYPES = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n];\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,uBAAuC;AACvC,0BAA0C;AAG1C,IAAM,yBAAyB;AAAA,EAC9B;AAAA,EACA;AACD;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n// Navigation block types that use special handling for backwards compatibility\nconst NAVIGATION_BLOCK_TYPES = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n];\n\nexport const termDataFields = [\n\t{\n\t\tlabel: __( 'Term ID' ),\n\t\targs: { field: 'id' },\n\t\ttype: 'string',\n\t},\n\t{\n\t\tlabel: __( 'Name' ),\n\t\targs: { field: 'name' },\n\t\ttype: 'string',\n\t},\n\t{\n\t\tlabel: __( 'Slug' ),\n\t\targs: { field: 'slug' },\n\t\ttype: 'string',\n\t},\n\t{\n\t\tlabel: __( 'Link' ),\n\t\targs: { field: 'link' },\n\t\ttype: 'string',\n\t},\n\t{\n\t\tlabel: __( 'Description' ),\n\t\targs: { field: 'description' },\n\t\ttype: 'string',\n\t},\n\t{\n\t\tlabel: __( 'Parent ID' ),\n\t\targs: { field: 'parent' },\n\t\ttype: 'string',\n\t},\n\t{\n\t\tlabel: __( 'Count' ),\n\t\targs: { field: 'count' },\n\t\ttype: 'string',\n\t},\n];\n\n/**\n * @type {WPBlockBindingsSource}\n */\nexport default {\n\tname: 'core/term-data',\n\tusesContext: [ 'taxonomy', 'termId', 'termData' ],\n\tgetValues( { select, context, bindings, clientId } ) {\n\t\tconst { getEntityRecord } = select( coreDataStore );\n\n\t\t/*\n\t\t * BACKWARDS COMPATIBILITY: Hardcoded exception for navigation blocks.\n\t\t * Required for WordPress 6.9+ navigation blocks. DO NOT REMOVE.\n\t\t */\n\t\tconst { getBlockAttributes, getBlockName } = select( blockEditorStore );\n\t\tconst blockName = getBlockName( clientId );\n\t\tconst isNavigationBlock = NAVIGATION_BLOCK_TYPES.includes( blockName );\n\n\t\tlet termDataValues;\n\n\t\tif ( isNavigationBlock ) {\n\t\t\t// Navigation blocks: read from block attributes\n\t\t\tconst blockAttributes = getBlockAttributes( clientId );\n\t\t\tconst typeFromAttributes = blockAttributes?.type;\n\t\t\tconst taxonomy =\n\t\t\t\ttypeFromAttributes === 'tag' ? 'post_tag' : typeFromAttributes;\n\t\t\ttermDataValues = getEntityRecord(\n\t\t\t\t'taxonomy',\n\t\t\t\ttaxonomy,\n\t\t\t\tblockAttributes?.id\n\t\t\t);\n\t\t} else if ( context.termId && context.taxonomy ) {\n\t\t\t// All other blocks: use context\n\t\t\ttermDataValues = getEntityRecord(\n\t\t\t\t'taxonomy',\n\t\t\t\tcontext.taxonomy,\n\t\t\t\tcontext.termId\n\t\t\t);\n\t\t}\n\n\t\t// Fall back to context termData if available.\n\t\tif ( ! termDataValues && context?.termData && ! isNavigationBlock ) {\n\t\t\ttermDataValues = context.termData;\n\t\t}\n\n\t\tconst newValues = {};\n\t\tfor ( const [ attributeName, binding ] of Object.entries( bindings ) ) {\n\t\t\tconst termDataField = termDataFields.find(\n\t\t\t\t( field ) => field.args.field === binding.args.field\n\t\t\t);\n\n\t\t\tif ( ! termDataField ) {\n\t\t\t\t// If the field is unknown, return the field name.\n\t\t\t\tnewValues[ attributeName ] = binding.args.field;\n\t\t\t} else if (\n\t\t\t\t! termDataValues ||\n\t\t\t\ttermDataValues[ binding.args.field ] === undefined\n\t\t\t) {\n\t\t\t\t// If the term data does not exist, return the field label.\n\t\t\t\tnewValues[ attributeName ] = termDataField.label;\n\t\t\t} else if ( binding.args.field === 'count' ) {\n\t\t\t\t// Return the term count value in parentheses.\n\t\t\t\tnewValues[ attributeName ] =\n\t\t\t\t\t'(' + termDataValues[ binding.args.field ] + ')';\n\t\t\t} else {\n\t\t\t\t// If the term data exists, return the term data value.\n\t\t\t\tnewValues[ attributeName ] =\n\t\t\t\t\ttermDataValues[ binding.args.field ];\n\t\t\t}\n\t\t}\n\t\treturn newValues;\n\t},\n\t// eslint-disable-next-line no-unused-vars\n\tsetValues( { dispatch, context, bindings } ) {\n\t\t// Terms are typically not editable through block bindings in most contexts.\n\t\treturn false;\n\t},\n\tcanUserEditValue( { select, context } ) {\n\t\tconst { getBlockName, getSelectedBlockClientId } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst clientId = getSelectedBlockClientId();\n\t\tconst blockName = getBlockName( clientId );\n\n\t\t// Navigaton block types are read-only.\n\t\t// See https://github.com/WordPress/gutenberg/pull/72165.\n\t\tif ( NAVIGATION_BLOCK_TYPES.includes( blockName ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Terms are typically read-only when displayed.\n\t\tif ( context?.termQuery ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Lock editing when `taxonomy` or `termId` is not defined.\n\t\tif ( ! context?.taxonomy || ! context?.termId ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn false;\n\t},\n\tgetFieldsList( { context, select } ) {\n\t\tconst { getBlockAttributes, getBlockName, getSelectedBlockClientId } =\n\t\t\tselect( blockEditorStore );\n\t\tconst clientId = getSelectedBlockClientId();\n\t\tconst blockName = getBlockName( clientId );\n\n\t\tif ( NAVIGATION_BLOCK_TYPES.includes( blockName ) ) {\n\t\t\t// Navigation blocks: read from block attributes\n\t\t\tconst blockAttributes = getBlockAttributes( clientId );\n\t\t\tif (\n\t\t\t\t! blockAttributes ||\n\t\t\t\t! blockAttributes.id ||\n\t\t\t\t! blockAttributes.type\n\t\t\t) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\treturn termDataFields;\n\t\t}\n\n\t\tif ( ! context ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tif ( ( context.taxonomy && context.termId ) || context.termData ) {\n\t\t\treturn termDataFields;\n\t\t}\n\n\t\treturn [];\n\t},\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,uBAAuC;AACvC,0BAA0C;AAG1C,IAAM,yBAAyB;AAAA,EAC9B;AAAA,EACA;AACD;AAEO,IAAM,iBAAiB;AAAA,EAC7B;AAAA,IACC,WAAO,gBAAI,SAAU;AAAA,IACrB,MAAM,EAAE,OAAO,KAAK;AAAA,IACpB,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,WAAO,gBAAI,MAAO;AAAA,IAClB,MAAM,EAAE,OAAO,OAAO;AAAA,IACtB,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,WAAO,gBAAI,MAAO;AAAA,IACl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D,YAAM,kBAAkB,mBAAoB,QAAS;AACrD,UACC,CAAE,mBACF,CAAE,gBAAgB,MAClB,CAAE,gBAAgB,MACjB;AACD,eAAO,CAAC;AAAA,MACT;AACA,aAAO;AAAA,IACR;AAEA,QAAK,CAAE,SAAU;AAChB,aAAO,CAAC;AAAA,IACT;AAEA,QAAO,QAAQ,YAAY,QAAQ,UAAY,QAAQ,UAAW;AACjE,aAAO;AAAA,IACR;AAEA,WAAO,CAAC;AAAA,EACT;AACD;",
|
|
6
6
|
"names": ["coreDataStore", "blockEditorStore"]
|
|
7
7
|
}
|
|
@@ -73,17 +73,24 @@ function Comments({
|
|
|
73
73
|
const { selectBlock, toggleBlockSpotlight } = (0, import_lock_unlock.unlock)(
|
|
74
74
|
(0, import_data.useDispatch)(import_block_editor.store)
|
|
75
75
|
);
|
|
76
|
-
const {
|
|
76
|
+
const {
|
|
77
|
+
blockCommentId,
|
|
78
|
+
selectedBlockClientId,
|
|
79
|
+
orderedBlockIds,
|
|
80
|
+
blockMode
|
|
81
|
+
} = (0, import_data.useSelect)((select) => {
|
|
77
82
|
const {
|
|
78
83
|
getBlockAttributes,
|
|
79
84
|
getSelectedBlockClientId,
|
|
80
|
-
getClientIdsWithDescendants
|
|
85
|
+
getClientIdsWithDescendants,
|
|
86
|
+
getBlockMode
|
|
81
87
|
} = select(import_block_editor.store);
|
|
82
88
|
const clientId = getSelectedBlockClientId();
|
|
83
89
|
return {
|
|
84
90
|
blockCommentId: clientId ? getBlockAttributes(clientId)?.metadata?.noteId : null,
|
|
85
91
|
selectedBlockClientId: clientId,
|
|
86
|
-
orderedBlockIds: getClientIdsWithDescendants()
|
|
92
|
+
orderedBlockIds: getClientIdsWithDescendants(),
|
|
93
|
+
blockMode: clientId ? getBlockMode(clientId) : null
|
|
87
94
|
};
|
|
88
95
|
}, []);
|
|
89
96
|
const relatedBlockElement = useBlockElement(selectedBlockClientId);
|
|
@@ -236,7 +243,8 @@ function Comments({
|
|
|
236
243
|
isFloating,
|
|
237
244
|
threads,
|
|
238
245
|
selectedThread,
|
|
239
|
-
setCanvasMinHeight
|
|
246
|
+
setCanvasMinHeight,
|
|
247
|
+
blockMode
|
|
240
248
|
]);
|
|
241
249
|
const handleThreadNavigation = (event, thread, isSelected) => {
|
|
242
250
|
if (event.defaultPrevented) {
|