@box/threaded-annotations 3.1.3 → 3.2.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/dist/chunks/messages-view.js +23 -23
- package/dist/chunks/threaded-annotations2.js +66 -60
- package/dist/esm/lib/components/v2/text-message/text-message.js +1 -0
- package/dist/esm/lib/v2/hooks/useScrollToMessage.js +37 -0
- package/dist/esm/lib/v2/threaded-annotations-context.js +16 -8
- package/dist/i18n/hi-IN.js +1 -0
- package/dist/i18n/it-IT.js +2 -1
- package/dist/i18n/ja-JP.js +1 -0
- package/dist/types/lib/v2/hooks/useScrollToMessage.d.ts +24 -0
- package/dist/types/lib/v2/stories/shared.d.ts +2 -0
- package/dist/types/lib/v2/threaded-annotations-context.d.ts +12 -0
- package/dist/types/lib/v2/threaded-annotations.d.ts +8 -0
- package/package.json +1 -1
|
@@ -15,26 +15,26 @@ import '../styles/messages-view.css';var u = {
|
|
|
15
15
|
repliesContainer: "_repliesContainer_gor1q_56",
|
|
16
16
|
messagesFade: "_messagesFade_gor1q_62"
|
|
17
17
|
}, d = ({ messages: d, isResolved: f = !1, resolvedBy: p, resolvedAt: m, maxCharacterCount: h, onDelete: g, onThreadDelete: _, onAvatarClick: v, onCopyLink: y, onEdit: b, onEditError: x, onResolve: S, onUnresolve: C, userSelectorProps: w, annotationTarget: T, onAnnotationBadgeClick: E, originalContentDeleted: D }) => {
|
|
18
|
-
let { viewState: O, dispatch: k, isAnnotations: A } = t(),
|
|
18
|
+
let { viewState: O, dispatch: k, isAnnotations: A, scrollTargetMessageId: j } = t(), M = s(null), N = O !== e.Collapsed, P = O === e.Composing, F = d.length > 2, I = F && !N, { handleScroll: L, isOverflowing: R } = a({
|
|
19
19
|
messageCount: d.length,
|
|
20
|
-
containerRef:
|
|
20
|
+
containerRef: M,
|
|
21
21
|
enabled: A,
|
|
22
|
-
isExpanded:
|
|
23
|
-
suppressAutoScroll:
|
|
24
|
-
}),
|
|
25
|
-
if (!
|
|
26
|
-
let
|
|
22
|
+
isExpanded: N,
|
|
23
|
+
suppressAutoScroll: I || !!j
|
|
24
|
+
}), z = d[0], B = d.slice(1), V = B.length >= 1, H = B[B.length - 1], U = B.slice(0, -1), W = F && !N;
|
|
25
|
+
if (!z) return null;
|
|
26
|
+
let G = U[U.length - 1]?.author, K = U.length >= 2 ? U[U.length - 2].author : void 0, q = () => k({ type: "EXPAND" });
|
|
27
27
|
return /* @__PURE__ */ l("div", {
|
|
28
|
-
className: o(u.messagesViewWrapper,
|
|
28
|
+
className: o(u.messagesViewWrapper, R && u.overflowing, R && P && u.withEditorBelow),
|
|
29
29
|
children: [/* @__PURE__ */ l("div", {
|
|
30
|
-
ref:
|
|
30
|
+
ref: M,
|
|
31
31
|
className: o(u.messagesView, A && u.scrollable),
|
|
32
|
-
onScroll:
|
|
32
|
+
onScroll: L,
|
|
33
33
|
children: [
|
|
34
34
|
/* @__PURE__ */ c(i, {
|
|
35
|
-
...
|
|
36
|
-
hasReplies:
|
|
37
|
-
showThreadedIndicator:
|
|
35
|
+
...z,
|
|
36
|
+
hasReplies: V,
|
|
37
|
+
showThreadedIndicator: V || f,
|
|
38
38
|
isResolved: f,
|
|
39
39
|
maxCharacterCount: h,
|
|
40
40
|
onDelete: g,
|
|
@@ -51,15 +51,15 @@ import '../styles/messages-view.css';var u = {
|
|
|
51
51
|
onAnnotationBadgeClick: E,
|
|
52
52
|
originalContentDeleted: D
|
|
53
53
|
}),
|
|
54
|
-
|
|
55
|
-
lastUser:
|
|
56
|
-
repliesCount:
|
|
57
|
-
secondLastUser:
|
|
58
|
-
onShowReplies:
|
|
54
|
+
W && G && /* @__PURE__ */ c(r, {
|
|
55
|
+
lastUser: G,
|
|
56
|
+
repliesCount: U.length,
|
|
57
|
+
secondLastUser: K,
|
|
58
|
+
onShowReplies: q
|
|
59
59
|
}),
|
|
60
|
-
|
|
60
|
+
N && U.length > 0 && /* @__PURE__ */ c("div", {
|
|
61
61
|
className: u.repliesContainer,
|
|
62
|
-
children:
|
|
62
|
+
children: U.map((e) => /* @__PURE__ */ c(i, {
|
|
63
63
|
...e,
|
|
64
64
|
showThreadedIndicator: !0,
|
|
65
65
|
isResolved: f,
|
|
@@ -74,8 +74,8 @@ import '../styles/messages-view.css';var u = {
|
|
|
74
74
|
userSelectorProps: w
|
|
75
75
|
}, e.id))
|
|
76
76
|
}),
|
|
77
|
-
|
|
78
|
-
...
|
|
77
|
+
H && /* @__PURE__ */ c(i, {
|
|
78
|
+
...H,
|
|
79
79
|
showThreadedIndicator: f,
|
|
80
80
|
isResolved: f,
|
|
81
81
|
maxCharacterCount: h,
|
|
@@ -93,7 +93,7 @@ import '../styles/messages-view.css';var u = {
|
|
|
93
93
|
createdAt: m
|
|
94
94
|
})
|
|
95
95
|
]
|
|
96
|
-
}),
|
|
96
|
+
}), R && /* @__PURE__ */ c("div", { className: u.messagesFade })]
|
|
97
97
|
});
|
|
98
98
|
};
|
|
99
99
|
export { d as t };
|
|
@@ -2,85 +2,91 @@ import { THREADED_ANNOTATIONS_PORTAL as e } from "../esm/lib/v2/constants.js";
|
|
|
2
2
|
import { MessageEditor as t } from "../esm/lib/components/v2/message-editor/message-editor.js";
|
|
3
3
|
import { ThreadViewState as n, ThreadedAnnotationsProvider as r, useThreadedAnnotationsContext as i } from "../esm/lib/v2/threaded-annotations-context.js";
|
|
4
4
|
import { t as a } from "./messages-view.js";
|
|
5
|
-
import {
|
|
6
|
-
import s from "
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
5
|
+
import { useScrollToMessage as o } from "../esm/lib/v2/hooks/useScrollToMessage.js";
|
|
6
|
+
import { buildMentionContent as s } from "../esm/lib/v2/utils/build-mention-content.js";
|
|
7
|
+
import c from "clsx";
|
|
8
|
+
import { useCallback as l, useEffect as u, useMemo as d, useRef as f } from "react";
|
|
9
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
10
|
+
import '../styles/threaded-annotations2.css';var h = {
|
|
10
11
|
threadedAnnotations: "_threadedAnnotations_16hhz_1",
|
|
11
12
|
expandable: "_expandable_16hhz_10",
|
|
12
13
|
annotations: "_annotations_16hhz_18",
|
|
13
14
|
highlighted: "_highlighted_16hhz_18"
|
|
14
|
-
},
|
|
15
|
-
let { viewState:
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
}, g = ({ messages: r, isResolved: g = !1, resolvedBy: _, resolvedAt: v, maxCharacterCount: y, onDelete: b, onThreadDelete: x, onAvatarClick: S, onCopyLink: C, onEdit: w, onEditError: T, onResolve: E, onUnresolve: D, onPost: O, onPostError: k, userSelectorProps: A, onEditorOpenChange: j, annotationTarget: M, onAnnotationBadgeClick: N, originalContentDeleted: P, scrollToMessageId: F, onScrollToMessageComplete: I, isHighlighted: L = !1 }) => {
|
|
16
|
+
let { viewState: R, dispatch: z, editingMessageId: B, replyMention: V, isReplyDisabled: H, isAnnotations: U } = i(), W = f(null), G = R !== n.Collapsed, K = r.length > 2, q = R === n.Collapsed && (K || !H && !g);
|
|
17
|
+
o({
|
|
18
|
+
containerRef: W,
|
|
19
|
+
messages: r,
|
|
20
|
+
scrollToMessageId: F,
|
|
21
|
+
onScrollToMessageComplete: I
|
|
22
|
+
}), u(() => {
|
|
23
|
+
B && !r.some((e) => e.id === B) && z({ type: "CLEAR_EDIT" });
|
|
18
24
|
}, [
|
|
19
|
-
|
|
25
|
+
B,
|
|
20
26
|
r,
|
|
21
|
-
|
|
22
|
-
]),
|
|
23
|
-
|
|
24
|
-
}, [
|
|
25
|
-
if (!
|
|
27
|
+
z
|
|
28
|
+
]), u(() => {
|
|
29
|
+
j?.(G);
|
|
30
|
+
}, [G, j]), u(() => {
|
|
31
|
+
if (!G) return;
|
|
26
32
|
let t = `[${Object.keys(e)[0]}]`, n = (e) => {
|
|
27
33
|
let n = e.target;
|
|
28
|
-
|
|
34
|
+
W.current?.contains(n) || document.querySelector(t)?.contains(n) || z({ type: "COLLAPSE" });
|
|
29
35
|
};
|
|
30
36
|
return document.addEventListener("mousedown", n), () => document.removeEventListener("mousedown", n);
|
|
31
|
-
}, [
|
|
32
|
-
let
|
|
33
|
-
if (!
|
|
37
|
+
}, [G, z]);
|
|
38
|
+
let J = r.length === 0, Y = l(() => z({ type: "CLEAR_MENTION" }), [z]), X = d(() => V ? s(V) : null, [V]), Z = l((e) => {
|
|
39
|
+
if (!q) return;
|
|
34
40
|
let t = e.target;
|
|
35
|
-
!e.currentTarget.contains(t) || t.closest("[data-no-expand]") ||
|
|
36
|
-
}, [
|
|
37
|
-
return
|
|
41
|
+
!e.currentTarget.contains(t) || t.closest("[data-no-expand]") || z({ type: "EXPAND" });
|
|
42
|
+
}, [q, z]);
|
|
43
|
+
return U && J ? /* @__PURE__ */ p(t, {
|
|
38
44
|
isFirstAnnotation: !0,
|
|
39
|
-
maxCharacterCount:
|
|
40
|
-
onPost:
|
|
41
|
-
onPostError:
|
|
42
|
-
onPostSuccess:
|
|
43
|
-
userSelectorProps:
|
|
44
|
-
}) : /* @__PURE__ */
|
|
45
|
-
ref:
|
|
46
|
-
className:
|
|
47
|
-
"data-thread-expandable":
|
|
48
|
-
"data-thread-highlighted":
|
|
49
|
-
onClick:
|
|
50
|
-
children: [/* @__PURE__ */
|
|
45
|
+
maxCharacterCount: y,
|
|
46
|
+
onPost: O,
|
|
47
|
+
onPostError: k,
|
|
48
|
+
onPostSuccess: Y,
|
|
49
|
+
userSelectorProps: A
|
|
50
|
+
}) : /* @__PURE__ */ m("div", {
|
|
51
|
+
ref: W,
|
|
52
|
+
className: c(h.threadedAnnotations, q && h.expandable, U && h.annotations, L && h.highlighted),
|
|
53
|
+
"data-thread-expandable": q ? !0 : void 0,
|
|
54
|
+
"data-thread-highlighted": L ? !0 : void 0,
|
|
55
|
+
onClick: q ? Z : void 0,
|
|
56
|
+
children: [/* @__PURE__ */ p(a, {
|
|
51
57
|
messages: r,
|
|
52
|
-
isResolved:
|
|
53
|
-
resolvedBy:
|
|
54
|
-
resolvedAt:
|
|
55
|
-
maxCharacterCount:
|
|
56
|
-
onDelete:
|
|
57
|
-
onThreadDelete:
|
|
58
|
-
onAvatarClick:
|
|
59
|
-
onCopyLink:
|
|
60
|
-
onEdit:
|
|
61
|
-
onEditError:
|
|
62
|
-
onResolve:
|
|
63
|
-
onUnresolve:
|
|
64
|
-
userSelectorProps:
|
|
65
|
-
annotationTarget:
|
|
66
|
-
onAnnotationBadgeClick:
|
|
67
|
-
originalContentDeleted:
|
|
68
|
-
}),
|
|
69
|
-
initialContent:
|
|
70
|
-
maxCharacterCount:
|
|
71
|
-
onPost:
|
|
72
|
-
onPostError:
|
|
73
|
-
onPostSuccess:
|
|
58
|
+
isResolved: g,
|
|
59
|
+
resolvedBy: _,
|
|
60
|
+
resolvedAt: v,
|
|
61
|
+
maxCharacterCount: y,
|
|
62
|
+
onDelete: b,
|
|
63
|
+
onThreadDelete: x,
|
|
64
|
+
onAvatarClick: S,
|
|
65
|
+
onCopyLink: C,
|
|
66
|
+
onEdit: w,
|
|
67
|
+
onEditError: T,
|
|
68
|
+
onResolve: E,
|
|
69
|
+
onUnresolve: D,
|
|
70
|
+
userSelectorProps: A,
|
|
71
|
+
annotationTarget: M,
|
|
72
|
+
onAnnotationBadgeClick: N,
|
|
73
|
+
originalContentDeleted: P
|
|
74
|
+
}), R === n.Composing && /* @__PURE__ */ p(t, {
|
|
75
|
+
initialContent: X,
|
|
76
|
+
maxCharacterCount: y,
|
|
77
|
+
onPost: O,
|
|
78
|
+
onPostError: k,
|
|
79
|
+
onPostSuccess: Y,
|
|
74
80
|
isReply: !0,
|
|
75
|
-
userSelectorProps:
|
|
81
|
+
userSelectorProps: A
|
|
76
82
|
})]
|
|
77
83
|
});
|
|
78
|
-
},
|
|
84
|
+
}, _ = (e) => /* @__PURE__ */ p(r, {
|
|
79
85
|
defaultExpanded: e.messages.length === 0,
|
|
80
86
|
isReplyDisabled: e.isReplyDisabled || e.isResolved,
|
|
81
87
|
isEditDisabled: e.isEditDisabled || e.isResolved,
|
|
82
88
|
isAnnotations: e.isAnnotations,
|
|
83
89
|
collapsed: e.collapsed,
|
|
84
|
-
children: /* @__PURE__ */
|
|
90
|
+
children: /* @__PURE__ */ p(g, { ...e })
|
|
85
91
|
});
|
|
86
|
-
export {
|
|
92
|
+
export { _ as t };
|
|
@@ -17,6 +17,7 @@ var h = ({ id: h, author: g, message: _, createdAt: v, updatedAt: y, permissions
|
|
|
17
17
|
"aria-label": V.formatMessage(o.annotationMessageAriaLabel),
|
|
18
18
|
className: s.textMessage,
|
|
19
19
|
"data-message-wrapper": !0,
|
|
20
|
+
"data-message-id": h,
|
|
20
21
|
"data-resin-component": e.COMMENT_CARD,
|
|
21
22
|
children: [/* @__PURE__ */ p(a, {
|
|
22
23
|
author: g,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useThreadedAnnotationsContext as e } from "../threaded-annotations-context.js";
|
|
2
|
+
import { useEffect as t, useLayoutEffect as n } from "react";
|
|
3
|
+
var r = ({ containerRef: r, messages: i, scrollToMessageId: a, onScrollToMessageComplete: o }) => {
|
|
4
|
+
let { scrollTargetMessageId: s, dispatch: c, isAnnotations: l } = e();
|
|
5
|
+
t(() => {
|
|
6
|
+
if (!(l || !a)) {
|
|
7
|
+
if (!i.some((e) => e.id === a)) {
|
|
8
|
+
o?.(a, !1);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
c({
|
|
12
|
+
type: "SET_SCROLL_TARGET",
|
|
13
|
+
id: a
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}, [
|
|
17
|
+
l,
|
|
18
|
+
a,
|
|
19
|
+
i,
|
|
20
|
+
c,
|
|
21
|
+
o
|
|
22
|
+
]), n(() => {
|
|
23
|
+
if (l || !s) return;
|
|
24
|
+
let e = r.current?.querySelector(`[data-message-id="${CSS.escape(s)}"]`);
|
|
25
|
+
e?.scrollIntoView({
|
|
26
|
+
behavior: "smooth",
|
|
27
|
+
block: "nearest"
|
|
28
|
+
}), o?.(s, !!e), c({ type: "CLEAR_SCROLL_TARGET" });
|
|
29
|
+
}, [
|
|
30
|
+
l,
|
|
31
|
+
s,
|
|
32
|
+
c,
|
|
33
|
+
o,
|
|
34
|
+
r
|
|
35
|
+
]);
|
|
36
|
+
};
|
|
37
|
+
export { r as useScrollToMessage };
|
|
@@ -3,15 +3,15 @@ import { jsx as o } from "react/jsx-runtime";
|
|
|
3
3
|
var s = /* @__PURE__ */ function(e) {
|
|
4
4
|
return e.Collapsed = "collapsed", e.RepliesOnly = "repliesOnly", e.Composing = "composing", e;
|
|
5
5
|
}({}), c = /*#__PURE__*/ e(void 0), l = ({ children: e, defaultExpanded: n = !1, isReplyDisabled: s = !1, isEditDisabled: l = !1, collapsed: u = !1, isAnnotations: d = !1 }) => {
|
|
6
|
-
let [f, p] = a(() => n ? s ? "repliesOnly" : "composing" : "collapsed"), [m, h] = a(null), [g, _] = a(null);
|
|
6
|
+
let [f, p] = a(() => n ? s ? "repliesOnly" : "composing" : "collapsed"), [m, h] = a(null), [g, _] = a(null), [v, y] = a(null);
|
|
7
7
|
r(() => {
|
|
8
8
|
s ? (p((e) => e === "composing" ? "collapsed" : e), h(null)) : p((e) => e === "repliesOnly" ? "composing" : e);
|
|
9
9
|
}, [s]), r(() => {
|
|
10
10
|
l && _(null);
|
|
11
11
|
}, [l]), r(() => {
|
|
12
|
-
u && (p("collapsed"), h(null), _(null));
|
|
12
|
+
u && (p("collapsed"), h(null), _(null), y(null));
|
|
13
13
|
}, [u]);
|
|
14
|
-
let
|
|
14
|
+
let b = t((e) => {
|
|
15
15
|
switch (e.type) {
|
|
16
16
|
case "EXPAND":
|
|
17
17
|
p((e) => e === "collapsed" ? s ? "repliesOnly" : "composing" : e);
|
|
@@ -26,31 +26,39 @@ var s = /* @__PURE__ */ function(e) {
|
|
|
26
26
|
_(null);
|
|
27
27
|
break;
|
|
28
28
|
case "COLLAPSE":
|
|
29
|
-
p("collapsed"), h(null), _(null);
|
|
29
|
+
p("collapsed"), h(null), _(null), y(null);
|
|
30
30
|
break;
|
|
31
31
|
case "CLEAR_MENTION":
|
|
32
32
|
h(null);
|
|
33
33
|
break;
|
|
34
|
+
case "SET_SCROLL_TARGET":
|
|
35
|
+
y(e.id), p((e) => e === "collapsed" ? s ? "repliesOnly" : "composing" : e);
|
|
36
|
+
break;
|
|
37
|
+
case "CLEAR_SCROLL_TARGET":
|
|
38
|
+
y(null);
|
|
39
|
+
break;
|
|
34
40
|
}
|
|
35
|
-
}, [s, l]),
|
|
41
|
+
}, [s, l]), x = i(() => ({
|
|
36
42
|
viewState: f,
|
|
37
43
|
replyMention: m,
|
|
38
44
|
editingMessageId: g,
|
|
45
|
+
scrollTargetMessageId: v,
|
|
39
46
|
isAnnotations: d,
|
|
40
47
|
isReplyDisabled: s,
|
|
41
48
|
isEditDisabled: l,
|
|
42
|
-
dispatch:
|
|
49
|
+
dispatch: b
|
|
43
50
|
}), [
|
|
44
51
|
f,
|
|
45
52
|
m,
|
|
46
53
|
g,
|
|
54
|
+
v,
|
|
47
55
|
d,
|
|
48
56
|
s,
|
|
49
57
|
l,
|
|
50
|
-
|
|
58
|
+
b
|
|
51
59
|
]);
|
|
52
60
|
return /* @__PURE__ */ o(c.Provider, {
|
|
53
|
-
value:
|
|
61
|
+
value: x,
|
|
54
62
|
children: e
|
|
55
63
|
});
|
|
56
64
|
}, u = () => {
|
package/dist/i18n/hi-IN.js
CHANGED
|
@@ -13,6 +13,7 @@ export default {
|
|
|
13
13
|
"groupSharedFeatures.threadedAnnotations.deleteQuestion": "इस {type,select,annotation{एनोटेशन} other{टिप्पणी}}{hasReplies,select,true{और उत्तरों} other{}} को हटाएं? इस कार्रवाई को पूर्ववत नहीं किया जा सकता।",
|
|
14
14
|
"groupSharedFeatures.threadedAnnotations.edit": "संपादित करें",
|
|
15
15
|
"groupSharedFeatures.threadedAnnotations.edited": "(संपादित किया)",
|
|
16
|
+
"groupSharedFeatures.threadedAnnotations.editedTooltip": "संपादित किया गया {time}",
|
|
16
17
|
"groupSharedFeatures.threadedAnnotations.hideReplies": "जवाबों को छिपाएं",
|
|
17
18
|
"groupSharedFeatures.threadedAnnotations.markedAsResolved": "हल किए गए के रूप में चिह्नित किया गया",
|
|
18
19
|
"groupSharedFeatures.threadedAnnotations.messageEditor.cancel": "रद्द करें",
|
package/dist/i18n/it-IT.js
CHANGED
|
@@ -13,6 +13,7 @@ export default {
|
|
|
13
13
|
"groupSharedFeatures.threadedAnnotations.deleteQuestion": "Eliminare {type,select,annotation{questa nota} other{questo commento}} {hasReplies,select,true{ e le risposte} other{}}? Sarà impossibile annullare l’azione.",
|
|
14
14
|
"groupSharedFeatures.threadedAnnotations.edit": "Modifica",
|
|
15
15
|
"groupSharedFeatures.threadedAnnotations.edited": "(Modificato)",
|
|
16
|
+
"groupSharedFeatures.threadedAnnotations.editedTooltip": "Modificato {time}",
|
|
16
17
|
"groupSharedFeatures.threadedAnnotations.hideReplies": "Nascondi risposte",
|
|
17
18
|
"groupSharedFeatures.threadedAnnotations.markedAsResolved": "ha contrassegnato l’elemento come risolto",
|
|
18
19
|
"groupSharedFeatures.threadedAnnotations.messageEditor.cancel": "Annulla",
|
|
@@ -39,7 +40,7 @@ export default {
|
|
|
39
40
|
"groupSharedFeatures.threadedAnnotations.resolveButtonAriaLabel": "Risolvi",
|
|
40
41
|
"groupSharedFeatures.threadedAnnotations.resolvedStateAriaLabel": "Messaggio sullo stato della risoluzione",
|
|
41
42
|
"groupSharedFeatures.threadedAnnotations.seeMore": "Vedi altro",
|
|
42
|
-
"groupSharedFeatures.threadedAnnotations.showMoreReplies": "{count,plural,one{#
|
|
43
|
+
"groupSharedFeatures.threadedAnnotations.showMoreReplies": "{count,plural,one{# altre risposte} other{# altre risposte} many{# altre risposte}}",
|
|
43
44
|
"groupSharedFeatures.threadedAnnotations.showReplies": "{number,plural,one{Mostra # risposta} many{Mostra altre # risposte} other{Mostra altre # risposte}}",
|
|
44
45
|
"groupSharedFeatures.threadedAnnotations.showRepliesButtonAriaLabel": "Pulsante Rispondi",
|
|
45
46
|
"groupSharedFeatures.threadedAnnotations.textMentionAriaLabel": "Menzione utente",
|
package/dist/i18n/ja-JP.js
CHANGED
|
@@ -13,6 +13,7 @@ export default {
|
|
|
13
13
|
"groupSharedFeatures.threadedAnnotations.deleteQuestion": "この{type,select,annotation{注釈} other{コメント}}{hasReplies,select,true{と返信} other{}}を削除しますか? この操作を元に戻すことはできません。",
|
|
14
14
|
"groupSharedFeatures.threadedAnnotations.edit": "編集",
|
|
15
15
|
"groupSharedFeatures.threadedAnnotations.edited": "(編集済み)",
|
|
16
|
+
"groupSharedFeatures.threadedAnnotations.editedTooltip": "編集日時: {time}",
|
|
16
17
|
"groupSharedFeatures.threadedAnnotations.hideReplies": "返信を非表示",
|
|
17
18
|
"groupSharedFeatures.threadedAnnotations.markedAsResolved": "が対応済みとしてマーク済み",
|
|
18
19
|
"groupSharedFeatures.threadedAnnotations.messageEditor.cancel": "キャンセル",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { TextMessageType } from '../types/message-types';
|
|
3
|
+
interface UseScrollToMessageProps {
|
|
4
|
+
/** Scroll container that holds the message elements (`[data-message-id]`). */
|
|
5
|
+
containerRef: RefObject<HTMLElement | null>;
|
|
6
|
+
/** Messages in the thread; used to ignore unknown `scrollToMessageId` values. */
|
|
7
|
+
messages: TextMessageType[];
|
|
8
|
+
/**
|
|
9
|
+
* Id of the message to scroll into view. Setting it expands the thread (so hidden replies
|
|
10
|
+
* mount) and then scrolls the matching element into view. Ignored when not in `messages`.
|
|
11
|
+
* Only active in comments mode (no internal messages scroll); ignored in annotations mode.
|
|
12
|
+
*/
|
|
13
|
+
scrollToMessageId?: string;
|
|
14
|
+
/** Called after a scroll attempt. `found` is false when the id was not in the DOM. */
|
|
15
|
+
onScrollToMessageComplete?: (messageId: string, found: boolean) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Wires the declarative `scrollToMessageId` prop to the thread's scroll behavior in comments
|
|
19
|
+
* mode: registers the target (which expands the thread), then scrolls the matching element
|
|
20
|
+
* into view via the nearest outer scroll container. No-op in annotations mode where the
|
|
21
|
+
* messages list has its own internal scroll.
|
|
22
|
+
*/
|
|
23
|
+
export declare const useScrollToMessage: ({ containerRef, messages, scrollToMessageId, onScrollToMessageComplete, }: UseScrollToMessageProps) => void;
|
|
24
|
+
export {};
|
|
@@ -12,6 +12,8 @@ interface InteractiveModuleBaseProps {
|
|
|
12
12
|
isReplyDisabled?: boolean;
|
|
13
13
|
maxCharacterCount?: number;
|
|
14
14
|
onCopyLink?: (id: string) => void;
|
|
15
|
+
scrollToMessageId?: string;
|
|
16
|
+
onScrollToMessageComplete?: (messageId: string, found: boolean) => void;
|
|
15
17
|
}
|
|
16
18
|
type InteractiveModuleProps = (InteractiveModuleBaseProps & {
|
|
17
19
|
isAnnotations: true;
|
|
@@ -30,6 +30,13 @@ export type ThreadEvent = {
|
|
|
30
30
|
type: 'COLLAPSE';
|
|
31
31
|
} | {
|
|
32
32
|
type: 'CLEAR_MENTION';
|
|
33
|
+
}
|
|
34
|
+
/** Mark a message as the pending scroll target and expand the thread so hidden replies mount. */
|
|
35
|
+
| {
|
|
36
|
+
type: 'SET_SCROLL_TARGET';
|
|
37
|
+
id: string;
|
|
38
|
+
} | {
|
|
39
|
+
type: 'CLEAR_SCROLL_TARGET';
|
|
33
40
|
};
|
|
34
41
|
export interface ThreadedAnnotationsContextValue {
|
|
35
42
|
viewState: ThreadViewState;
|
|
@@ -39,6 +46,11 @@ export interface ThreadedAnnotationsContextValue {
|
|
|
39
46
|
* `isEditDisabled` or `collapsed` flip true, or when the id disappears from the messages list.
|
|
40
47
|
*/
|
|
41
48
|
editingMessageId: string | null;
|
|
49
|
+
/**
|
|
50
|
+
* Id of the message to scroll into view, or null. Set via SET_SCROLL_TARGET (which also expands
|
|
51
|
+
* the thread). Cleared once the scroll runs, or on COLLAPSE / when `collapsed` flips true.
|
|
52
|
+
*/
|
|
53
|
+
scrollTargetMessageId: string | null;
|
|
42
54
|
/** Whether the component is rendered in annotation mode (scrollable, fixed-height) vs comments mode. */
|
|
43
55
|
isAnnotations: boolean;
|
|
44
56
|
/** When true, globally disables replies (hides reply buttons and blocks editor opening on click). */
|
|
@@ -43,6 +43,14 @@ interface ThreadedAnnotationsBaseProps {
|
|
|
43
43
|
onEditorOpenChange?: (isOpen: boolean) => void;
|
|
44
44
|
/** When true, collapses the editor and replies panel. */
|
|
45
45
|
collapsed?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Scrolls the message with this id into view (comments mode only). When the message is a
|
|
48
|
+
* hidden (middle) reply, the thread expands first so the row mounts. Ignored when the id
|
|
49
|
+
* is not in `messages`, or in annotations mode where the messages list scrolls internally.
|
|
50
|
+
*/
|
|
51
|
+
scrollToMessageId?: string;
|
|
52
|
+
/** Called after a scroll attempt. `found` is false when `scrollToMessageId` was not in the DOM. */
|
|
53
|
+
onScrollToMessageComplete?: (messageId: string, found: boolean) => void;
|
|
46
54
|
/** When true, applies a visual highlight (border + background tint) to the thread card. Not a focus state. */
|
|
47
55
|
isHighlighted?: boolean;
|
|
48
56
|
}
|