@wordpress/editor 14.33.3-next.36001005c.0 → 14.33.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bindings/post-data.js +49 -72
- package/build/bindings/post-data.js.map +3 -3
- package/build/bindings/post-meta.js +46 -47
- package/build/bindings/post-meta.js.map +2 -2
- package/build/bindings/term-data.js +6 -16
- package/build/bindings/term-data.js.map +2 -2
- package/build/components/block-settings-menu/content-only-settings-menu.js +186 -0
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +7 -0
- package/build/components/collab-sidebar/add-comment.js +34 -7
- package/build/components/collab-sidebar/add-comment.js.map +3 -3
- package/build/components/collab-sidebar/comment-author-info.js +27 -15
- package/build/components/collab-sidebar/comment-author-info.js.map +2 -2
- package/build/components/collab-sidebar/comment-indicator-toolbar.js +15 -45
- package/build/components/collab-sidebar/comment-indicator-toolbar.js.map +3 -3
- package/build/components/collab-sidebar/comments.js +137 -35
- package/build/components/collab-sidebar/comments.js.map +3 -3
- package/build/components/collab-sidebar/hooks.js +8 -7
- package/build/components/collab-sidebar/hooks.js.map +2 -2
- package/build/components/collab-sidebar/index.js +56 -60
- package/build/components/collab-sidebar/index.js.map +3 -3
- package/build/components/editor/index.js +2 -0
- package/build/components/editor/index.js.map +3 -3
- package/build/components/header/index.js +0 -3
- package/build/components/header/index.js.map +3 -3
- package/build/components/more-menu/index.js +1 -1
- package/build/components/more-menu/index.js.map +2 -2
- package/build/components/post-template/hooks.js +7 -38
- 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 +3 -3
- package/build/components/visual-editor/index.js +20 -9
- package/build/components/visual-editor/index.js.map +2 -2
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +2 -2
- package/build/store/private-actions.js +8 -0
- package/build/store/private-actions.js.map +2 -2
- package/build/store/private-selectors.js +5 -0
- package/build/store/private-selectors.js.map +2 -2
- package/build/store/reducer.js +10 -0
- package/build/store/reducer.js.map +2 -2
- package/build-module/bindings/post-data.js +49 -72
- package/build-module/bindings/post-data.js.map +2 -2
- package/build-module/bindings/post-meta.js +46 -47
- package/build-module/bindings/post-meta.js.map +2 -2
- package/build-module/bindings/term-data.js +6 -16
- package/build-module/bindings/term-data.js.map +2 -2
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +161 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +7 -0
- package/build-module/components/collab-sidebar/add-comment.js +36 -9
- package/build-module/components/collab-sidebar/add-comment.js.map +2 -2
- package/build-module/components/collab-sidebar/comment-author-info.js +27 -15
- package/build-module/components/collab-sidebar/comment-author-info.js.map +2 -2
- package/build-module/components/collab-sidebar/comment-indicator-toolbar.js +21 -37
- package/build-module/components/collab-sidebar/comment-indicator-toolbar.js.map +2 -2
- package/build-module/components/collab-sidebar/comments.js +147 -38
- package/build-module/components/collab-sidebar/comments.js.map +2 -2
- package/build-module/components/collab-sidebar/hooks.js +8 -7
- package/build-module/components/collab-sidebar/hooks.js.map +2 -2
- package/build-module/components/collab-sidebar/index.js +56 -60
- package/build-module/components/collab-sidebar/index.js.map +2 -2
- package/build-module/components/editor/index.js +2 -0
- package/build-module/components/editor/index.js.map +2 -2
- package/build-module/components/header/index.js +0 -3
- package/build-module/components/header/index.js.map +2 -2
- package/build-module/components/more-menu/index.js +1 -1
- package/build-module/components/more-menu/index.js.map +2 -2
- package/build-module/components/post-template/hooks.js +7 -38
- 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 +20 -9
- package/build-module/components/visual-editor/index.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/private-actions.js +7 -0
- package/build-module/store/private-actions.js.map +2 -2
- package/build-module/store/private-selectors.js +4 -0
- package/build-module/store/private-selectors.js.map +2 -2
- package/build-module/store/reducer.js +9 -0
- package/build-module/store/reducer.js.map +2 -2
- package/build-style/style-rtl.css +18 -66
- package/build-style/style.css +18 -66
- package/build-types/bindings/post-data.d.ts +20 -20
- package/build-types/bindings/post-meta.d.ts +1 -14
- package/build-types/bindings/term-data.d.ts +6 -16
- package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts +2 -0
- package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/add-comment.d.ts +6 -1
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comment-author-info.d.ts +5 -16
- package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts +1 -2
- package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comments.d.ts +12 -26
- package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/hooks.d.ts +0 -1
- package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/index.d.ts +1 -4
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
- package/build-types/components/editor/index.d.ts.map +1 -1
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/post-template/hooks.d.ts +1 -1
- package/build-types/components/post-template/hooks.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/store/actions.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +7 -0
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +7 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +10 -0
- package/build-types/store/reducer.d.ts.map +1 -1
- package/package.json +38 -38
- package/src/bindings/post-data.js +65 -124
- package/src/bindings/post-meta.js +56 -58
- package/src/bindings/term-data.js +6 -21
- package/src/bindings/test/post-meta.js +211 -0
- package/src/components/block-settings-menu/content-only-settings-menu.js +185 -0
- package/src/components/block-settings-menu/content-only-settings-menu.native.js +4 -0
- package/src/components/block-settings-menu/style.scss +6 -0
- package/src/components/collab-sidebar/add-comment.js +41 -8
- package/src/components/collab-sidebar/comment-author-info.js +33 -26
- package/src/components/collab-sidebar/comment-indicator-toolbar.js +25 -51
- package/src/components/collab-sidebar/comments.js +147 -43
- package/src/components/collab-sidebar/hooks.js +9 -8
- package/src/components/collab-sidebar/index.js +58 -48
- package/src/components/collab-sidebar/style.scss +8 -69
- package/src/components/editor/index.js +2 -0
- package/src/components/editor-help/style.scss +1 -1
- package/src/components/header/index.js +0 -7
- package/src/components/more-menu/index.js +1 -1
- package/src/components/post-last-revision/style.scss +1 -1
- package/src/components/post-panel-row/style.scss +0 -1
- package/src/components/post-publish-panel/style.scss +1 -1
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -2
- package/src/components/post-template/hooks.js +10 -51
- package/src/components/provider/index.js +3 -4
- package/src/components/visual-editor/index.js +27 -6
- package/src/store/actions.js +4 -1
- package/src/store/private-actions.js +13 -0
- package/src/store/private-selectors.js +10 -0
- package/src/store/reducer.js +16 -0
- package/src/style.scss +1 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var content_only_settings_menu_exports = {};
|
|
30
|
+
__export(content_only_settings_menu_exports, {
|
|
31
|
+
default: () => ContentOnlySettingsMenu
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(content_only_settings_menu_exports);
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
36
|
+
var import_core_data = require("@wordpress/core-data");
|
|
37
|
+
var import_components = require("@wordpress/components");
|
|
38
|
+
var import_data = require("@wordpress/data");
|
|
39
|
+
var import_i18n = require("@wordpress/i18n");
|
|
40
|
+
var import_store = require("../../store");
|
|
41
|
+
var import_lock_unlock = require("../../lock-unlock");
|
|
42
|
+
var import_use_post_content_blocks = __toESM(require("../provider/use-post-content-blocks"));
|
|
43
|
+
function ContentOnlySettingsMenuItems({ clientId, onClose }) {
|
|
44
|
+
const postContentBlocks = (0, import_use_post_content_blocks.default)();
|
|
45
|
+
const { entity, onNavigateToEntityRecord, canEditTemplates } = (0, import_data.useSelect)(
|
|
46
|
+
(select) => {
|
|
47
|
+
const {
|
|
48
|
+
getBlockParentsByBlockName,
|
|
49
|
+
getSettings,
|
|
50
|
+
getBlockAttributes,
|
|
51
|
+
getBlockParents
|
|
52
|
+
} = select(import_block_editor.store);
|
|
53
|
+
const { getCurrentTemplateId, getRenderingMode } = select(import_store.store);
|
|
54
|
+
const patternParent = getBlockParentsByBlockName(
|
|
55
|
+
clientId,
|
|
56
|
+
"core/block",
|
|
57
|
+
true
|
|
58
|
+
)[0];
|
|
59
|
+
let record;
|
|
60
|
+
if (patternParent) {
|
|
61
|
+
record = select(import_core_data.store).getEntityRecord(
|
|
62
|
+
"postType",
|
|
63
|
+
"wp_block",
|
|
64
|
+
getBlockAttributes(patternParent).ref
|
|
65
|
+
);
|
|
66
|
+
} else if (getRenderingMode() === "template-locked" && !getBlockParents(clientId).some(
|
|
67
|
+
(parent) => postContentBlocks.includes(parent)
|
|
68
|
+
)) {
|
|
69
|
+
record = select(import_core_data.store).getEntityRecord(
|
|
70
|
+
"postType",
|
|
71
|
+
"wp_template",
|
|
72
|
+
getCurrentTemplateId()
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
if (!record) {
|
|
76
|
+
return {};
|
|
77
|
+
}
|
|
78
|
+
const _canEditTemplates = select(import_core_data.store).canUser("create", {
|
|
79
|
+
kind: "postType",
|
|
80
|
+
name: "wp_template"
|
|
81
|
+
});
|
|
82
|
+
return {
|
|
83
|
+
canEditTemplates: _canEditTemplates,
|
|
84
|
+
entity: record,
|
|
85
|
+
onNavigateToEntityRecord: getSettings().onNavigateToEntityRecord
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
[clientId, postContentBlocks]
|
|
89
|
+
);
|
|
90
|
+
if (!entity) {
|
|
91
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
92
|
+
TemplateLockContentOnlyMenuItems,
|
|
93
|
+
{
|
|
94
|
+
clientId,
|
|
95
|
+
onClose
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
const isPattern = entity.type === "wp_block";
|
|
100
|
+
let helpText = isPattern ? (0, import_i18n.__)(
|
|
101
|
+
"Edit the pattern to move, delete, or make further changes to this block."
|
|
102
|
+
) : (0, import_i18n.__)(
|
|
103
|
+
"Edit the template to move, delete, or make further changes to this block."
|
|
104
|
+
);
|
|
105
|
+
if (!canEditTemplates) {
|
|
106
|
+
helpText = (0, import_i18n.__)(
|
|
107
|
+
"Only users with permissions to edit the template can move or delete this block"
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
111
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.__unstableBlockSettingsMenuFirstItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
112
|
+
import_components.MenuItem,
|
|
113
|
+
{
|
|
114
|
+
onClick: () => {
|
|
115
|
+
onNavigateToEntityRecord({
|
|
116
|
+
postId: entity.id,
|
|
117
|
+
postType: entity.type
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
disabled: !canEditTemplates,
|
|
121
|
+
children: isPattern ? (0, import_i18n.__)("Edit pattern") : (0, import_i18n.__)("Edit template")
|
|
122
|
+
}
|
|
123
|
+
) }),
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
125
|
+
import_components.__experimentalText,
|
|
126
|
+
{
|
|
127
|
+
variant: "muted",
|
|
128
|
+
as: "p",
|
|
129
|
+
className: "editor-content-only-settings-menu__description",
|
|
130
|
+
children: helpText
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
] });
|
|
134
|
+
}
|
|
135
|
+
function TemplateLockContentOnlyMenuItems({ clientId, onClose }) {
|
|
136
|
+
const { contentLockingParent } = (0, import_data.useSelect)(
|
|
137
|
+
(select) => {
|
|
138
|
+
const { getContentLockingParent } = (0, import_lock_unlock.unlock)(
|
|
139
|
+
select(import_block_editor.store)
|
|
140
|
+
);
|
|
141
|
+
return {
|
|
142
|
+
contentLockingParent: getContentLockingParent(clientId)
|
|
143
|
+
};
|
|
144
|
+
},
|
|
145
|
+
[clientId]
|
|
146
|
+
);
|
|
147
|
+
const blockDisplayInformation = (0, import_block_editor.useBlockDisplayInformation)(contentLockingParent);
|
|
148
|
+
const blockEditorActions = (0, import_data.useDispatch)(import_block_editor.store);
|
|
149
|
+
if (!blockDisplayInformation?.title) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
const { modifyContentLockBlock } = (0, import_lock_unlock.unlock)(blockEditorActions);
|
|
153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
154
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.__unstableBlockSettingsMenuFirstItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
155
|
+
import_components.MenuItem,
|
|
156
|
+
{
|
|
157
|
+
onClick: () => {
|
|
158
|
+
modifyContentLockBlock(contentLockingParent);
|
|
159
|
+
onClose();
|
|
160
|
+
},
|
|
161
|
+
children: (0, import_i18n._x)("Unlock", "Unlock content locked blocks")
|
|
162
|
+
}
|
|
163
|
+
) }),
|
|
164
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
165
|
+
import_components.__experimentalText,
|
|
166
|
+
{
|
|
167
|
+
variant: "muted",
|
|
168
|
+
as: "p",
|
|
169
|
+
className: "editor-content-only-settings-menu__description",
|
|
170
|
+
children: (0, import_i18n.__)(
|
|
171
|
+
"Temporarily unlock the parent block to edit, delete or make further changes to this block."
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
] });
|
|
176
|
+
}
|
|
177
|
+
function ContentOnlySettingsMenu() {
|
|
178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockSettingsMenuControls, { children: ({ selectedClientIds, onClose }) => selectedClientIds.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
179
|
+
ContentOnlySettingsMenuItems,
|
|
180
|
+
{
|
|
181
|
+
clientId: selectedClientIds[0],
|
|
182
|
+
onClose
|
|
183
|
+
}
|
|
184
|
+
) });
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=content-only-settings-menu.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/block-settings-menu/content-only-settings-menu.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockSettingsMenuControls,\n\t__unstableBlockSettingsMenuFirstItem as BlockSettingsMenuFirstItem,\n\tstore as blockEditorStore,\n\tuseBlockDisplayInformation,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalText as Text, MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport usePostContentBlocks from '../provider/use-post-content-blocks';\n\nfunction ContentOnlySettingsMenuItems( { clientId, onClose } ) {\n\tconst postContentBlocks = usePostContentBlocks();\n\tconst { entity, onNavigateToEntityRecord, canEditTemplates } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetSettings,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockParents,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getCurrentTemplateId, getRenderingMode } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst patternParent = getBlockParentsByBlockName(\n\t\t\t\tclientId,\n\t\t\t\t'core/block',\n\t\t\t\ttrue\n\t\t\t)[ 0 ];\n\n\t\t\tlet record;\n\t\t\tif ( patternParent ) {\n\t\t\t\trecord = select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_block',\n\t\t\t\t\tgetBlockAttributes( patternParent ).ref\n\t\t\t\t);\n\t\t\t} else if (\n\t\t\t\tgetRenderingMode() === 'template-locked' &&\n\t\t\t\t! getBlockParents( clientId ).some( ( parent ) =>\n\t\t\t\t\tpostContentBlocks.includes( parent )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\trecord = select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template',\n\t\t\t\t\tgetCurrentTemplateId()\n\t\t\t\t);\n\t\t\t}\n\t\t\tif ( ! record ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst _canEditTemplates = select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} );\n\t\t\treturn {\n\t\t\t\tcanEditTemplates: _canEditTemplates,\n\t\t\t\tentity: record,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetSettings().onNavigateToEntityRecord,\n\t\t\t};\n\t\t},\n\t\t[ clientId, postContentBlocks ]\n\t);\n\n\tif ( ! entity ) {\n\t\treturn (\n\t\t\t<TemplateLockContentOnlyMenuItems\n\t\t\t\tclientId={ clientId }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst isPattern = entity.type === 'wp_block';\n\tlet helpText = isPattern\n\t\t? __(\n\t\t\t\t'Edit the pattern to move, delete, or make further changes to this block.'\n\t\t )\n\t\t: __(\n\t\t\t\t'Edit the template to move, delete, or make further changes to this block.'\n\t\t );\n\n\tif ( ! canEditTemplates ) {\n\t\thelpText = __(\n\t\t\t'Only users with permissions to edit the template can move or delete this block'\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockSettingsMenuFirstItem>\n\t\t\t\t<MenuItem\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\tpostId: entity.id,\n\t\t\t\t\t\t\tpostType: entity.type,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdisabled={ ! canEditTemplates }\n\t\t\t\t>\n\t\t\t\t\t{ isPattern ? __( 'Edit pattern' ) : __( 'Edit template' ) }\n\t\t\t\t</MenuItem>\n\t\t\t</BlockSettingsMenuFirstItem>\n\t\t\t<Text\n\t\t\t\tvariant=\"muted\"\n\t\t\t\tas=\"p\"\n\t\t\t\tclassName=\"editor-content-only-settings-menu__description\"\n\t\t\t>\n\t\t\t\t{ helpText }\n\t\t\t</Text>\n\t\t</>\n\t);\n}\n\nfunction TemplateLockContentOnlyMenuItems( { clientId, onClose } ) {\n\tconst { contentLockingParent } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getContentLockingParent } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tcontentLockingParent: getContentLockingParent( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst blockDisplayInformation =\n\t\tuseBlockDisplayInformation( contentLockingParent );\n\tconst blockEditorActions = useDispatch( blockEditorStore );\n\tif ( ! blockDisplayInformation?.title ) {\n\t\treturn null;\n\t}\n\n\tconst { modifyContentLockBlock } = unlock( blockEditorActions );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockSettingsMenuFirstItem>\n\t\t\t\t<MenuItem\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tmodifyContentLockBlock( contentLockingParent );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ _x( 'Unlock', 'Unlock content locked blocks' ) }\n\t\t\t\t</MenuItem>\n\t\t\t</BlockSettingsMenuFirstItem>\n\t\t\t<Text\n\t\t\t\tvariant=\"muted\"\n\t\t\t\tas=\"p\"\n\t\t\t\tclassName=\"editor-content-only-settings-menu__description\"\n\t\t\t>\n\t\t\t\t{ __(\n\t\t\t\t\t'Temporarily unlock the parent block to edit, delete or make further changes to this block.'\n\t\t\t\t) }\n\t\t\t</Text>\n\t\t</>\n\t);\n}\n\nexport default function ContentOnlySettingsMenu() {\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { selectedClientIds, onClose } ) =>\n\t\t\t\tselectedClientIds.length === 1 && (\n\t\t\t\t\t<ContentOnlySettingsMenuItems\n\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6EG;AA1EH,0BAKO;AACP,uBAAmC;AACnC,wBAAqD;AACrD,kBAAuC;AACvC,kBAAuB;AAKvB,mBAAqC;AACrC,yBAAuB;AACvB,qCAAiC;AAEjC,SAAS,6BAA8B,EAAE,UAAU,QAAQ,GAAI;AAC9D,QAAM,wBAAoB,+BAAAA,SAAqB;AAC/C,QAAM,EAAE,QAAQ,0BAA0B,iBAAiB,QAAI;AAAA,IAC9D,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,oBAAAC,KAAiB;AAC7B,YAAM,EAAE,sBAAsB,iBAAiB,IAC9C,OAAQ,aAAAC,KAAY;AACrB,YAAM,gBAAgB;AAAA,QACrB;AAAA,QACA;AAAA,QACA;AAAA,MACD,EAAG,CAAE;AAEL,UAAI;AACJ,UAAK,eAAgB;AACpB,iBAAS,OAAQ,iBAAAC,KAAU,EAAE;AAAA,UAC5B;AAAA,UACA;AAAA,UACA,mBAAoB,aAAc,EAAE;AAAA,QACrC;AAAA,MACD,WACC,iBAAiB,MAAM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E,UAAU,QAAQ,GAAI;AAClE,QAAM,EAAE,qBAAqB,QAAI;AAAA,IAChC,CAAE,WAAY;AACb,YAAM,EAAE,wBAAwB,QAAI;AAAA,QACnC,OAAQ,oBAAAJ,KAAiB;AAAA,MAC1B;AACA,aAAO;AAAA,QACN,sBAAsB,wBAAyB,QAAS;AAAA,MACzD;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AACA,QAAM,8BACL,gDAA4B,oBAAqB;AAClD,QAAM,yBAAqB,yBAAa,oBAAAA,KAAiB;AACzD,MAAK,CAAE,yBAAyB,OAAQ;AACvC,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,uBAAuB,QAAI,2BAAQ,kBAAmB;AAE9D,SACC,4EACC;AAAA,gDAAC,oBAAAG,sCAAA,EACA;AAAA,MAAC;AAAA;AAAA,QACA,SAAU,MAAM;AACf,iCAAwB,oBAAqB;AAC7C,kBAAQ;AAAA,QACT;AAAA,QAEE,8BAAI,UAAU,8BAA+B;AAAA;AAAA,IAChD,GACD;AAAA,IACA;AAAA,MAAC,kBAAAC;AAAA,MAAA;AAAA,QACA,SAAQ;AAAA,QACR,IAAG;AAAA,QACH,WAAU;AAAA,QAER;AAAA,UACD;AAAA,QACD;AAAA;AAAA,IACD;AAAA,KACD;AAEF;AAEe,SAAR,0BAA2C;AACjD,SACC,4CAAC,iDACE,WAAE,EAAE,mBAAmB,QAAQ,MAChC,kBAAkB,WAAW,KAC5B;AAAA,IAAC;AAAA;AAAA,MACA,UAAW,kBAAmB,CAAE;AAAA,MAChC;AAAA;AAAA,EACD,GAGH;AAEF;",
|
|
6
|
+
"names": ["usePostContentBlocks", "blockEditorStore", "editorStore", "coreStore", "BlockSettingsMenuFirstItem", "Text"]
|
|
7
|
+
}
|
|
@@ -32,6 +32,7 @@ __export(add_comment_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(add_comment_exports);
|
|
34
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var import_clsx = __toESM(require("clsx"));
|
|
35
36
|
var import_i18n = require("@wordpress/i18n");
|
|
36
37
|
var import_data = require("@wordpress/data");
|
|
37
38
|
var import_components = require("@wordpress/components");
|
|
@@ -45,7 +46,11 @@ function AddComment({
|
|
|
45
46
|
onSubmit,
|
|
46
47
|
showCommentBoard,
|
|
47
48
|
setShowCommentBoard,
|
|
48
|
-
commentSidebarRef
|
|
49
|
+
commentSidebarRef,
|
|
50
|
+
reflowComments = import_utils.noop,
|
|
51
|
+
isFloating = false,
|
|
52
|
+
y,
|
|
53
|
+
refs
|
|
49
54
|
}) {
|
|
50
55
|
const { clientId, blockCommentId } = (0, import_data.useSelect)((select) => {
|
|
51
56
|
const { getSelectedBlock } = select(import_block_editor.store);
|
|
@@ -56,16 +61,40 @@ function AddComment({
|
|
|
56
61
|
};
|
|
57
62
|
}, []);
|
|
58
63
|
const blockElement = useBlockElement(clientId);
|
|
64
|
+
const { toggleBlockSpotlight } = (0, import_lock_unlock.unlock)((0, import_data.useDispatch)(import_block_editor.store));
|
|
65
|
+
const unselectThread = () => {
|
|
66
|
+
setShowCommentBoard(false);
|
|
67
|
+
blockElement?.focus();
|
|
68
|
+
toggleBlockSpotlight(clientId, false);
|
|
69
|
+
};
|
|
59
70
|
if (!showCommentBoard || !clientId || void 0 !== blockCommentId) {
|
|
60
71
|
return null;
|
|
61
72
|
}
|
|
62
73
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
63
74
|
import_components.__experimentalVStack,
|
|
64
75
|
{
|
|
65
|
-
className:
|
|
76
|
+
className: (0, import_clsx.default)(
|
|
77
|
+
"editor-collab-sidebar-panel__thread is-selected",
|
|
78
|
+
{
|
|
79
|
+
"is-floating": isFloating
|
|
80
|
+
}
|
|
81
|
+
),
|
|
66
82
|
spacing: "3",
|
|
67
83
|
tabIndex: 0,
|
|
84
|
+
"aria-label": (0, import_i18n.__)("New note"),
|
|
68
85
|
role: "listitem",
|
|
86
|
+
ref: isFloating ? refs.setFloating : void 0,
|
|
87
|
+
style: isFloating ? (
|
|
88
|
+
// Delay showing the floating note box until a Y position is known to prevent blink.
|
|
89
|
+
{ top: y, opacity: !y ? 0 : void 0 }
|
|
90
|
+
) : void 0,
|
|
91
|
+
onBlur: (event) => {
|
|
92
|
+
if (event.currentTarget.contains(event.relatedTarget)) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
toggleBlockSpotlight(clientId, false);
|
|
96
|
+
setShowCommentBoard(false);
|
|
97
|
+
},
|
|
69
98
|
children: [
|
|
70
99
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalHStack, { alignment: "left", spacing: "3", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_comment_author_info.default, {}) }),
|
|
71
100
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -76,12 +105,10 @@ function AddComment({
|
|
|
76
105
|
(0, import_utils.focusCommentThread)(id, commentSidebarRef.current);
|
|
77
106
|
setShowCommentBoard(false);
|
|
78
107
|
},
|
|
79
|
-
onCancel:
|
|
80
|
-
|
|
81
|
-
blockElement?.focus();
|
|
82
|
-
},
|
|
108
|
+
onCancel: unselectThread,
|
|
109
|
+
reflowComments,
|
|
83
110
|
submitButtonText: (0, import_i18n.__)("Add note"),
|
|
84
|
-
labelText: (0, import_i18n.__)("New
|
|
111
|
+
labelText: (0, import_i18n.__)("New note")
|
|
85
112
|
}
|
|
86
113
|
)
|
|
87
114
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collab-sidebar/add-comment.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport CommentAuthorInfo from './comment-author-info';\nimport CommentForm from './comment-form';\nimport { focusCommentThread } from './utils';\n\nconst { useBlockElement } = unlock( blockEditorPrivateApis );\n\nexport function AddComment( {\n\tonSubmit,\n\tshowCommentBoard,\n\tsetShowCommentBoard,\n\tcommentSidebarRef,\n} ) {\n\tconst { clientId, blockCommentId } = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock } = select( blockEditorStore );\n\t\tconst selectedBlock = getSelectedBlock();\n\t\treturn {\n\t\t\tclientId: selectedBlock?.clientId,\n\t\t\tblockCommentId: selectedBlock?.attributes?.metadata?.noteId,\n\t\t};\n\t}, [] );\n\tconst blockElement = useBlockElement( clientId );\n\n\tif ( ! showCommentBoard || ! clientId || undefined !== blockCommentId ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack\n\t\t\tclassName
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
6
|
-
"names": ["blockEditorPrivateApis", "blockEditorStore", "VStack", "HStack", "CommentAuthorInfo", "CommentForm"]
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport CommentAuthorInfo from './comment-author-info';\nimport CommentForm from './comment-form';\nimport { focusCommentThread, noop } from './utils';\n\nconst { useBlockElement } = unlock( blockEditorPrivateApis );\n\nexport function AddComment( {\n\tonSubmit,\n\tshowCommentBoard,\n\tsetShowCommentBoard,\n\tcommentSidebarRef,\n\treflowComments = noop,\n\tisFloating = false,\n\ty,\n\trefs,\n} ) {\n\tconst { clientId, blockCommentId } = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock } = select( blockEditorStore );\n\t\tconst selectedBlock = getSelectedBlock();\n\t\treturn {\n\t\t\tclientId: selectedBlock?.clientId,\n\t\t\tblockCommentId: selectedBlock?.attributes?.metadata?.noteId,\n\t\t};\n\t}, [] );\n\tconst blockElement = useBlockElement( clientId );\n\tconst { toggleBlockSpotlight } = unlock( useDispatch( blockEditorStore ) );\n\n\tconst unselectThread = () => {\n\t\tsetShowCommentBoard( false );\n\t\tblockElement?.focus();\n\t\ttoggleBlockSpotlight( clientId, false );\n\t};\n\n\tif ( ! showCommentBoard || ! clientId || undefined !== blockCommentId ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-collab-sidebar-panel__thread is-selected',\n\t\t\t\t{\n\t\t\t\t\t'is-floating': isFloating,\n\t\t\t\t}\n\t\t\t) }\n\t\t\tspacing=\"3\"\n\t\t\ttabIndex={ 0 }\n\t\t\taria-label={ __( 'New note' ) }\n\t\t\trole=\"listitem\"\n\t\t\tref={ isFloating ? refs.setFloating : undefined }\n\t\t\tstyle={\n\t\t\t\tisFloating\n\t\t\t\t\t? // Delay showing the floating note box until a Y position is known to prevent blink.\n\t\t\t\t\t { top: y, opacity: ! y ? 0 : undefined }\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tonBlur={ ( event ) => {\n\t\t\t\tif ( event.currentTarget.contains( event.relatedTarget ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\ttoggleBlockSpotlight( clientId, false );\n\t\t\t\tsetShowCommentBoard( false );\n\t\t\t} }\n\t\t>\n\t\t\t<HStack alignment=\"left\" spacing=\"3\">\n\t\t\t\t<CommentAuthorInfo />\n\t\t\t</HStack>\n\t\t\t<CommentForm\n\t\t\t\tonSubmit={ async ( inputComment ) => {\n\t\t\t\t\tconst { id } = await onSubmit( { content: inputComment } );\n\t\t\t\t\tfocusCommentThread( id, commentSidebarRef.current );\n\t\t\t\t\tsetShowCommentBoard( false );\n\t\t\t\t} }\n\t\t\t\tonCancel={ unselectThread }\n\t\t\t\treflowComments={ reflowComments }\n\t\t\t\tsubmitButtonText={ __( 'Add note' ) }\n\t\t\t\tlabelText={ __( 'New note' ) }\n\t\t\t/>\n\t\t</VStack>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4DE;AAzDF,kBAAiB;AAIjB,kBAAmB;AACnB,kBAAuC;AACvC,wBAGO;AACP,0BAGO;AAKP,yBAAuB;AACvB,iCAA8B;AAC9B,0BAAwB;AACxB,mBAAyC;AAEzC,MAAM,EAAE,gBAAgB,QAAI,2BAAQ,oBAAAA,WAAuB;AAEpD,SAAS,WAAY;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,UAAU,eAAe,QAAI,uBAAW,CAAE,WAAY;AAC7D,UAAM,EAAE,iBAAiB,IAAI,OAAQ,oBAAAC,KAAiB;AACtD,UAAM,gBAAgB,iBAAiB;AACvC,WAAO;AAAA,MACN,UAAU,eAAe;AAAA,MACzB,gBAAgB,eAAe,YAAY,UAAU;AAAA,IACtD;AAAA,EACD,GAAG,CAAC,CAAE;AACN,QAAM,eAAe,gBAAiB,QAAS;AAC/C,QAAM,EAAE,qBAAqB,QAAI,+BAAQ,yBAAa,oBAAAA,KAAiB,CAAE;AAEzE,QAAM,iBAAiB,MAAM;AAC5B,wBAAqB,KAAM;AAC3B,kBAAc,MAAM;AACpB,yBAAsB,UAAU,KAAM;AAAA,EACvC;AAEA,MAAK,CAAE,oBAAoB,CAAE,YAAY,WAAc,gBAAiB;AACvE,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC,kBAAAC;AAAA,IAAA;AAAA,MACA,eAAY,YAAAC;AAAA,QACX;AAAA,QACA;AAAA,UACC,eAAe;AAAA,QAChB;AAAA,MACD;AAAA,MACA,SAAQ;AAAA,MACR,UAAW;AAAA,MACX,kBAAa,gBAAI,UAAW;AAAA,MAC5B,MAAK;AAAA,MACL,KAAM,aAAa,KAAK,cAAc;AAAA,MACtC,OACC;AAAA;AAAA,QAEG,EAAE,KAAK,GAAG,SAAS,CAAE,IAAI,IAAI,OAAU;AAAA,UACvC;AAAA,MAEJ,QAAS,CAAE,UAAW;AACrB,YAAK,MAAM,cAAc,SAAU,MAAM,aAAc,GAAI;AAC1D;AAAA,QACD;AACA,6BAAsB,UAAU,KAAM;AACtC,4BAAqB,KAAM;AAAA,MAC5B;AAAA,MAEA;AAAA,oDAAC,kBAAAC,sBAAA,EAAO,WAAU,QAAO,SAAQ,KAChC,sDAAC,2BAAAC,SAAA,EAAkB,GACpB;AAAA,QACA;AAAA,UAAC,oBAAAC;AAAA,UAAA;AAAA,YACA,UAAW,OAAQ,iBAAkB;AACpC,oBAAM,EAAE,GAAG,IAAI,MAAM,SAAU,EAAE,SAAS,aAAa,CAAE;AACzD,mDAAoB,IAAI,kBAAkB,OAAQ;AAClD,kCAAqB,KAAM;AAAA,YAC5B;AAAA,YACA,UAAW;AAAA,YACX;AAAA,YACA,sBAAmB,gBAAI,UAAW;AAAA,YAClC,eAAY,gBAAI,UAAW;AAAA;AAAA,QAC5B;AAAA;AAAA;AAAA,EACD;AAEF;",
|
|
6
|
+
"names": ["blockEditorPrivateApis", "blockEditorStore", "VStack", "clsx", "HStack", "CommentAuthorInfo", "CommentForm"]
|
|
7
7
|
}
|
|
@@ -30,26 +30,38 @@ var import_data = require("@wordpress/data");
|
|
|
30
30
|
var import_block_editor = require("@wordpress/block-editor");
|
|
31
31
|
var import_utils = require("./utils");
|
|
32
32
|
function CommentAuthorInfo({ avatar, name, date, userId }) {
|
|
33
|
+
const hasAvatar = !!avatar;
|
|
33
34
|
const dateSettings = (0, import_date.getSettings)();
|
|
34
35
|
const {
|
|
35
36
|
currentUserAvatar,
|
|
36
37
|
currentUserName,
|
|
37
38
|
currentUserId,
|
|
38
39
|
dateFormat = dateSettings.formats.date
|
|
39
|
-
} = (0, import_data.useSelect)(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
} = (0, import_data.useSelect)(
|
|
41
|
+
(select) => {
|
|
42
|
+
const { canUser, getCurrentUser, getEntityRecord } = select(import_core_data.store);
|
|
43
|
+
const siteSettings = canUser("read", {
|
|
44
|
+
kind: "root",
|
|
45
|
+
name: "site"
|
|
46
|
+
}) ? getEntityRecord("root", "site") : void 0;
|
|
47
|
+
if (hasAvatar) {
|
|
48
|
+
return {
|
|
49
|
+
dateFormat: siteSettings?.date_format
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const { getSettings } = select(import_block_editor.store);
|
|
53
|
+
const { __experimentalDiscussionSettings } = getSettings();
|
|
54
|
+
const defaultAvatar = __experimentalDiscussionSettings?.avatarURL;
|
|
55
|
+
const userData = getCurrentUser();
|
|
56
|
+
return {
|
|
57
|
+
currentUserAvatar: userData?.avatar_urls?.[48] ?? defaultAvatar,
|
|
58
|
+
currentUserName: userData?.name,
|
|
59
|
+
currentUserId: userData?.id,
|
|
60
|
+
dateFormat: siteSettings?.date_format
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
[hasAvatar]
|
|
64
|
+
);
|
|
53
65
|
const commentDate = (0, import_date.getDate)(date);
|
|
54
66
|
const commentDateTime = (0, import_date.dateI18n)("c", commentDate);
|
|
55
67
|
const shouldShowHumanTimeDiff = Math.floor((/* @__PURE__ */ new Date() - commentDate) / (1e3 * 60 * 60 * 24)) < 30;
|
|
@@ -77,7 +89,7 @@ function CommentAuthorInfo({ avatar, name, date, userId }) {
|
|
|
77
89
|
),
|
|
78
90
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { spacing: "0", children: [
|
|
79
91
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "editor-collab-sidebar-panel__user-name", children: name ?? currentUserName }),
|
|
80
|
-
date && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Tooltip, {
|
|
92
|
+
date && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Tooltip, { text: tooltipText, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
81
93
|
"time",
|
|
82
94
|
{
|
|
83
95
|
dateTime: commentDateTime,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collab-sidebar/comment-author-info.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Tooltip, __experimentalVStack as VStack } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tdateI18n,\n\tgetSettings as getDateSettings,\n\thumanTimeDiff,\n\tgetDate,\n} from '@wordpress/date';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { getAvatarBorderColor } from './utils';\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Tooltip, __experimentalVStack as VStack } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tdateI18n,\n\tgetSettings as getDateSettings,\n\thumanTimeDiff,\n\tgetDate,\n} from '@wordpress/date';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { getAvatarBorderColor } from './utils';\n\nfunction CommentAuthorInfo( { avatar, name, date, userId } ) {\n\tconst hasAvatar = !! avatar;\n\tconst dateSettings = getDateSettings();\n\tconst {\n\t\tcurrentUserAvatar,\n\t\tcurrentUserName,\n\t\tcurrentUserId,\n\t\tdateFormat = dateSettings.formats.date,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getCurrentUser, getEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\tif ( hasAvatar ) {\n\t\t\t\treturn {\n\t\t\t\t\tdateFormat: siteSettings?.date_format,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\tconst { __experimentalDiscussionSettings } = getSettings();\n\t\t\tconst defaultAvatar = __experimentalDiscussionSettings?.avatarURL;\n\t\t\tconst userData = getCurrentUser();\n\t\t\treturn {\n\t\t\t\tcurrentUserAvatar:\n\t\t\t\t\tuserData?.avatar_urls?.[ 48 ] ?? defaultAvatar,\n\t\t\t\tcurrentUserName: userData?.name,\n\t\t\t\tcurrentUserId: userData?.id,\n\t\t\t\tdateFormat: siteSettings?.date_format,\n\t\t\t};\n\t\t},\n\t\t[ hasAvatar ]\n\t);\n\n\tconst commentDate = getDate( date );\n\tconst commentDateTime = dateI18n( 'c', commentDate );\n\tconst shouldShowHumanTimeDiff =\n\t\tMath.floor( ( new Date() - commentDate ) / ( 1000 * 60 * 60 * 24 ) ) <\n\t\t30;\n\n\tconst commentDateText = shouldShowHumanTimeDiff\n\t\t? humanTimeDiff( commentDate )\n\t\t: dateI18n( dateFormat, commentDate );\n\n\tconst tooltipText = dateI18n(\n\t\t// translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.\n\t\t_x( 'F j, Y g:i\\xa0a', 'Note date full date format' ),\n\t\tdate\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<img\n\t\t\t\tsrc={ avatar || currentUserAvatar }\n\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-avatar\"\n\t\t\t\t// translators: alt text for user avatar image\n\t\t\t\talt={ __( 'User avatar' ) }\n\t\t\t\twidth={ 32 }\n\t\t\t\theight={ 32 }\n\t\t\t\tstyle={ {\n\t\t\t\t\tborderColor: getAvatarBorderColor(\n\t\t\t\t\t\tuserId ?? currentUserId\n\t\t\t\t\t),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<VStack spacing=\"0\">\n\t\t\t\t<span className=\"editor-collab-sidebar-panel__user-name\">\n\t\t\t\t\t{ name ?? currentUserName }\n\t\t\t\t</span>\n\t\t\t\t{ date && (\n\t\t\t\t\t<Tooltip text={ tooltipText }>\n\t\t\t\t\t\t<time\n\t\t\t\t\t\t\tdateTime={ commentDateTime }\n\t\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-time\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ commentDateText }\n\t\t\t\t\t\t</time>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</>\n\t);\n}\n\nexport default CommentAuthorInfo;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6EE;AA1EF,wBAAwD;AACxD,kBAAuB;AACvB,kBAKO;AACP,uBAAmC;AACnC,kBAA0B;AAC1B,0BAA0C;AAK1C,mBAAqC;AAErC,SAAS,kBAAmB,EAAE,QAAQ,MAAM,MAAM,OAAO,GAAI;AAC5D,QAAM,YAAY,CAAC,CAAE;AACrB,QAAM,mBAAe,YAAAA,aAAgB;AACrC,QAAM;AAAA,IACL;AAAA,IACA;AAAA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6CAAC,kBAAAC,sBAAA,EAAO,SAAQ,KACf;AAAA,kDAAC,UAAK,WAAU,0CACb,kBAAQ,iBACX;AAAA,MACE,QACD,4CAAC,6BAAQ,MAAO,aACf;AAAA,QAAC;AAAA;AAAA,UACA,UAAW;AAAA,UACX,WAAU;AAAA,UAER;AAAA;AAAA,MACH,GACD;AAAA,OAEF;AAAA,KACD;AAEF;AAEA,IAAO,8BAAQ;",
|
|
6
6
|
"names": ["getDateSettings", "coreStore", "blockEditorStore", "VStack"]
|
|
7
7
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var comment_indicator_toolbar_exports = {};
|
|
30
20
|
__export(comment_indicator_toolbar_exports, {
|
|
@@ -36,11 +26,10 @@ var import_components = require("@wordpress/components");
|
|
|
36
26
|
var import_i18n = require("@wordpress/i18n");
|
|
37
27
|
var import_element = require("@wordpress/element");
|
|
38
28
|
var import_block_editor = require("@wordpress/block-editor");
|
|
39
|
-
var import_clsx = __toESM(require("clsx"));
|
|
40
29
|
var import_lock_unlock = require("../../lock-unlock");
|
|
41
30
|
var import_utils = require("./utils");
|
|
42
31
|
const { CommentIconToolbarSlotFill } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
|
|
43
|
-
const CommentAvatarIndicator = ({ onClick, thread
|
|
32
|
+
const CommentAvatarIndicator = ({ onClick, thread }) => {
|
|
44
33
|
const threadParticipants = (0, import_element.useMemo)(() => {
|
|
45
34
|
if (!thread) {
|
|
46
35
|
return [];
|
|
@@ -50,13 +39,11 @@ const CommentAvatarIndicator = ({ onClick, thread, hasMoreComments }) => {
|
|
|
50
39
|
allComments.sort((a, b) => new Date(a.date) - new Date(b.date));
|
|
51
40
|
allComments.forEach((comment) => {
|
|
52
41
|
if (comment.author_name && comment.author_avatar_urls) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
participantsMap.set(authorKey, {
|
|
42
|
+
if (!participantsMap.has(comment.author)) {
|
|
43
|
+
participantsMap.set(comment.author, {
|
|
56
44
|
name: comment.author_name,
|
|
57
45
|
avatar: comment.author_avatar_urls?.["48"] || comment.author_avatar_urls?.["96"],
|
|
58
46
|
id: comment.author,
|
|
59
|
-
isOriginalCommenter: comment.id === thread.id,
|
|
60
47
|
date: comment.date
|
|
61
48
|
});
|
|
62
49
|
}
|
|
@@ -64,62 +51,45 @@ const CommentAvatarIndicator = ({ onClick, thread, hasMoreComments }) => {
|
|
|
64
51
|
});
|
|
65
52
|
return Array.from(participantsMap.values());
|
|
66
53
|
}, [thread]);
|
|
67
|
-
const hasUnresolved = thread?.status !== "approved";
|
|
68
|
-
const threadHasMoreParticipants = hasMoreComments && thread?.reply && 1 + thread.reply.length >= 100;
|
|
69
54
|
if (!threadParticipants.length) {
|
|
70
55
|
return null;
|
|
71
56
|
}
|
|
72
57
|
const maxAvatars = 3;
|
|
73
|
-
const
|
|
74
|
-
const
|
|
58
|
+
const isOverflow = threadParticipants.length > maxAvatars;
|
|
59
|
+
const visibleParticipants = isOverflow ? threadParticipants.slice(0, maxAvatars - 1) : threadParticipants;
|
|
60
|
+
const overflowCount = Math.max(
|
|
61
|
+
0,
|
|
62
|
+
threadParticipants.length - visibleParticipants.length
|
|
63
|
+
);
|
|
64
|
+
const threadHasMoreParticipants = threadParticipants.length > 100;
|
|
75
65
|
const overflowText = threadHasMoreParticipants && overflowCount > 0 ? (0, import_i18n.__)("100+") : (0, import_i18n.sprintf)(
|
|
76
66
|
// translators: %s: Number of participants.
|
|
77
67
|
(0, import_i18n.__)("+%s"),
|
|
78
68
|
overflowCount
|
|
79
69
|
);
|
|
80
|
-
const overflowTitle = threadHasMoreParticipants && overflowCount > 0 ? (0, import_i18n.__)("100+ participants") : (0, import_i18n.sprintf)(
|
|
81
|
-
// translators: %s: Number of participants.
|
|
82
|
-
(0, import_i18n._n)(
|
|
83
|
-
"+%s more participant",
|
|
84
|
-
"+%s more participants",
|
|
85
|
-
overflowCount
|
|
86
|
-
),
|
|
87
|
-
overflowCount
|
|
88
|
-
);
|
|
89
70
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CommentIconToolbarSlotFill.Fill, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
90
71
|
import_components.ToolbarButton,
|
|
91
72
|
{
|
|
92
|
-
className:
|
|
93
|
-
"has-unresolved": hasUnresolved
|
|
94
|
-
}),
|
|
73
|
+
className: "comment-avatar-indicator",
|
|
95
74
|
label: (0, import_i18n.__)("View notes"),
|
|
96
75
|
onClick,
|
|
97
76
|
showTooltip: true,
|
|
98
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
99
|
-
visibleParticipants.map((participant
|
|
77
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { spacing: "1", children: [
|
|
78
|
+
visibleParticipants.map((participant) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
100
79
|
"img",
|
|
101
80
|
{
|
|
102
81
|
src: participant.avatar,
|
|
103
82
|
alt: participant.name,
|
|
104
83
|
className: "comment-avatar",
|
|
105
84
|
style: {
|
|
106
|
-
zIndex: maxAvatars - index,
|
|
107
85
|
borderColor: (0, import_utils.getAvatarBorderColor)(
|
|
108
86
|
participant.id
|
|
109
87
|
)
|
|
110
88
|
}
|
|
111
89
|
},
|
|
112
|
-
participant.
|
|
90
|
+
participant.id
|
|
113
91
|
)),
|
|
114
|
-
overflowCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
115
|
-
"div",
|
|
116
|
-
{
|
|
117
|
-
className: "comment-avatar-overflow",
|
|
118
|
-
style: { zIndex: 0 },
|
|
119
|
-
title: overflowTitle,
|
|
120
|
-
children: overflowText
|
|
121
|
-
}
|
|
122
|
-
)
|
|
92
|
+
overflowCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalText, { weight: 500, children: overflowText })
|
|
123
93
|
] })
|
|
124
94
|
}
|
|
125
95
|
) });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collab-sidebar/comment-indicator-toolbar.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["blockEditorPrivateApis", "
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarButton,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { getAvatarBorderColor } from './utils';\n\nconst { CommentIconToolbarSlotFill } = unlock( blockEditorPrivateApis );\n\nconst CommentAvatarIndicator = ( { onClick, thread } ) => {\n\tconst threadParticipants = useMemo( () => {\n\t\tif ( ! thread ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst participantsMap = new Map();\n\t\tconst allComments = [ thread, ...thread.reply ];\n\n\t\t// Sort by date to show participants in chronological order.\n\t\tallComments.sort( ( a, b ) => new Date( a.date ) - new Date( b.date ) );\n\n\t\tallComments.forEach( ( comment ) => {\n\t\t\t// Track thread participants (original commenter + repliers).\n\t\t\tif ( comment.author_name && comment.author_avatar_urls ) {\n\t\t\t\tif ( ! participantsMap.has( comment.author ) ) {\n\t\t\t\t\tparticipantsMap.set( comment.author, {\n\t\t\t\t\t\tname: comment.author_name,\n\t\t\t\t\t\tavatar:\n\t\t\t\t\t\t\tcomment.author_avatar_urls?.[ '48' ] ||\n\t\t\t\t\t\t\tcomment.author_avatar_urls?.[ '96' ],\n\t\t\t\t\t\tid: comment.author,\n\t\t\t\t\t\tdate: comment.date,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\n\t\treturn Array.from( participantsMap.values() );\n\t}, [ thread ] );\n\n\tif ( ! threadParticipants.length ) {\n\t\treturn null;\n\t}\n\n\t// If there are more than 3 participants, show 2 avatars and a \"+n\" number.\n\tconst maxAvatars = 3;\n\tconst isOverflow = threadParticipants.length > maxAvatars;\n\tconst visibleParticipants = isOverflow\n\t\t? threadParticipants.slice( 0, maxAvatars - 1 )\n\t\t: threadParticipants;\n\tconst overflowCount = Math.max(\n\t\t0,\n\t\tthreadParticipants.length - visibleParticipants.length\n\t);\n\tconst threadHasMoreParticipants = threadParticipants.length > 100;\n\n\t// If we hit the comment limit, show \"100+\" instead of exact overflow count.\n\tconst overflowText =\n\t\tthreadHasMoreParticipants && overflowCount > 0\n\t\t\t? __( '100+' )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %s: Number of participants.\n\t\t\t\t\t__( '+%s' ),\n\t\t\t\t\toverflowCount\n\t\t\t );\n\n\treturn (\n\t\t<CommentIconToolbarSlotFill.Fill>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"comment-avatar-indicator\"\n\t\t\t\tlabel={ __( 'View notes' ) }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tshowTooltip\n\t\t\t>\n\t\t\t\t<HStack spacing=\"1\">\n\t\t\t\t\t{ visibleParticipants.map( ( participant ) => (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tkey={ participant.id }\n\t\t\t\t\t\t\tsrc={ participant.avatar }\n\t\t\t\t\t\t\talt={ participant.name }\n\t\t\t\t\t\t\tclassName=\"comment-avatar\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tborderColor: getAvatarBorderColor(\n\t\t\t\t\t\t\t\t\tparticipant.id\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t\t{ overflowCount > 0 && (\n\t\t\t\t\t\t<Text weight={ 500 }>{ overflowText }</Text>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t</ToolbarButton>\n\t\t</CommentIconToolbarSlotFill.Fill>\n\t);\n};\n\nexport default CommentAvatarIndicator;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqFI;AAlFJ,wBAIO;AACP,kBAA4B;AAC5B,qBAAwB;AACxB,0BAAsD;AAKtD,yBAAuB;AACvB,mBAAqC;AAErC,MAAM,EAAE,2BAA2B,QAAI,2BAAQ,oBAAAA,WAAuB;AAEtE,MAAM,yBAAyB,CAAE,EAAE,SAAS,OAAO,MAAO;AACzD,QAAM,yBAAqB,wBAAS,MAAM;AACzC,QAAK,CAAE,QAAS;AACf,aAAO,CAAC;AAAA,IACT;AAEA,UAAM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