@wordpress/editor 14.35.1-next.16d95556a.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 +6 -0
- 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 +69 -18
- 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 +8 -8
- package/build/components/global-styles/index.js.map +2 -2
- package/build/components/post-featured-image/index.js +1 -32
- package/build/components/post-featured-image/index.js.map +3 -3
- 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/provider/use-block-editor-settings.js +9 -1
- package/build/components/provider/use-block-editor-settings.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/media-upload.js +89 -6
- package/build/hooks/media-upload.js.map +3 -3
- 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 +69 -18
- 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 +8 -8
- package/build-module/components/global-styles/index.js.map +2 -2
- package/build-module/components/post-featured-image/index.js +3 -35
- package/build-module/components/post-featured-image/index.js.map +2 -2
- 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/provider/use-block-editor-settings.js +9 -1
- package/build-module/components/provider/use-block-editor-settings.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/media-upload.js +67 -6
- package/build-module/hooks/media-upload.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 +309 -40
- package/build-style/style.css +309 -40
- 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/global-styles/index.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/provider/use-block-editor-settings.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 +210 -0
- package/src/bindings/test/term-data.js +406 -0
- package/src/components/collab-sidebar/comments.js +90 -24
- package/src/components/collab-sidebar/hooks.js +12 -1
- package/src/components/global-styles/index.js +8 -9
- package/src/components/global-styles-sidebar/style.scss +7 -0
- package/src/components/post-featured-image/index.js +1 -44
- 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/provider/use-block-editor-settings.js +8 -0
- 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/media-upload.js +75 -7
- 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
|
@@ -6,91 +6,85 @@ var NAVIGATION_BLOCK_TYPES = [
|
|
|
6
6
|
"core/navigation-link",
|
|
7
7
|
"core/navigation-submenu"
|
|
8
8
|
];
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
type: "string"
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function getTermDataFields(select, context, clientId) {
|
|
49
|
-
const { getEntityRecord } = select(coreDataStore);
|
|
50
|
-
const { getBlockAttributes, getBlockName } = select(blockEditorStore);
|
|
51
|
-
let termDataValues, dataFields;
|
|
52
|
-
const blockName = getBlockName?.(clientId);
|
|
53
|
-
const isNavigationBlock = NAVIGATION_BLOCK_TYPES.includes(blockName);
|
|
54
|
-
let termId, taxonomy;
|
|
55
|
-
if (isNavigationBlock) {
|
|
56
|
-
const blockAttributes = getBlockAttributes?.(clientId);
|
|
57
|
-
termId = blockAttributes?.id;
|
|
58
|
-
const typeFromAttributes = blockAttributes?.type;
|
|
59
|
-
taxonomy = typeFromAttributes === "tag" ? "post_tag" : typeFromAttributes;
|
|
60
|
-
} else {
|
|
61
|
-
termId = context?.termId;
|
|
62
|
-
taxonomy = context?.taxonomy;
|
|
63
|
-
}
|
|
64
|
-
if (taxonomy && termId) {
|
|
65
|
-
termDataValues = getEntityRecord("taxonomy", taxonomy, termId);
|
|
66
|
-
if (!termDataValues && context?.termData) {
|
|
67
|
-
termDataValues = context.termData;
|
|
68
|
-
}
|
|
69
|
-
if (termDataValues) {
|
|
70
|
-
dataFields = createDataFields(termDataValues, termId);
|
|
71
|
-
}
|
|
72
|
-
} else if (context?.termData) {
|
|
73
|
-
termDataValues = context.termData;
|
|
74
|
-
dataFields = createDataFields(
|
|
75
|
-
termDataValues,
|
|
76
|
-
termDataValues?.term_id
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
if (!dataFields || !Object.keys(dataFields).length) {
|
|
80
|
-
return null;
|
|
9
|
+
var termDataFields = [
|
|
10
|
+
{
|
|
11
|
+
label: __("Term ID"),
|
|
12
|
+
args: { field: "id" },
|
|
13
|
+
type: "string"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: __("Name"),
|
|
17
|
+
args: { field: "name" },
|
|
18
|
+
type: "string"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: __("Slug"),
|
|
22
|
+
args: { field: "slug" },
|
|
23
|
+
type: "string"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: __("Link"),
|
|
27
|
+
args: { field: "link" },
|
|
28
|
+
type: "string"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: __("Description"),
|
|
32
|
+
args: { field: "description" },
|
|
33
|
+
type: "string"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: __("Parent ID"),
|
|
37
|
+
args: { field: "parent" },
|
|
38
|
+
type: "string"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
label: __("Count"),
|
|
42
|
+
args: { field: "count" },
|
|
43
|
+
type: "string"
|
|
81
44
|
}
|
|
82
|
-
|
|
83
|
-
}
|
|
45
|
+
];
|
|
84
46
|
var term_data_default = {
|
|
85
47
|
name: "core/term-data",
|
|
86
48
|
usesContext: ["taxonomy", "termId", "termData"],
|
|
87
49
|
getValues({ select, context, bindings, clientId }) {
|
|
88
|
-
const
|
|
50
|
+
const { getEntityRecord } = select(coreDataStore);
|
|
51
|
+
const { getBlockAttributes, getBlockName } = select(blockEditorStore);
|
|
52
|
+
const blockName = getBlockName(clientId);
|
|
53
|
+
const isNavigationBlock = NAVIGATION_BLOCK_TYPES.includes(blockName);
|
|
54
|
+
let termDataValues;
|
|
55
|
+
if (isNavigationBlock) {
|
|
56
|
+
const blockAttributes = getBlockAttributes(clientId);
|
|
57
|
+
const typeFromAttributes = blockAttributes?.type;
|
|
58
|
+
const taxonomy = typeFromAttributes === "tag" ? "post_tag" : typeFromAttributes;
|
|
59
|
+
termDataValues = getEntityRecord(
|
|
60
|
+
"taxonomy",
|
|
61
|
+
taxonomy,
|
|
62
|
+
blockAttributes?.id
|
|
63
|
+
);
|
|
64
|
+
} else if (context.termId && context.taxonomy) {
|
|
65
|
+
termDataValues = getEntityRecord(
|
|
66
|
+
"taxonomy",
|
|
67
|
+
context.taxonomy,
|
|
68
|
+
context.termId
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
if (!termDataValues && context?.termData && !isNavigationBlock) {
|
|
72
|
+
termDataValues = context.termData;
|
|
73
|
+
}
|
|
89
74
|
const newValues = {};
|
|
90
|
-
for (const [attributeName,
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
75
|
+
for (const [attributeName, binding] of Object.entries(bindings)) {
|
|
76
|
+
const termDataField = termDataFields.find(
|
|
77
|
+
(field) => field.args.field === binding.args.field
|
|
78
|
+
);
|
|
79
|
+
if (!termDataField) {
|
|
80
|
+
newValues[attributeName] = binding.args.field;
|
|
81
|
+
} else if (!termDataValues || termDataValues[binding.args.field] === void 0) {
|
|
82
|
+
newValues[attributeName] = termDataField.label;
|
|
83
|
+
} else if (binding.args.field === "count") {
|
|
84
|
+
newValues[attributeName] = "(" + termDataValues[binding.args.field] + ")";
|
|
85
|
+
} else {
|
|
86
|
+
newValues[attributeName] = termDataValues[binding.args.field];
|
|
87
|
+
}
|
|
94
88
|
}
|
|
95
89
|
return newValues;
|
|
96
90
|
},
|
|
@@ -98,10 +92,10 @@ var term_data_default = {
|
|
|
98
92
|
setValues({ dispatch, context, bindings }) {
|
|
99
93
|
return false;
|
|
100
94
|
},
|
|
101
|
-
canUserEditValue({ select, context
|
|
95
|
+
canUserEditValue({ select, context }) {
|
|
102
96
|
const { getBlockName, getSelectedBlockClientId } = select(blockEditorStore);
|
|
103
97
|
const clientId = getSelectedBlockClientId();
|
|
104
|
-
const blockName = getBlockName
|
|
98
|
+
const blockName = getBlockName(clientId);
|
|
105
99
|
if (NAVIGATION_BLOCK_TYPES.includes(blockName)) {
|
|
106
100
|
return false;
|
|
107
101
|
}
|
|
@@ -111,26 +105,30 @@ var term_data_default = {
|
|
|
111
105
|
if (!context?.taxonomy || !context?.termId) {
|
|
112
106
|
return false;
|
|
113
107
|
}
|
|
114
|
-
const fieldValue = getTermDataFields(select, context, void 0)?.[args.field]?.value;
|
|
115
|
-
if (fieldValue === void 0) {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
108
|
return false;
|
|
119
109
|
},
|
|
120
|
-
getFieldsList({
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
|
|
110
|
+
getFieldsList({ context, select }) {
|
|
111
|
+
const { getBlockAttributes, getBlockName, getSelectedBlockClientId } = select(blockEditorStore);
|
|
112
|
+
const clientId = getSelectedBlockClientId();
|
|
113
|
+
const blockName = getBlockName(clientId);
|
|
114
|
+
if (NAVIGATION_BLOCK_TYPES.includes(blockName)) {
|
|
115
|
+
const blockAttributes = getBlockAttributes(clientId);
|
|
116
|
+
if (!blockAttributes || !blockAttributes.id || !blockAttributes.type) {
|
|
117
|
+
return [];
|
|
118
|
+
}
|
|
119
|
+
return termDataFields;
|
|
120
|
+
}
|
|
121
|
+
if (!context) {
|
|
124
122
|
return [];
|
|
125
123
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}));
|
|
124
|
+
if (context.taxonomy && context.termId || context.termData) {
|
|
125
|
+
return termDataFields;
|
|
126
|
+
}
|
|
127
|
+
return [];
|
|
131
128
|
}
|
|
132
129
|
};
|
|
133
130
|
export {
|
|
134
|
-
term_data_default as default
|
|
131
|
+
term_data_default as default,
|
|
132
|
+
termDataFields
|
|
135
133
|
};
|
|
136
134
|
//# 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": ";AAGA,SAAS,UAAU;AACnB,SAAS,SAAS,qBAAqB;AACvC,SAAS,SAAS,wBAAwB;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": ";AAGA,SAAS,UAAU;AACnB,SAAS,SAAS,qBAAqB;AACvC,SAAS,SAAS,wBAAwB;AAG1C,IAAM,yBAAyB;AAAA,EAC9B;AAAA,EACA;AACD;AAEO,IAAM,iBAAiB;AAAA,EAC7B;AAAA,IACC,OAAO,GAAI,SAAU;AAAA,IACrB,MAAM,EAAE,OAAO,KAAK;AAAA,IACpB,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,OAAO,GAAI,MAAO;AAAA,IAClB,MAAM,EAAE,OAAO,OAAO;AAAA,IACtB,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,OAAO,GAAI,MAAO;AAAA,IAClB,MAAM,EAAE,OAAO,OAAO;AAAA,IACtB,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,OAAO,GAAI,MAAO;AAAA,IAClB,MAAM,EAAE,OAAO,OAAO;AAAA,IACtB,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,OAAO,GAAI,aAAc;AAAA,IACzB,MAAM,EAAE,OAAO,cAAc;AAAA,IAC7B,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,OAAO,GAAI,WA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
}
|
|
@@ -56,17 +56,24 @@ function Comments({
|
|
|
56
56
|
const { selectBlock, toggleBlockSpotlight } = unlock(
|
|
57
57
|
useDispatch(blockEditorStore)
|
|
58
58
|
);
|
|
59
|
-
const {
|
|
59
|
+
const {
|
|
60
|
+
blockCommentId,
|
|
61
|
+
selectedBlockClientId,
|
|
62
|
+
orderedBlockIds,
|
|
63
|
+
blockMode
|
|
64
|
+
} = useSelect((select) => {
|
|
60
65
|
const {
|
|
61
66
|
getBlockAttributes,
|
|
62
67
|
getSelectedBlockClientId,
|
|
63
|
-
getClientIdsWithDescendants
|
|
68
|
+
getClientIdsWithDescendants,
|
|
69
|
+
getBlockMode
|
|
64
70
|
} = select(blockEditorStore);
|
|
65
71
|
const clientId = getSelectedBlockClientId();
|
|
66
72
|
return {
|
|
67
73
|
blockCommentId: clientId ? getBlockAttributes(clientId)?.metadata?.noteId : null,
|
|
68
74
|
selectedBlockClientId: clientId,
|
|
69
|
-
orderedBlockIds: getClientIdsWithDescendants()
|
|
75
|
+
orderedBlockIds: getClientIdsWithDescendants(),
|
|
76
|
+
blockMode: clientId ? getBlockMode(clientId) : null
|
|
70
77
|
};
|
|
71
78
|
}, []);
|
|
72
79
|
const relatedBlockElement = useBlockElement(selectedBlockClientId);
|
|
@@ -219,7 +226,8 @@ function Comments({
|
|
|
219
226
|
isFloating,
|
|
220
227
|
threads,
|
|
221
228
|
selectedThread,
|
|
222
|
-
setCanvasMinHeight
|
|
229
|
+
setCanvasMinHeight,
|
|
230
|
+
blockMode
|
|
223
231
|
]);
|
|
224
232
|
const handleThreadNavigation = (event, thread, isSelected) => {
|
|
225
233
|
if (event.defaultPrevented) {
|
|
@@ -341,18 +349,40 @@ function Thread({
|
|
|
341
349
|
selectedThread,
|
|
342
350
|
commentLastUpdated
|
|
343
351
|
});
|
|
352
|
+
const isKeyboardTabbingRef = useRef(false);
|
|
344
353
|
const onMouseEnter = () => {
|
|
345
354
|
debouncedToggleBlockHighlight(thread.blockClientId, true);
|
|
346
355
|
};
|
|
347
356
|
const onMouseLeave = () => {
|
|
348
357
|
debouncedToggleBlockHighlight(thread.blockClientId, false);
|
|
349
358
|
};
|
|
359
|
+
const onFocus = () => {
|
|
360
|
+
toggleBlockHighlight(thread.blockClientId, true);
|
|
361
|
+
};
|
|
362
|
+
const onBlur = (event) => {
|
|
363
|
+
const isNoteFocused = event.relatedTarget?.closest(
|
|
364
|
+
".editor-collab-sidebar-panel__thread"
|
|
365
|
+
);
|
|
366
|
+
const isDialogFocused = event.relatedTarget?.closest('[role="dialog"]');
|
|
367
|
+
const isTabbing = isKeyboardTabbingRef.current;
|
|
368
|
+
if (isNoteFocused && !isTabbing) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
if (isDialogFocused) {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
if (isTabbing && event.currentTarget.contains(event.relatedTarget)) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
toggleBlockHighlight(thread.blockClientId, false);
|
|
378
|
+
unselectThread();
|
|
379
|
+
};
|
|
350
380
|
const handleCommentSelect = () => {
|
|
351
381
|
setNewNoteFormState("closed");
|
|
352
382
|
setSelectedThread(thread.id);
|
|
383
|
+
toggleBlockSpotlight(thread.blockClientId, true);
|
|
353
384
|
if (!!thread.blockClientId) {
|
|
354
385
|
selectBlock(thread.blockClientId, null);
|
|
355
|
-
toggleBlockSpotlight(thread.blockClientId, true);
|
|
356
386
|
}
|
|
357
387
|
};
|
|
358
388
|
const unselectThread = () => {
|
|
@@ -403,9 +433,20 @@ function Thread({
|
|
|
403
433
|
onClick: handleCommentSelect,
|
|
404
434
|
onMouseEnter,
|
|
405
435
|
onMouseLeave,
|
|
406
|
-
onFocus
|
|
407
|
-
onBlur
|
|
408
|
-
|
|
436
|
+
onFocus,
|
|
437
|
+
onBlur,
|
|
438
|
+
onKeyUp: (event) => {
|
|
439
|
+
if (event.key === "Tab") {
|
|
440
|
+
isKeyboardTabbingRef.current = false;
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
onKeyDown: (event) => {
|
|
444
|
+
if (event.key === "Tab") {
|
|
445
|
+
isKeyboardTabbingRef.current = true;
|
|
446
|
+
} else {
|
|
447
|
+
onKeyDown(event);
|
|
448
|
+
}
|
|
449
|
+
},
|
|
409
450
|
tabIndex: 0,
|
|
410
451
|
role: "treeitem",
|
|
411
452
|
"aria-label": ariaLabel,
|
|
@@ -607,6 +648,12 @@ var CommentBoard = ({
|
|
|
607
648
|
];
|
|
608
649
|
const canResolve = thread.parent === 0;
|
|
609
650
|
const moreActions = parent?.status !== "approved" ? actions.filter((item) => item.isEligible(thread)) : [];
|
|
651
|
+
const deleteConfirmMessage = (
|
|
652
|
+
// When deleting a top level note, descendants will also be deleted.
|
|
653
|
+
thread.parent === 0 ? __(
|
|
654
|
+
"Are you sure you want to delete this note? This will also delete all of this note's replies."
|
|
655
|
+
) : __("Are you sure you want to delete this reply?")
|
|
656
|
+
);
|
|
610
657
|
return /* @__PURE__ */ jsxs(
|
|
611
658
|
VStack,
|
|
612
659
|
{
|
|
@@ -667,14 +714,20 @@ var CommentBoard = ({
|
|
|
667
714
|
)
|
|
668
715
|
}
|
|
669
716
|
),
|
|
670
|
-
/* @__PURE__ */ jsx(
|
|
671
|
-
Menu.
|
|
717
|
+
/* @__PURE__ */ jsx(
|
|
718
|
+
Menu.Popover,
|
|
672
719
|
{
|
|
673
|
-
|
|
674
|
-
children: /* @__PURE__ */ jsx(
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
720
|
+
modal: false,
|
|
721
|
+
children: moreActions.map((action) => /* @__PURE__ */ jsx(
|
|
722
|
+
Menu.Item,
|
|
723
|
+
{
|
|
724
|
+
onClick: () => action.onClick(),
|
|
725
|
+
children: /* @__PURE__ */ jsx(Menu.ItemLabel, { children: action.title })
|
|
726
|
+
},
|
|
727
|
+
action.id
|
|
728
|
+
))
|
|
729
|
+
}
|
|
730
|
+
)
|
|
678
731
|
] })
|
|
679
732
|
] })
|
|
680
733
|
}
|
|
@@ -733,9 +786,7 @@ var CommentBoard = ({
|
|
|
733
786
|
onConfirm: handleConfirmDelete,
|
|
734
787
|
onCancel: handleCancel,
|
|
735
788
|
confirmButtonText: __("Delete"),
|
|
736
|
-
children:
|
|
737
|
-
"Are you sure you want to delete this note? This will also delete all of this note's replies."
|
|
738
|
-
)
|
|
789
|
+
children: deleteConfirmMessage
|
|
739
790
|
}
|
|
740
791
|
)
|
|
741
792
|
]
|