@box/threaded-annotations 4.1.8 → 4.1.10
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/annotation-badge.js +1 -64
- package/dist/chunks/custom-placeholder.js +1 -72
- package/dist/chunks/delete-annotations-message-popover.js +1 -46
- package/dist/chunks/delete-confirmation-popover.js +1 -67
- package/dist/chunks/dist.js +2 -1757
- package/dist/chunks/mention-component.js +1 -106
- package/dist/chunks/message-editor.module.js +1 -12
- package/dist/chunks/message-editor2.module.js +1 -29
- package/dist/chunks/message-header.js +1 -49
- package/dist/chunks/messages-view.js +1 -99
- package/dist/chunks/resolved-state.js +1 -55
- package/dist/chunks/show-replies-button.js +1 -60
- package/dist/chunks/text-message.js +1 -21
- package/dist/chunks/text-message.module.js +1 -14
- package/dist/chunks/threaded-annotations.js +1 -71
- package/dist/chunks/threaded-annotations2.js +1 -87
- package/dist/chunks/timestamp-toggle.js +1 -36
- package/dist/chunks/virtualized-messages.js +1 -30
- package/dist/esm/index.js +1 -8
- package/dist/esm/lib/components/mention-component/mention-component.js +1 -2
- package/dist/esm/lib/components/mention-component/mention-context.js +1 -26
- package/dist/esm/lib/components/message-editor/editor-extensions/custom-mention/custom-mention-suggestions.js +1 -23
- package/dist/esm/lib/components/message-editor/editor-extensions/custom-mention/custom-mention.js +1 -59
- package/dist/esm/lib/components/message-editor/editor-extensions/custom-mention/useMentionState.js +1 -24
- package/dist/esm/lib/components/message-editor/editor-extensions/custom-paragraph.js +1 -13
- package/dist/esm/lib/components/message-editor/editor-extensions/custom-placeholder/custom-placeholder-utils.js +1 -26
- package/dist/esm/lib/components/message-editor/editor-extensions/custom-placeholder/custom-placeholder.js +1 -2
- package/dist/esm/lib/components/message-editor/error-message.js +1 -17
- package/dist/esm/lib/components/message-editor/hooks/useMessageEditor.js +1 -69
- package/dist/esm/lib/components/message-editor/hooks/useMessagePost.js +1 -35
- package/dist/esm/lib/components/message-editor/message-editor-actions.js +1 -29
- package/dist/esm/lib/components/message-editor/message-editor-context.js +1 -7
- package/dist/esm/lib/components/message-editor/message-editor.js +1 -74
- package/dist/esm/lib/components/message-editor/messages.js +1 -44
- package/dist/esm/lib/components/message-editor/utils/getMessageEditorState.js +1 -9
- package/dist/esm/lib/components/message-header/delete-annotations-message-popover.js +1 -2
- package/dist/esm/lib/components/message-header/message-header.js +1 -2
- package/dist/esm/lib/components/message-header/messages.js +1 -32
- package/dist/esm/lib/components/messages-view/consts.js +1 -2
- package/dist/esm/lib/components/messages-view/hooks/useAutoScroll.js +1 -43
- package/dist/esm/lib/components/messages-view/hooks/useShowMoreReplies.js +1 -26
- package/dist/esm/lib/components/messages-view/hooks/useVirtualizedMessages.js +1 -17
- package/dist/esm/lib/components/messages-view/messages-view.js +1 -61
- package/dist/esm/lib/components/messages-view/messages.js +1 -12
- package/dist/esm/lib/components/messages-view/virtualized-messages.js +1 -2
- package/dist/esm/lib/components/text-message/message-renderer.js +1 -58
- package/dist/esm/lib/components/text-message/text-message.js +1 -2
- package/dist/esm/lib/components/user-avatar/getInitials.js +1 -5
- package/dist/esm/lib/components/user-avatar/messages.js +1 -12
- package/dist/esm/lib/components/user-avatar/user-avatar.js +1 -31
- package/dist/esm/lib/components/v2/annotation-badge/annotation-badge.js +1 -2
- package/dist/esm/lib/components/v2/annotation-badge/index.js +1 -2
- package/dist/esm/lib/components/v2/annotation-badge/messages.js +1 -12
- package/dist/esm/lib/components/v2/message-editor/editor-extensions/custom-mention/custom-mention-suggestions.js +1 -23
- package/dist/esm/lib/components/v2/message-editor/editor-extensions/custom-mention/custom-mention.js +1 -59
- package/dist/esm/lib/components/v2/message-editor/editor-extensions/custom-mention/mention-trigger-normalization.js +1 -2
- package/dist/esm/lib/components/v2/message-editor/editor-extensions/custom-mention/useMentionState.js +1 -27
- package/dist/esm/lib/components/v2/message-editor/editor-extensions/custom-paragraph.js +1 -13
- package/dist/esm/lib/components/v2/message-editor/hooks/useCharacterLimit.js +1 -24
- package/dist/esm/lib/components/v2/message-editor/hooks/useEditorContainerState.js +1 -21
- package/dist/esm/lib/components/v2/message-editor/hooks/useMentionUserSelection.js +1 -21
- package/dist/esm/lib/components/v2/message-editor/hooks/useMessageSubmit.js +1 -24
- package/dist/esm/lib/components/v2/message-editor/message-editor-context.js +1 -19
- package/dist/esm/lib/components/v2/message-editor/message-editor.js +1 -187
- package/dist/esm/lib/components/v2/message-editor/message-editor.types.js +1 -4
- package/dist/esm/lib/components/v2/message-editor/messages.js +1 -52
- package/dist/esm/lib/components/v2/message-editor/subcomponents/character-limit-counter.js +1 -26
- package/dist/esm/lib/components/v2/message-editor/subcomponents/edit-buttons.js +1 -32
- package/dist/esm/lib/components/v2/message-editor/subcomponents/error-message.js +1 -22
- package/dist/esm/lib/components/v2/message-editor/subcomponents/post-button.js +1 -29
- package/dist/esm/lib/components/v2/message-editor/subcomponents/timestamp-toggle.js +1 -2
- package/dist/esm/lib/components/v2/message-header/delete-confirmation-popover.js +1 -2
- package/dist/esm/lib/components/v2/message-header/message-header.js +1 -90
- package/dist/esm/lib/components/v2/message-header/message-options-menu.js +1 -49
- package/dist/esm/lib/components/v2/message-header/messages.js +2 -48
- package/dist/esm/lib/components/v2/messages-view/hooks/useAutoScroll.js +1 -69
- package/dist/esm/lib/components/v2/messages-view/messages-view.js +1 -2
- package/dist/esm/lib/components/v2/resolved-state/messages.js +1 -12
- package/dist/esm/lib/components/v2/resolved-state/resolved-state.js +1 -2
- package/dist/esm/lib/components/v2/show-replies-button/messages.js +1 -12
- package/dist/esm/lib/components/v2/show-replies-button/show-replies-button.js +1 -2
- package/dist/esm/lib/components/v2/text-message/constants.js +1 -2
- package/dist/esm/lib/components/v2/text-message/messages.js +1 -32
- package/dist/esm/lib/components/v2/text-message/subcomponents/message-footer.js +1 -64
- package/dist/esm/lib/components/v2/text-message/subcomponents/message-renderer.js +1 -87
- package/dist/esm/lib/components/v2/text-message/subcomponents/truncate-document.js +1 -113
- package/dist/esm/lib/components/v2/text-message/subcomponents/url-segments.js +1 -38
- package/dist/esm/lib/components/v2/text-message/text-message.js +1 -79
- package/dist/esm/lib/components/v2/user-avatar/getInitials.js +1 -5
- package/dist/esm/lib/components/v2/user-avatar/messages.js +1 -12
- package/dist/esm/lib/components/v2/user-avatar/user-avatar.js +1 -37
- package/dist/esm/lib/messages.js +1 -24
- package/dist/esm/lib/threaded-annotations.js +1 -2
- package/dist/esm/lib/utils/getErrorMessage.js +1 -2
- package/dist/esm/lib/v2/constants.js +1 -2
- package/dist/esm/lib/v2/messages.js +1 -6
- package/dist/esm/lib/v2/resin-targets.js +1 -25
- package/dist/esm/lib/v2/threaded-annotations-context.js +1 -61
- package/dist/esm/lib/v2/threaded-annotations.js +1 -2
- package/dist/esm/lib/v2/types/annotation-badge-types.js +1 -4
- package/dist/esm/lib/v2/types/index.js +1 -2
- package/dist/esm/lib/v2/utils/build-mention-content.js +1 -20
- package/dist/esm/lib/v2/utils/serialize-mention-markup.js +2 -12
- package/package.json +12 -12
|
@@ -1,48 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
deleteConfirmation: {
|
|
4
|
-
id: "groupSharedFeatures.threadedAnnotations.deleteConfirmation",
|
|
5
|
-
defaultMessage: "Delete confirmation"
|
|
6
|
-
},
|
|
7
|
-
deleteQuestion: {
|
|
8
|
-
id: "groupSharedFeatures.threadedAnnotations.deleteQuestion",
|
|
9
|
-
defaultMessage: "Delete this {type, select, annotation {annotation} other {comment}}{hasReplies, select, true { and replies} other {}}?\nThis action can't be undone."
|
|
10
|
-
},
|
|
11
|
-
deleteCancel: {
|
|
12
|
-
id: "groupSharedFeatures.threadedAnnotations.deleteCancel",
|
|
13
|
-
defaultMessage: "Cancel"
|
|
14
|
-
},
|
|
15
|
-
delete: {
|
|
16
|
-
id: "groupSharedFeatures.threadedAnnotations.delete",
|
|
17
|
-
defaultMessage: "Delete"
|
|
18
|
-
},
|
|
19
|
-
moreOptionsAriaLabel: {
|
|
20
|
-
id: "groupSharedFeatures.threadedAnnotations.moreOptionsAriaLabel",
|
|
21
|
-
defaultMessage: "More options button"
|
|
22
|
-
},
|
|
23
|
-
cancelDeleteButtonAriaLabel: {
|
|
24
|
-
id: "groupSharedFeatures.threadedAnnotations.cancelDeleteButtonAriaLabel",
|
|
25
|
-
defaultMessage: "Cancel delete button"
|
|
26
|
-
},
|
|
27
|
-
copyLink: {
|
|
28
|
-
id: "groupSharedFeatures.threadedAnnotations.copyLink",
|
|
29
|
-
defaultMessage: "Copy link"
|
|
30
|
-
},
|
|
31
|
-
deleteButtonAriaLabel: {
|
|
32
|
-
id: "groupSharedFeatures.threadedAnnotations.deleteButtonAriaLabel",
|
|
33
|
-
defaultMessage: "Delete button"
|
|
34
|
-
},
|
|
35
|
-
edit: {
|
|
36
|
-
id: "groupSharedFeatures.threadedAnnotations.edit",
|
|
37
|
-
defaultMessage: "Edit"
|
|
38
|
-
},
|
|
39
|
-
resolveButtonAriaLabel: {
|
|
40
|
-
id: "groupSharedFeatures.threadedAnnotations.resolveButtonAriaLabel",
|
|
41
|
-
defaultMessage: "Resolve"
|
|
42
|
-
},
|
|
43
|
-
unresolveButtonAriaLabel: {
|
|
44
|
-
id: "groupSharedFeatures.threadedAnnotations.unresolveButtonAriaLabel",
|
|
45
|
-
defaultMessage: "Unresolve"
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
export { t as default };
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({deleteConfirmation:{id:`groupSharedFeatures.threadedAnnotations.deleteConfirmation`,defaultMessage:`Delete confirmation`},deleteQuestion:{id:`groupSharedFeatures.threadedAnnotations.deleteQuestion`,defaultMessage:`Delete this {type, select, annotation {annotation} other {comment}}{hasReplies, select, true { and replies} other {}}?
|
|
2
|
+
This action can't be undone.`},deleteCancel:{id:`groupSharedFeatures.threadedAnnotations.deleteCancel`,defaultMessage:`Cancel`},delete:{id:`groupSharedFeatures.threadedAnnotations.delete`,defaultMessage:`Delete`},moreOptionsAriaLabel:{id:`groupSharedFeatures.threadedAnnotations.moreOptionsAriaLabel`,defaultMessage:`More options button`},cancelDeleteButtonAriaLabel:{id:`groupSharedFeatures.threadedAnnotations.cancelDeleteButtonAriaLabel`,defaultMessage:`Cancel delete button`},copyLink:{id:`groupSharedFeatures.threadedAnnotations.copyLink`,defaultMessage:`Copy link`},deleteButtonAriaLabel:{id:`groupSharedFeatures.threadedAnnotations.deleteButtonAriaLabel`,defaultMessage:`Delete button`},edit:{id:`groupSharedFeatures.threadedAnnotations.edit`,defaultMessage:`Edit`},resolveButtonAriaLabel:{id:`groupSharedFeatures.threadedAnnotations.resolveButtonAriaLabel`,defaultMessage:`Resolve`},unresolveButtonAriaLabel:{id:`groupSharedFeatures.threadedAnnotations.unresolveButtonAriaLabel`,defaultMessage:`Unresolve`}});export{messages as default};
|
|
@@ -1,69 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var i = 150, a = ({ messageCount: a, containerRef: o, enabled: s, isExpanded: c = !1, suppressAutoScroll: l = !1 }) => {
|
|
3
|
-
let u = n(!0), d = n(!1), [f, p] = r(!1), m = e(() => {
|
|
4
|
-
o.current && u.current && o.current.scrollTo({
|
|
5
|
-
top: o.current.scrollHeight,
|
|
6
|
-
behavior: "smooth"
|
|
7
|
-
});
|
|
8
|
-
}, [o]);
|
|
9
|
-
return t(() => {
|
|
10
|
-
if (s) {
|
|
11
|
-
if (l) {
|
|
12
|
-
d.current = !1;
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
if (d.current = !0, a > 0) {
|
|
16
|
-
let e = requestAnimationFrame(() => {
|
|
17
|
-
requestAnimationFrame(() => {
|
|
18
|
-
m(), d.current = !1;
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
return () => {
|
|
22
|
-
cancelAnimationFrame(e), d.current = !1;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
d.current = !1;
|
|
26
|
-
}
|
|
27
|
-
}, [
|
|
28
|
-
a,
|
|
29
|
-
m,
|
|
30
|
-
s,
|
|
31
|
-
l
|
|
32
|
-
]), t(() => {
|
|
33
|
-
if (!s) {
|
|
34
|
-
p(!1);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
let e = requestAnimationFrame(() => {
|
|
38
|
-
requestAnimationFrame(() => {
|
|
39
|
-
o.current && p(o.current.scrollHeight > o.current.clientHeight);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
return () => cancelAnimationFrame(e);
|
|
43
|
-
}, [
|
|
44
|
-
s,
|
|
45
|
-
a,
|
|
46
|
-
c,
|
|
47
|
-
o
|
|
48
|
-
]), {
|
|
49
|
-
handleScroll: () => {
|
|
50
|
-
if (!s || !o.current) return;
|
|
51
|
-
let { scrollTop: e, clientHeight: t, scrollHeight: n } = o.current, r = n - (e + t);
|
|
52
|
-
if (d.current) {
|
|
53
|
-
if (r === 0) {
|
|
54
|
-
d.current = !1;
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (r > i) {
|
|
60
|
-
u.current = !1;
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
u.current = !0;
|
|
64
|
-
},
|
|
65
|
-
handleScrollToBottom: m,
|
|
66
|
-
isOverflowing: f
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
export { a as useAutoScroll };
|
|
1
|
+
import{useCallback,useEffect,useRef,useState}from"react";var AUTO_SCROLL_THRESHOLD=150,useAutoScroll=({messageCount,containerRef,enabled,isExpanded=!1,suppressAutoScroll=!1})=>{let isAutoScrollEnabled=useRef(!0),isResizing=useRef(!1),[isOverflowing,setIsOverflowing]=useState(!1),handleScrollToBottom=useCallback(()=>{containerRef.current&&isAutoScrollEnabled.current&&containerRef.current.scrollTo({top:containerRef.current.scrollHeight,behavior:`smooth`})},[containerRef]);return useEffect(()=>{if(enabled){if(suppressAutoScroll){isResizing.current=!1;return}if(isResizing.current=!0,messageCount>0){let animationId=requestAnimationFrame(()=>{requestAnimationFrame(()=>{handleScrollToBottom(),isResizing.current=!1})});return()=>{cancelAnimationFrame(animationId),isResizing.current=!1}}isResizing.current=!1}},[messageCount,handleScrollToBottom,enabled,suppressAutoScroll]),useEffect(()=>{if(!enabled){setIsOverflowing(!1);return}let id=requestAnimationFrame(()=>{requestAnimationFrame(()=>{containerRef.current&&setIsOverflowing(containerRef.current.scrollHeight>containerRef.current.clientHeight)})});return()=>cancelAnimationFrame(id)},[enabled,messageCount,isExpanded,containerRef]),{handleScroll:()=>{if(!enabled||!containerRef.current)return;let{scrollTop,clientHeight,scrollHeight}=containerRef.current,threshold=scrollHeight-(scrollTop+clientHeight);if(isResizing.current){if(threshold===0){isResizing.current=!1;return}return}if(threshold>AUTO_SCROLL_THRESHOLD){isAutoScrollEnabled.current=!1;return}isAutoScrollEnabled.current=!0},handleScrollToBottom,isOverflowing}};export{useAutoScroll};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as MessagesView };
|
|
1
|
+
import{t as MessagesView}from"../../../../../chunks/messages-view.js";export{MessagesView};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var t = e({
|
|
3
|
-
markedAsResolved: {
|
|
4
|
-
id: "groupSharedFeatures.threadedAnnotations.markedAsResolved",
|
|
5
|
-
defaultMessage: "marked as resolved"
|
|
6
|
-
},
|
|
7
|
-
resolvedStateAriaLabel: {
|
|
8
|
-
id: "groupSharedFeatures.threadedAnnotations.resolvedStateAriaLabel",
|
|
9
|
-
defaultMessage: "Resolution status message"
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
export { t as default };
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({markedAsResolved:{id:`groupSharedFeatures.threadedAnnotations.markedAsResolved`,defaultMessage:`marked as resolved`},resolvedStateAriaLabel:{id:`groupSharedFeatures.threadedAnnotations.resolvedStateAriaLabel`,defaultMessage:`Resolution status message`}});export{messages as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as ResolvedState };
|
|
1
|
+
import{t as ResolvedState}from"../../../../../chunks/resolved-state.js";export{ResolvedState};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var t = e({
|
|
3
|
-
showReplies: {
|
|
4
|
-
id: "groupSharedFeatures.threadedAnnotations.showReplies",
|
|
5
|
-
defaultMessage: "{number, plural, one {Show # reply} other {Show # more replies}}"
|
|
6
|
-
},
|
|
7
|
-
showRepliesButtonAriaLabel: {
|
|
8
|
-
id: "groupSharedFeatures.threadedAnnotations.showRepliesButtonAriaLabel",
|
|
9
|
-
defaultMessage: "Reply button"
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
export { t as default };
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({showReplies:{id:`groupSharedFeatures.threadedAnnotations.showReplies`,defaultMessage:`{number, plural, one {Show # reply} other {Show # more replies}}`},showRepliesButtonAriaLabel:{id:`groupSharedFeatures.threadedAnnotations.showRepliesButtonAriaLabel`,defaultMessage:`Reply button`}});export{messages as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as ShowRepliesButton };
|
|
1
|
+
import{t as ShowRepliesButton}from"../../../../../chunks/show-replies-button.js";export{ShowRepliesButton};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
export { e as COMMENT_TRUNCATION_THRESHOLD };
|
|
1
|
+
var COMMENT_TRUNCATION_THRESHOLD=450;export{COMMENT_TRUNCATION_THRESHOLD};
|
|
@@ -1,32 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var t = e({
|
|
3
|
-
annotationMessageAriaLabel: {
|
|
4
|
-
id: "groupSharedFeatures.threadedAnnotations.annotationMessageAriaLabel",
|
|
5
|
-
defaultMessage: "Annotation message"
|
|
6
|
-
},
|
|
7
|
-
edited: {
|
|
8
|
-
id: "groupSharedFeatures.threadedAnnotations.edited",
|
|
9
|
-
defaultMessage: "(Edited)"
|
|
10
|
-
},
|
|
11
|
-
editedTooltip: {
|
|
12
|
-
id: "groupSharedFeatures.threadedAnnotations.editedTooltip",
|
|
13
|
-
defaultMessage: "Edited {time}"
|
|
14
|
-
},
|
|
15
|
-
reply: {
|
|
16
|
-
id: "groupSharedFeatures.threadedAnnotations.reply",
|
|
17
|
-
defaultMessage: "Reply"
|
|
18
|
-
},
|
|
19
|
-
replyButtonAriaLabel: {
|
|
20
|
-
id: "groupSharedFeatures.threadedAnnotations.replyButtonAriaLabel",
|
|
21
|
-
defaultMessage: "Reply button"
|
|
22
|
-
},
|
|
23
|
-
seeMore: {
|
|
24
|
-
id: "groupSharedFeatures.threadedAnnotations.seeMore",
|
|
25
|
-
defaultMessage: "See More"
|
|
26
|
-
},
|
|
27
|
-
textMessageAriaLabel: {
|
|
28
|
-
id: "groupSharedFeatures.threadedAnnotations.textMessageAriaLabel",
|
|
29
|
-
defaultMessage: "Message text"
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
export { t as default };
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({annotationMessageAriaLabel:{id:`groupSharedFeatures.threadedAnnotations.annotationMessageAriaLabel`,defaultMessage:`Annotation message`},edited:{id:`groupSharedFeatures.threadedAnnotations.edited`,defaultMessage:`(Edited)`},editedTooltip:{id:`groupSharedFeatures.threadedAnnotations.editedTooltip`,defaultMessage:`Edited {time}`},reply:{id:`groupSharedFeatures.threadedAnnotations.reply`,defaultMessage:`Reply`},replyButtonAriaLabel:{id:`groupSharedFeatures.threadedAnnotations.replyButtonAriaLabel`,defaultMessage:`Reply button`},seeMore:{id:`groupSharedFeatures.threadedAnnotations.seeMore`,defaultMessage:`See More`},textMessageAriaLabel:{id:`groupSharedFeatures.threadedAnnotations.textMessageAriaLabel`,defaultMessage:`Message text`}});export{messages as default};
|
|
@@ -1,64 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import t from "../messages.js";
|
|
3
|
-
import { t as n } from "../../../../../../chunks/text-message.module.js";
|
|
4
|
-
import { Button as r, Focusable as i, Text as a, Tooltip as o } from "@box/blueprint-web";
|
|
5
|
-
import { useIntl as s } from "react-intl";
|
|
6
|
-
import { getReadableTime as c } from "@box/readable-time";
|
|
7
|
-
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
|
-
var d = ({ createdAt: d, onReply: f, updatedAt: p }) => {
|
|
9
|
-
let m = s();
|
|
10
|
-
return /* @__PURE__ */ u("div", {
|
|
11
|
-
className: n.messageFooter,
|
|
12
|
-
children: [
|
|
13
|
-
/* @__PURE__ */ l(o, {
|
|
14
|
-
content: c({
|
|
15
|
-
alwaysShowTime: !0,
|
|
16
|
-
intl: m,
|
|
17
|
-
relativeThreshold: 0,
|
|
18
|
-
timestamp: d
|
|
19
|
-
}),
|
|
20
|
-
children: /* @__PURE__ */ l(i, {
|
|
21
|
-
className: n.readableTimeWrapper,
|
|
22
|
-
"data-no-expand": !0,
|
|
23
|
-
children: /* @__PURE__ */ l(a, {
|
|
24
|
-
as: "span",
|
|
25
|
-
color: "textOnLightSecondary",
|
|
26
|
-
variant: "bodySmall",
|
|
27
|
-
children: c({
|
|
28
|
-
intl: m,
|
|
29
|
-
timestamp: d
|
|
30
|
-
})
|
|
31
|
-
})
|
|
32
|
-
})
|
|
33
|
-
}),
|
|
34
|
-
p !== void 0 && /* @__PURE__ */ l(o, {
|
|
35
|
-
content: m.formatMessage(t.editedTooltip, { time: c({
|
|
36
|
-
alwaysShowTime: !0,
|
|
37
|
-
intl: m,
|
|
38
|
-
relativeThreshold: 0,
|
|
39
|
-
timestamp: p
|
|
40
|
-
}) }),
|
|
41
|
-
children: /* @__PURE__ */ l(i, {
|
|
42
|
-
"data-no-expand": !0,
|
|
43
|
-
children: /* @__PURE__ */ l(a, {
|
|
44
|
-
as: "span",
|
|
45
|
-
color: "textOnLightSecondary",
|
|
46
|
-
variant: "bodySmall",
|
|
47
|
-
children: m.formatMessage(t.edited)
|
|
48
|
-
})
|
|
49
|
-
})
|
|
50
|
-
}),
|
|
51
|
-
f && /* @__PURE__ */ l(r, {
|
|
52
|
-
"aria-label": m.formatMessage(t.replyButtonAriaLabel),
|
|
53
|
-
className: n.replyButton,
|
|
54
|
-
"data-no-expand": !0,
|
|
55
|
-
"data-resin-target": e.COMMENT_REPLY,
|
|
56
|
-
size: "x-small",
|
|
57
|
-
variant: "quaternary",
|
|
58
|
-
onClick: f,
|
|
59
|
-
children: m.formatMessage(t.reply)
|
|
60
|
-
})
|
|
61
|
-
]
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
export { d as MessageFooter };
|
|
1
|
+
import{THREADED_ANNOTATIONS_RESIN_TARGETS}from"../../../../v2/resin-targets.js";import messages from"../messages.js";import{t as text_message_module_default}from"../../../../../../chunks/text-message.module.js";import{Button,Focusable,Text,Tooltip}from"@box/blueprint-web";import{useIntl}from"react-intl";import{getReadableTime}from"@box/readable-time";import{jsx,jsxs}from"react/jsx-runtime";var MessageFooter=({createdAt,onReply,updatedAt})=>{let intl=useIntl();return jsxs(`div`,{className:text_message_module_default.messageFooter,children:[jsx(Tooltip,{content:getReadableTime({alwaysShowTime:!0,intl,relativeThreshold:0,timestamp:createdAt}),children:jsx(Focusable,{className:text_message_module_default.readableTimeWrapper,"data-no-expand":!0,children:jsx(Text,{as:`span`,color:`textOnLightSecondary`,variant:`bodySmall`,children:getReadableTime({intl,timestamp:createdAt})})})}),updatedAt!==void 0&&jsx(Tooltip,{content:intl.formatMessage(messages.editedTooltip,{time:getReadableTime({alwaysShowTime:!0,intl,relativeThreshold:0,timestamp:updatedAt})}),children:jsx(Focusable,{"data-no-expand":!0,children:jsx(Text,{as:`span`,color:`textOnLightSecondary`,variant:`bodySmall`,children:intl.formatMessage(messages.edited)})})}),onReply&&jsx(Button,{"aria-label":intl.formatMessage(messages.replyButtonAriaLabel),className:text_message_module_default.replyButton,"data-no-expand":!0,"data-resin-target":THREADED_ANNOTATIONS_RESIN_TARGETS.COMMENT_REPLY,size:`x-small`,variant:`quaternary`,onClick:onReply,children:intl.formatMessage(messages.reply)})]})};export{MessageFooter};
|
|
@@ -1,87 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import t from "../messages.js";
|
|
3
|
-
import { t as n } from "../../../../../../chunks/text-message.module.js";
|
|
4
|
-
import "../constants.js";
|
|
5
|
-
import { splitTextIntoSegments as r } from "./url-segments.js";
|
|
6
|
-
import { getDocumentLength as i, truncateDocument as a } from "./truncate-document.js";
|
|
7
|
-
import { Link as o, Text as s, TextButton as c } from "@box/blueprint-web";
|
|
8
|
-
import { useState as l } from "react";
|
|
9
|
-
import { useIntl as u } from "react-intl";
|
|
10
|
-
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
11
|
-
var p = ({ node: t, index: n, paragraphIndex: r }) => {
|
|
12
|
-
let i = `mention-${t.attrs.mentionedUserId}-${r}-${n}`;
|
|
13
|
-
return /* @__PURE__ */ d(e, {
|
|
14
|
-
authorId: t.attrs.authorId,
|
|
15
|
-
mentionedUserEmail: t.attrs.mentionedUserEmail,
|
|
16
|
-
mentionedUserId: t.attrs.mentionedUserId,
|
|
17
|
-
mentionedUserName: t.attrs.mentionedUserName,
|
|
18
|
-
mentionId: t.attrs.mentionId
|
|
19
|
-
}, i);
|
|
20
|
-
}, m = (e) => {
|
|
21
|
-
e.currentTarget.closest("[data-thread-expandable]") && e.preventDefault();
|
|
22
|
-
}, h = ({ node: e, index: n, paragraphIndex: i, intl: a }) => {
|
|
23
|
-
let c = `text-${e.text.substring(0, 20)}-${i}-${n}`, l = r(e.text);
|
|
24
|
-
return /* @__PURE__ */ d(s, {
|
|
25
|
-
"aria-label": a.formatMessage(t.textMessageAriaLabel),
|
|
26
|
-
as: "span",
|
|
27
|
-
color: "textOnLightDefault",
|
|
28
|
-
variant: "bodyDefault",
|
|
29
|
-
children: l.map((e, t) => e.type === "url" ? /* @__PURE__ */ d(o, {
|
|
30
|
-
href: e.value,
|
|
31
|
-
inheritFont: !0,
|
|
32
|
-
rel: "noopener noreferrer",
|
|
33
|
-
target: "_blank",
|
|
34
|
-
onClick: m,
|
|
35
|
-
children: e.value
|
|
36
|
-
}, `${c}-segment-${t}`) : e.value)
|
|
37
|
-
}, c);
|
|
38
|
-
}, g = ({ content: e, paragraphIndex: t, intl: n }) => e.map((e, r) => {
|
|
39
|
-
switch (e.type) {
|
|
40
|
-
case "mention": return p({
|
|
41
|
-
node: e,
|
|
42
|
-
index: r,
|
|
43
|
-
paragraphIndex: t
|
|
44
|
-
});
|
|
45
|
-
case "text": return h({
|
|
46
|
-
node: e,
|
|
47
|
-
index: r,
|
|
48
|
-
paragraphIndex: t,
|
|
49
|
-
intl: n
|
|
50
|
-
});
|
|
51
|
-
default: return [];
|
|
52
|
-
}
|
|
53
|
-
}), _ = ({ paragraph: e, index: t, intl: n, inlineSuffix: r }) => {
|
|
54
|
-
let i = e.content || [], a = `paragraph-${t}`;
|
|
55
|
-
return /* @__PURE__ */ f(s, {
|
|
56
|
-
as: "p",
|
|
57
|
-
variant: "bodyDefault",
|
|
58
|
-
children: [i.length > 0 ? g({
|
|
59
|
-
content: i,
|
|
60
|
-
paragraphIndex: t,
|
|
61
|
-
intl: n
|
|
62
|
-
}) : /* @__PURE__ */ d("br", {}), r]
|
|
63
|
-
}, a);
|
|
64
|
-
}, v = ({ messageObject: e }) => {
|
|
65
|
-
let r = u(), [o, s] = l(!1);
|
|
66
|
-
if (!e.content || e.content.length === 0) return null;
|
|
67
|
-
let f = i(e), p = !o && f > 450, m = p ? a(e, 450) : e, h = m.content.length - 1;
|
|
68
|
-
for (let e = m.content.length - 1; e >= 0; --e) if ((m.content[e].content?.length ?? 0) > 0) {
|
|
69
|
-
h = e;
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
let g = p ? /* @__PURE__ */ d(c, {
|
|
73
|
-
className: n.seeMoreButton,
|
|
74
|
-
color: "textOnLightLink",
|
|
75
|
-
"data-no-expand": !0,
|
|
76
|
-
onClick: () => s(!0),
|
|
77
|
-
variant: "bodyDefaultBold",
|
|
78
|
-
children: r.formatMessage(t.seeMore)
|
|
79
|
-
}) : null;
|
|
80
|
-
return m.content.map((e, t) => _({
|
|
81
|
-
paragraph: e,
|
|
82
|
-
index: t,
|
|
83
|
-
intl: r,
|
|
84
|
-
inlineSuffix: t === h ? g : null
|
|
85
|
-
}));
|
|
86
|
-
};
|
|
87
|
-
export { v as MessageRenderer };
|
|
1
|
+
import{t as MentionComponent}from"../../../../../../chunks/mention-component.js";import messages from"../messages.js";import{t as text_message_module_default}from"../../../../../../chunks/text-message.module.js";import"../constants.js";import{splitTextIntoSegments}from"./url-segments.js";import{getDocumentLength,truncateDocument}from"./truncate-document.js";import{Link,Text,TextButton}from"@box/blueprint-web";import{useState}from"react";import{useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";var renderMentionNode=({node,index,paragraphIndex})=>{let key=`mention-${node.attrs.mentionedUserId}-${paragraphIndex}-${index}`;return jsx(MentionComponent,{authorId:node.attrs.authorId,mentionedUserEmail:node.attrs.mentionedUserEmail,mentionedUserId:node.attrs.mentionedUserId,mentionedUserName:node.attrs.mentionedUserName,mentionId:node.attrs.mentionId},key)},handleMessageLinkClick=event=>{event.currentTarget.closest(`[data-thread-expandable]`)&&event.preventDefault()},renderTextNode=({node,index,paragraphIndex,intl})=>{let key=`text-${node.text.substring(0,20)}-${paragraphIndex}-${index}`,segments=splitTextIntoSegments(node.text);return jsx(Text,{"aria-label":intl.formatMessage(messages.textMessageAriaLabel),as:`span`,color:`textOnLightDefault`,variant:`bodyDefault`,children:segments.map((segment,segmentIndex)=>segment.type===`url`?jsx(Link,{href:segment.value,inheritFont:!0,rel:`noopener noreferrer`,target:`_blank`,onClick:handleMessageLinkClick,children:segment.value},`${key}-segment-${segmentIndex}`):segment.value)},key)},renderParagraphContent=({content,paragraphIndex,intl})=>content.map((node,index)=>{switch(node.type){case`mention`:return renderMentionNode({node,index,paragraphIndex});case`text`:return renderTextNode({node,index,paragraphIndex,intl});default:return[]}}),renderParagraphNode=({paragraph,index,intl,inlineSuffix})=>{let content=paragraph.content||[],key=`paragraph-${index}`;return jsxs(Text,{as:`p`,variant:`bodyDefault`,children:[content.length>0?renderParagraphContent({content,paragraphIndex:index,intl}):jsx(`br`,{}),inlineSuffix]},key)},MessageRenderer=({messageObject})=>{let intl=useIntl(),[isExpanded,setIsExpanded]=useState(!1);if(!messageObject.content||messageObject.content.length===0)return null;let totalLength=getDocumentLength(messageObject),isTruncated=!isExpanded&&totalLength>450,documentToRender=isTruncated?truncateDocument(messageObject,450):messageObject,suffixAnchorIndex=documentToRender.content.length-1;for(let i=documentToRender.content.length-1;i>=0;--i)if((documentToRender.content[i].content?.length??0)>0){suffixAnchorIndex=i;break}let seeMoreButton=isTruncated?jsx(TextButton,{className:text_message_module_default.seeMoreButton,color:`textOnLightLink`,"data-no-expand":!0,onClick:()=>setIsExpanded(!0),variant:`bodyDefaultBold`,children:intl.formatMessage(messages.seeMore)}):null;return documentToRender.content.map((paragraph,index)=>renderParagraphNode({paragraph,index,intl,inlineSuffix:index===suffixAnchorIndex?seeMoreButton:null}))};export{MessageRenderer};
|
|
@@ -1,113 +1 @@
|
|
|
1
|
-
import { splitTextIntoSegments
|
|
2
|
-
var t = "…", n = (e) => `@${e.attrs.mentionedUserName}`.length, r = (e) => {
|
|
3
|
-
let t = 0;
|
|
4
|
-
for (let r of e.content) for (let e of r.content || []) e.type === "text" ? t += e.text.length : e.type === "mention" && (t += n(e));
|
|
5
|
-
return t;
|
|
6
|
-
}, i = (t) => {
|
|
7
|
-
let n = [];
|
|
8
|
-
return t.content.forEach((t, r) => {
|
|
9
|
-
r > 0 && n.push({
|
|
10
|
-
kind: "paragraph-break",
|
|
11
|
-
sourceParagraph: t
|
|
12
|
-
});
|
|
13
|
-
for (let r of t.content || []) if (r.type === "mention") n.push({
|
|
14
|
-
kind: "mention",
|
|
15
|
-
node: r
|
|
16
|
-
});
|
|
17
|
-
else if (r.type === "text") for (let t of e(r.text)) n.push({
|
|
18
|
-
kind: t.type,
|
|
19
|
-
value: t.value,
|
|
20
|
-
sourceNode: r
|
|
21
|
-
});
|
|
22
|
-
}), n;
|
|
23
|
-
}, a = (e, t) => {
|
|
24
|
-
let r = [], i = [], a = t, o = (e) => {
|
|
25
|
-
r.push(...i, e), i.length = 0;
|
|
26
|
-
};
|
|
27
|
-
for (let t of e) if (t.kind === "paragraph-break") i.push(t);
|
|
28
|
-
else if (a <= 0) return {
|
|
29
|
-
collected: r,
|
|
30
|
-
truncated: !0
|
|
31
|
-
};
|
|
32
|
-
else if (t.kind === "mention") {
|
|
33
|
-
let e = n(t.node);
|
|
34
|
-
if (e > a) return {
|
|
35
|
-
collected: r,
|
|
36
|
-
truncated: !0
|
|
37
|
-
};
|
|
38
|
-
o(t), a -= e;
|
|
39
|
-
} else if (t.kind === "url") {
|
|
40
|
-
if (t.value.length > a) return {
|
|
41
|
-
collected: r,
|
|
42
|
-
truncated: !0
|
|
43
|
-
};
|
|
44
|
-
o(t), a -= t.value.length;
|
|
45
|
-
} else if (t.value.length <= a) o(t), a -= t.value.length;
|
|
46
|
-
else return o({
|
|
47
|
-
...t,
|
|
48
|
-
value: t.value.slice(0, a)
|
|
49
|
-
}), {
|
|
50
|
-
collected: r,
|
|
51
|
-
truncated: !0
|
|
52
|
-
};
|
|
53
|
-
return {
|
|
54
|
-
collected: r,
|
|
55
|
-
truncated: !1
|
|
56
|
-
};
|
|
57
|
-
}, o = (e, t) => {
|
|
58
|
-
let n = [], r = [], i = t, a = null, o = () => {
|
|
59
|
-
n.push({
|
|
60
|
-
...i,
|
|
61
|
-
content: r
|
|
62
|
-
}), r = [], a = null;
|
|
63
|
-
};
|
|
64
|
-
for (let t of e) if (t.kind === "paragraph-break") o(), i = t.sourceParagraph;
|
|
65
|
-
else if (t.kind === "mention") r.push(t.node), a = null;
|
|
66
|
-
else if (a === t.sourceNode) {
|
|
67
|
-
let e = r[r.length - 1];
|
|
68
|
-
r[r.length - 1] = {
|
|
69
|
-
...e,
|
|
70
|
-
text: e.text + t.value
|
|
71
|
-
};
|
|
72
|
-
} else r.push({
|
|
73
|
-
...t.sourceNode,
|
|
74
|
-
text: t.value
|
|
75
|
-
}), a = t.sourceNode;
|
|
76
|
-
return o(), n;
|
|
77
|
-
}, s = (e) => {
|
|
78
|
-
let n = -1;
|
|
79
|
-
for (let t = e.length - 1; t >= 0; --t) if ((e[t].content?.length ?? 0) > 0) {
|
|
80
|
-
n = t;
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
if (n === -1) return [...e, {
|
|
84
|
-
type: "paragraph",
|
|
85
|
-
content: [{
|
|
86
|
-
type: "text",
|
|
87
|
-
text: t
|
|
88
|
-
}]
|
|
89
|
-
}];
|
|
90
|
-
let r = e[n].content || [], i = r[r.length - 1], a;
|
|
91
|
-
if (i?.type === "text") {
|
|
92
|
-
if (i.text.endsWith(t)) return e;
|
|
93
|
-
a = [...r.slice(0, -1), {
|
|
94
|
-
...i,
|
|
95
|
-
text: `${i.text}${t}`
|
|
96
|
-
}];
|
|
97
|
-
} else a = [...r, {
|
|
98
|
-
type: "text",
|
|
99
|
-
text: t
|
|
100
|
-
}];
|
|
101
|
-
return e.map((e, t) => t === n ? {
|
|
102
|
-
...e,
|
|
103
|
-
content: a
|
|
104
|
-
} : e);
|
|
105
|
-
}, c = (e, t) => {
|
|
106
|
-
if (e.content.length === 0) return e;
|
|
107
|
-
let { collected: n, truncated: r } = a(i(e), t), c = o(n, e.content[0]), l = r ? s(c) : c;
|
|
108
|
-
return {
|
|
109
|
-
...e,
|
|
110
|
-
content: l
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
export { r as getDocumentLength, c as truncateDocument };
|
|
1
|
+
import{splitTextIntoSegments}from"./url-segments.js";var TRUNCATION_ELLIPSIS=`…`,getMentionDisplayLength=node=>`@${node.attrs.mentionedUserName}`.length,getDocumentLength=document=>{let total=0;for(let paragraph of document.content)for(let node of paragraph.content||[])node.type===`text`?total+=node.text.length:node.type===`mention`&&(total+=getMentionDisplayLength(node));return total},flattenDocument=document=>{let atoms=[];return document.content.forEach((paragraph,paragraphIndex)=>{paragraphIndex>0&&atoms.push({kind:`paragraph-break`,sourceParagraph:paragraph});for(let node of paragraph.content||[])if(node.type===`mention`)atoms.push({kind:`mention`,node});else if(node.type===`text`)for(let segment of splitTextIntoSegments(node.text))atoms.push({kind:segment.type,value:segment.value,sourceNode:node})}),atoms},collectAtomsWithinThreshold=(atoms,threshold)=>{let collected=[],pendingBreaks=[],remaining=threshold,accept=atom=>{collected.push(...pendingBreaks,atom),pendingBreaks.length=0};for(let atom of atoms)if(atom.kind===`paragraph-break`)pendingBreaks.push(atom);else if(remaining<=0)return{collected,truncated:!0};else if(atom.kind===`mention`){let length=getMentionDisplayLength(atom.node);if(length>remaining)return{collected,truncated:!0};accept(atom),remaining-=length}else if(atom.kind===`url`){if(atom.value.length>remaining)return{collected,truncated:!0};accept(atom),remaining-=atom.value.length}else if(atom.value.length<=remaining)accept(atom),remaining-=atom.value.length;else return accept({...atom,value:atom.value.slice(0,remaining)}),{collected,truncated:!0};return{collected,truncated:!1}},reassembleParagraphs=(atoms,firstParagraph)=>{let paragraphs=[],currentNodes=[],currentSource=firstParagraph,lastTextSourceNode=null,flushParagraph=()=>{paragraphs.push({...currentSource,content:currentNodes}),currentNodes=[],lastTextSourceNode=null};for(let atom of atoms)if(atom.kind===`paragraph-break`)flushParagraph(),currentSource=atom.sourceParagraph;else if(atom.kind===`mention`)currentNodes.push(atom.node),lastTextSourceNode=null;else if(lastTextSourceNode===atom.sourceNode){let previousTextNode=currentNodes[currentNodes.length-1];currentNodes[currentNodes.length-1]={...previousTextNode,text:previousTextNode.text+atom.value}}else currentNodes.push({...atom.sourceNode,text:atom.value}),lastTextSourceNode=atom.sourceNode;return flushParagraph(),paragraphs},withTruncationEllipsis=paragraphs=>{let lastNonEmptyIndex=-1;for(let i=paragraphs.length-1;i>=0;--i)if((paragraphs[i].content?.length??0)>0){lastNonEmptyIndex=i;break}if(lastNonEmptyIndex===-1)return[...paragraphs,{type:`paragraph`,content:[{type:`text`,text:TRUNCATION_ELLIPSIS}]}];let targetContent=paragraphs[lastNonEmptyIndex].content||[],lastChild=targetContent[targetContent.length-1],updatedContent;if(lastChild?.type===`text`){if(lastChild.text.endsWith(TRUNCATION_ELLIPSIS))return paragraphs;updatedContent=[...targetContent.slice(0,-1),{...lastChild,text:`${lastChild.text}${TRUNCATION_ELLIPSIS}`}]}else updatedContent=[...targetContent,{type:`text`,text:TRUNCATION_ELLIPSIS}];return paragraphs.map((paragraph,index)=>index===lastNonEmptyIndex?{...paragraph,content:updatedContent}:paragraph)},truncateDocument=(document,threshold)=>{if(document.content.length===0)return document;let{collected,truncated}=collectAtomsWithinThreshold(flattenDocument(document),threshold),paragraphs=reassembleParagraphs(collected,document.content[0]),finalParagraphs=truncated?withTruncationEllipsis(paragraphs):paragraphs;return{...document,content:finalParagraphs}};export{getDocumentLength,truncateDocument};
|
|
@@ -1,38 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
")": "(",
|
|
3
|
-
"]": "[",
|
|
4
|
-
")": "(",
|
|
5
|
-
"】": "【",
|
|
6
|
-
"」": "「",
|
|
7
|
-
"』": "『"
|
|
8
|
-
}, r = (e) => {
|
|
9
|
-
let r = e[e.length - 1];
|
|
10
|
-
if (t.test(r)) return !0;
|
|
11
|
-
let i = n[r];
|
|
12
|
-
if (i) {
|
|
13
|
-
let t = e.split(i).length - 1;
|
|
14
|
-
return e.split(r).length - 1 > t;
|
|
15
|
-
}
|
|
16
|
-
return !1;
|
|
17
|
-
}, i = (e) => {
|
|
18
|
-
let t = e;
|
|
19
|
-
for (; t.length > 0 && r(t);) t = t.slice(0, -1);
|
|
20
|
-
return t;
|
|
21
|
-
}, a = (t) => {
|
|
22
|
-
let n = Array.from(t.matchAll(e)).filter((e) => e.index !== void 0), r = [], a = 0;
|
|
23
|
-
for (let e of n) {
|
|
24
|
-
let n = e.index, o = i(e[0]), s = n + o.length;
|
|
25
|
-
n > a && r.push({
|
|
26
|
-
type: "text",
|
|
27
|
-
value: t.slice(a, n)
|
|
28
|
-
}), r.push({
|
|
29
|
-
type: "url",
|
|
30
|
-
value: o
|
|
31
|
-
}), a = s;
|
|
32
|
-
}
|
|
33
|
-
return a < t.length && r.push({
|
|
34
|
-
type: "text",
|
|
35
|
-
value: t.slice(a)
|
|
36
|
-
}), r;
|
|
37
|
-
};
|
|
38
|
-
export { e as URL_REGEX, a as splitTextIntoSegments, i as trimTrailingChars };
|
|
1
|
+
var URL_REGEX=/((?:(?:ht|f)tps?:\/\/)[\w.-]+(?::\d+)?(?:\/[\w\-.~+/#?&%=:[\]@!$'()*;,]*)?)/gi,SENTENCE_PUNCTUATION=/[.,;:!?。、!?;:,،؛؟]/,BRACKET_PAIRS={")":`(`,"]":`[`,")":`(`,"】":`【`,"」":`「`,"』":`『`},shouldTrimLastChar=url=>{let lastChar=url[url.length-1];if(SENTENCE_PUNCTUATION.test(lastChar))return!0;let opener=BRACKET_PAIRS[lastChar];if(opener){let openCount=url.split(opener).length-1;return url.split(lastChar).length-1>openCount}return!1},trimTrailingChars=url=>{let trimmed=url;for(;trimmed.length>0&&shouldTrimLastChar(trimmed);)trimmed=trimmed.slice(0,-1);return trimmed},splitTextIntoSegments=text=>{let matches=Array.from(text.matchAll(URL_REGEX)).filter(match=>match.index!==void 0),segments=[],cursor=0;for(let match of matches){let matchStart=match.index,url=trimTrailingChars(match[0]),matchEnd=matchStart+url.length;matchStart>cursor&&segments.push({type:`text`,value:text.slice(cursor,matchStart)}),segments.push({type:`url`,value:url}),cursor=matchEnd}return cursor<text.length&&segments.push({type:`text`,value:text.slice(cursor)}),segments};export{URL_REGEX,splitTextIntoSegments,trimTrailingChars};
|
|
@@ -1,79 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { MessageEditorVariant as t } from "../message-editor/message-editor.types.js";
|
|
3
|
-
import { MessageEditor as n } from "../message-editor/message-editor.js";
|
|
4
|
-
import { useThreadedAnnotationsContext as r } from "../../../v2/threaded-annotations-context.js";
|
|
5
|
-
import { t as i } from "../../../../../chunks/annotation-badge.js";
|
|
6
|
-
import { MessageHeader as a } from "../message-header/message-header.js";
|
|
7
|
-
import o from "./messages.js";
|
|
8
|
-
import { t as s } from "../../../../../chunks/text-message.module.js";
|
|
9
|
-
import { MessageFooter as c } from "./subcomponents/message-footer.js";
|
|
10
|
-
import { MessageRenderer as l } from "./subcomponents/message-renderer.js";
|
|
11
|
-
import u from "clsx";
|
|
12
|
-
import { useIntl as d } from "react-intl";
|
|
13
|
-
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
14
|
-
var h = ({ id: h, author: g, message: _, createdAt: v, updatedAt: y, permissions: b, showThreadedIndicator: x = !0, isResolved: S = !1, isFirstMessage: C = !1, hasReplies: w = !1, maxCharacterCount: T, onAvatarClick: E, onCopyLink: D, onDelete: O, onThreadDelete: k, onEdit: A, onEditError: j, onResolve: M, onUnresolve: N, userSelectorProps: P, annotationTarget: F, onAnnotationBadgeClick: I, originalContentDeleted: L }) => {
|
|
15
|
-
let { canResolve: R, canEdit: z, canDelete: B } = b, V = d(), { dispatch: H, isReplyDisabled: U, isEditDisabled: W, isAnnotations: G, editingMessageId: K } = r(), q = K === h, J = !!A && !W && z;
|
|
16
|
-
return /* @__PURE__ */ m("div", {
|
|
17
|
-
"aria-label": V.formatMessage(o.annotationMessageAriaLabel),
|
|
18
|
-
className: s.textMessage,
|
|
19
|
-
"data-message-wrapper": !0,
|
|
20
|
-
"data-message-id": h,
|
|
21
|
-
"data-resin-component": e.COMMENT_CARD,
|
|
22
|
-
children: [/* @__PURE__ */ p(a, {
|
|
23
|
-
author: g,
|
|
24
|
-
canResolve: R,
|
|
25
|
-
isResolved: S,
|
|
26
|
-
canDelete: B,
|
|
27
|
-
canEdit: J,
|
|
28
|
-
hasReplies: w,
|
|
29
|
-
isFirstMessage: C,
|
|
30
|
-
onAvatarClick: E,
|
|
31
|
-
onCopyLink: D ? () => D(h) : void 0,
|
|
32
|
-
onDelete: () => O(h),
|
|
33
|
-
onThreadDelete: k,
|
|
34
|
-
onEdit: J ? () => H({
|
|
35
|
-
type: "EDIT",
|
|
36
|
-
id: h
|
|
37
|
-
}) : void 0,
|
|
38
|
-
onResolve: M ? () => M(h) : void 0,
|
|
39
|
-
onUnresolve: N ? () => N(h) : void 0
|
|
40
|
-
}), /* @__PURE__ */ m("div", {
|
|
41
|
-
className: s.contentWrapper,
|
|
42
|
-
children: [/* @__PURE__ */ p("div", { className: u(s.threadedIndicator, !x && s.threadedIndicatorHidden) }), /* @__PURE__ */ m("div", {
|
|
43
|
-
className: s.messageContent,
|
|
44
|
-
children: [F && !G && /* @__PURE__ */ p("div", {
|
|
45
|
-
className: s.annotationBadgeWrapper,
|
|
46
|
-
children: /* @__PURE__ */ p(i, {
|
|
47
|
-
annotationTarget: F,
|
|
48
|
-
onClick: () => I?.(h),
|
|
49
|
-
originalContentDeleted: L
|
|
50
|
-
})
|
|
51
|
-
}), q && A ? /* @__PURE__ */ p("div", {
|
|
52
|
-
className: s.inlineEditSlot,
|
|
53
|
-
children: /* @__PURE__ */ p(n, {
|
|
54
|
-
initialContent: _,
|
|
55
|
-
maxCharacterCount: T,
|
|
56
|
-
onEditCancel: () => H({ type: "CLEAR_EDIT" }),
|
|
57
|
-
onEditSuccess: () => H({ type: "CLEAR_EDIT" }),
|
|
58
|
-
onSave: (e) => A(h, e),
|
|
59
|
-
onSaveError: j,
|
|
60
|
-
userSelectorProps: P,
|
|
61
|
-
variant: t.EDIT_MESSAGE
|
|
62
|
-
})
|
|
63
|
-
}) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", {
|
|
64
|
-
className: s.rendererWrapper,
|
|
65
|
-
"data-message-body": !0,
|
|
66
|
-
children: /* @__PURE__ */ p(l, { messageObject: _ })
|
|
67
|
-
}), /* @__PURE__ */ p(c, {
|
|
68
|
-
createdAt: v,
|
|
69
|
-
onReply: U ? void 0 : () => H({
|
|
70
|
-
type: "REPLY",
|
|
71
|
-
author: g
|
|
72
|
-
}),
|
|
73
|
-
updatedAt: y
|
|
74
|
-
})] })]
|
|
75
|
-
})]
|
|
76
|
-
})]
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
export { h as TextMessage };
|
|
1
|
+
import{THREADED_ANNOTATIONS_RESIN_COMPONENTS}from"../../../v2/resin-targets.js";import{MessageEditorVariant}from"../message-editor/message-editor.types.js";import{MessageEditor}from"../message-editor/message-editor.js";import{useThreadedAnnotationsContext}from"../../../v2/threaded-annotations-context.js";import{t as AnnotationBadge}from"../../../../../chunks/annotation-badge.js";import{MessageHeader}from"../message-header/message-header.js";import messages from"./messages.js";import{t as text_message_module_default}from"../../../../../chunks/text-message.module.js";import{MessageFooter}from"./subcomponents/message-footer.js";import{MessageRenderer}from"./subcomponents/message-renderer.js";import clsx from"clsx";import{useIntl}from"react-intl";import{Fragment,jsx,jsxs}from"react/jsx-runtime";var TextMessage=({id,author,message,createdAt,updatedAt,permissions,showThreadedIndicator=!0,isResolved=!1,isFirstMessage=!1,hasReplies=!1,maxCharacterCount,onAvatarClick,onCopyLink,onDelete,onThreadDelete,onEdit,onEditError,onResolve,onUnresolve,userSelectorProps,annotationTarget,onAnnotationBadgeClick,originalContentDeleted})=>{let{canResolve,canEdit,canDelete}=permissions,intl=useIntl(),{dispatch,isReplyDisabled,isEditDisabled,isAnnotations,editingMessageId}=useThreadedAnnotationsContext(),isEditing=editingMessageId===id,canOpenEdit=!!onEdit&&!isEditDisabled&&canEdit;return jsxs(`div`,{"aria-label":intl.formatMessage(messages.annotationMessageAriaLabel),className:text_message_module_default.textMessage,"data-message-wrapper":!0,"data-message-id":id,"data-resin-component":THREADED_ANNOTATIONS_RESIN_COMPONENTS.COMMENT_CARD,children:[jsx(MessageHeader,{author,canResolve,isResolved,canDelete,canEdit:canOpenEdit,hasReplies,isFirstMessage,onAvatarClick,onCopyLink:onCopyLink?()=>onCopyLink(id):void 0,onDelete:()=>onDelete(id),onThreadDelete,onEdit:canOpenEdit?()=>dispatch({type:`EDIT`,id}):void 0,onResolve:onResolve?()=>onResolve(id):void 0,onUnresolve:onUnresolve?()=>onUnresolve(id):void 0}),jsxs(`div`,{className:text_message_module_default.contentWrapper,children:[jsx(`div`,{className:clsx(text_message_module_default.threadedIndicator,!showThreadedIndicator&&text_message_module_default.threadedIndicatorHidden)}),jsxs(`div`,{className:text_message_module_default.messageContent,children:[annotationTarget&&!isAnnotations&&jsx(`div`,{className:text_message_module_default.annotationBadgeWrapper,children:jsx(AnnotationBadge,{annotationTarget,onClick:()=>onAnnotationBadgeClick?.(id),originalContentDeleted})}),isEditing&&onEdit?jsx(`div`,{className:text_message_module_default.inlineEditSlot,children:jsx(MessageEditor,{initialContent:message,maxCharacterCount,onEditCancel:()=>dispatch({type:`CLEAR_EDIT`}),onEditSuccess:()=>dispatch({type:`CLEAR_EDIT`}),onSave:content=>onEdit(id,content),onSaveError:onEditError,userSelectorProps,variant:MessageEditorVariant.EDIT_MESSAGE})}):jsxs(Fragment,{children:[jsx(`div`,{className:text_message_module_default.rendererWrapper,"data-message-body":!0,children:jsx(MessageRenderer,{messageObject:message})}),jsx(MessageFooter,{createdAt,onReply:isReplyDisabled?void 0:()=>dispatch({type:`REPLY`,author}),updatedAt})]})]})]})]})};export{TextMessage};
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
let t = e.replace(/[[({<]+.*[\])}>]+/g, "").trim();
|
|
3
|
-
return (t.slice(0, 1) + t.slice(t.lastIndexOf(" ") + 1, t.lastIndexOf(" ") + 2)).toUpperCase();
|
|
4
|
-
};
|
|
5
|
-
export { e as getInitials };
|
|
1
|
+
var getInitials=name=>{let cleanedName=name.replace(/[[({<]+.*[\])}>]+/g,``).trim();return(cleanedName.slice(0,1)+cleanedName.slice(cleanedName.lastIndexOf(` `)+1,cleanedName.lastIndexOf(` `)+2)).toUpperCase()};export{getInitials};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var t = e({
|
|
3
|
-
userAvatar: {
|
|
4
|
-
id: "groupSharedFeatures.threadedAnnotations.userAvatar",
|
|
5
|
-
defaultMessage: "User avatar"
|
|
6
|
-
},
|
|
7
|
-
userAvatarButtonAriaLabel: {
|
|
8
|
-
id: "groupSharedFeatures.threadedAnnotations.userAvatarButtonAriaLabel",
|
|
9
|
-
defaultMessage: "View user profile button"
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
export { t as default };
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({userAvatar:{id:`groupSharedFeatures.threadedAnnotations.userAvatar`,defaultMessage:`User avatar`},userAvatarButtonAriaLabel:{id:`groupSharedFeatures.threadedAnnotations.userAvatarButtonAriaLabel`,defaultMessage:`View user profile button`}});export{messages as default};
|