stream-chat-react 13.6.0 → 13.6.1
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/components/Chat/hooks/useChat.js +1 -1
- package/dist/components/Message/utils.js +2 -2
- package/dist/components/TextareaComposer/TextareaComposer.js +15 -24
- package/dist/experimental/index.browser.cjs.map +1 -1
- package/dist/experimental/index.node.cjs.map +1 -1
- package/dist/index.browser.cjs +15 -17
- package/dist/index.browser.cjs.map +3 -3
- package/dist/index.node.cjs +15 -17
- package/dist/index.node.cjs.map +3 -3
- package/package.json +3 -3
package/dist/index.browser.cjs
CHANGED
|
@@ -16246,13 +16246,13 @@ var getMessageActions = (actions, {
|
|
|
16246
16246
|
if (canReact && messageActions.indexOf(MESSAGE_ACTIONS.react) > -1) {
|
|
16247
16247
|
messageActionsAfterPermission.push(MESSAGE_ACTIONS.react);
|
|
16248
16248
|
}
|
|
16249
|
-
if (channelConfig?.["user_message_reminders"] && messageActions.indexOf(MESSAGE_ACTIONS.remindMe)) {
|
|
16249
|
+
if (channelConfig?.["user_message_reminders"] && messageActions.indexOf(MESSAGE_ACTIONS.remindMe) > -1) {
|
|
16250
16250
|
messageActionsAfterPermission.push(MESSAGE_ACTIONS.remindMe);
|
|
16251
16251
|
}
|
|
16252
16252
|
if (canReply && messageActions.indexOf(MESSAGE_ACTIONS.reply) > -1) {
|
|
16253
16253
|
messageActionsAfterPermission.push(MESSAGE_ACTIONS.reply);
|
|
16254
16254
|
}
|
|
16255
|
-
if (channelConfig?.["user_message_reminders"] && messageActions.indexOf(MESSAGE_ACTIONS.saveForLater)) {
|
|
16255
|
+
if (channelConfig?.["user_message_reminders"] && messageActions.indexOf(MESSAGE_ACTIONS.saveForLater) > -1) {
|
|
16256
16256
|
messageActionsAfterPermission.push(MESSAGE_ACTIONS.saveForLater);
|
|
16257
16257
|
}
|
|
16258
16258
|
return messageActionsAfterPermission;
|
|
@@ -33409,7 +33409,6 @@ var TextareaComposer = ({
|
|
|
33409
33409
|
event.preventDefault();
|
|
33410
33410
|
}
|
|
33411
33411
|
handleSubmit();
|
|
33412
|
-
textareaRef.current.selectionEnd = 0;
|
|
33413
33412
|
}
|
|
33414
33413
|
},
|
|
33415
33414
|
[
|
|
@@ -33432,7 +33431,7 @@ var TextareaComposer = ({
|
|
|
33432
33431
|
},
|
|
33433
33432
|
[onScroll, textComposer]
|
|
33434
33433
|
);
|
|
33435
|
-
const
|
|
33434
|
+
const setSelection = (0, import_react255.useCallback)(
|
|
33436
33435
|
(e) => {
|
|
33437
33436
|
onSelect?.(e);
|
|
33438
33437
|
textComposer.setSelection({
|
|
@@ -33442,12 +33441,6 @@ var TextareaComposer = ({
|
|
|
33442
33441
|
},
|
|
33443
33442
|
[onSelect, textComposer]
|
|
33444
33443
|
);
|
|
33445
|
-
(0, import_react255.useEffect)(() => {
|
|
33446
|
-
if (textareaRef.current && !isComposing) {
|
|
33447
|
-
textareaRef.current.selectionStart = selection.start;
|
|
33448
|
-
textareaRef.current.selectionEnd = selection.end;
|
|
33449
|
-
}
|
|
33450
|
-
}, [text7, textareaRef, selection.start, selection.end, isComposing]);
|
|
33451
33444
|
(0, import_react255.useEffect)(() => {
|
|
33452
33445
|
if (textComposer.suggestions) {
|
|
33453
33446
|
setFocusedItemIndex(0);
|
|
@@ -33458,11 +33451,15 @@ var TextareaComposer = ({
|
|
|
33458
33451
|
if (!textareaRef.current || textareaIsFocused || !focus) return;
|
|
33459
33452
|
textareaRef.current.focus();
|
|
33460
33453
|
}, [attachments, focus, quotedMessage, textareaRef]);
|
|
33461
|
-
(0, import_react255.
|
|
33454
|
+
(0, import_react255.useLayoutEffect)(() => {
|
|
33462
33455
|
const textarea = textareaRef.current;
|
|
33463
|
-
if (!textarea) return;
|
|
33464
|
-
textarea.value
|
|
33465
|
-
|
|
33456
|
+
if (!textarea || isComposing) return;
|
|
33457
|
+
const length = textarea.value.length;
|
|
33458
|
+
const start2 = Math.max(0, Math.min(selection.start, length));
|
|
33459
|
+
const end = Math.max(start2, Math.min(selection.end, length));
|
|
33460
|
+
if (textarea.selectionStart === start2 && textarea.selectionEnd === end) return;
|
|
33461
|
+
textarea.setSelectionRange(start2, end, "forward");
|
|
33462
|
+
}, [text7, selection.start, selection.end, isComposing, textareaRef]);
|
|
33466
33463
|
return /* @__PURE__ */ import_react255.default.createElement(
|
|
33467
33464
|
"div",
|
|
33468
33465
|
{
|
|
@@ -33497,11 +33494,12 @@ var TextareaComposer = ({
|
|
|
33497
33494
|
onKeyDown: keyDownHandler,
|
|
33498
33495
|
onPaste,
|
|
33499
33496
|
onScroll: scrollHandler,
|
|
33500
|
-
onSelect:
|
|
33497
|
+
onSelect: setSelection,
|
|
33501
33498
|
placeholder: placeholder || t("Type your message"),
|
|
33502
33499
|
ref: (ref) => {
|
|
33503
33500
|
textareaRef.current = ref;
|
|
33504
|
-
}
|
|
33501
|
+
},
|
|
33502
|
+
value: text7
|
|
33505
33503
|
}
|
|
33506
33504
|
),
|
|
33507
33505
|
!isComposing && /* @__PURE__ */ import_react255.default.createElement(
|
|
@@ -36117,7 +36115,7 @@ var useChat = ({
|
|
|
36117
36115
|
};
|
|
36118
36116
|
(0, import_react282.useEffect)(() => {
|
|
36119
36117
|
if (!client) return;
|
|
36120
|
-
const version = "13.6.
|
|
36118
|
+
const version = "13.6.1";
|
|
36121
36119
|
const userAgent = client.getUserAgent();
|
|
36122
36120
|
if (!userAgent.includes("stream-chat-react")) {
|
|
36123
36121
|
client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);
|