@droppii-org/chat-sdk 0.0.63 → 0.0.65

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.
@@ -1 +1 @@
1
- {"version":3,"file":"EnterHandler.d.ts","sourceRoot":"","sources":["../../../../src/components/message/footer/EnterHandler.tsx"],"names":[],"mappings":"AAsBA,MAAM,CAAC,OAAO,UAAU,YAAY,SAqHnC"}
1
+ {"version":3,"file":"EnterHandler.d.ts","sourceRoot":"","sources":["../../../../src/components/message/footer/EnterHandler.tsx"],"names":[],"mappings":"AAsBA,MAAM,CAAC,OAAO,UAAU,YAAY,SAwFnC"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
3
- import { KEY_ENTER_COMMAND, COMMAND_PRIORITY_NORMAL, $getSelection, $isRangeSelection, $createParagraphNode, $createLineBreakNode, $getRoot, } from "lexical";
3
+ import { KEY_ENTER_COMMAND, COMMAND_PRIORITY_NORMAL, $getSelection, $isRangeSelection, $createParagraphNode, $getRoot, } from "lexical";
4
4
  import { useEffect, useRef } from "react";
5
5
  import { $generateHtmlFromNodes } from "@lexical/html";
6
6
  import { $isListNode, INSERT_ORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND, } from "@lexical/list";
@@ -72,33 +72,6 @@ export default function EnterHandler() {
72
72
  });
73
73
  return true;
74
74
  }
75
- // Case 2: Shift+Enter
76
- if (event.shiftKey) {
77
- event.preventDefault();
78
- shiftEnterCount.current += 1;
79
- if (shiftEnterCount.current >= 2) {
80
- // Tách block mới
81
- shiftEnterCount.current = 0;
82
- editor.update(() => {
83
- const selection = $getSelection();
84
- if ($isRangeSelection(selection)) {
85
- const paragraph = $createParagraphNode();
86
- selection.insertNodes([paragraph]);
87
- paragraph.select(); // con trỏ nhảy vào block mới
88
- }
89
- });
90
- }
91
- else {
92
- // Xuống dòng trong block
93
- editor.update(() => {
94
- const selection = $getSelection();
95
- if ($isRangeSelection(selection)) {
96
- selection.insertNodes([$createLineBreakNode()]);
97
- }
98
- });
99
- }
100
- return true;
101
- }
102
75
  return false;
103
76
  }, COMMAND_PRIORITY_NORMAL);
104
77
  }, [editor, onSendMessage, listUploadFiles]);
@@ -11,7 +11,7 @@ import { LinkNode } from "@lexical/link";
11
11
  import { HeadingNode, QuoteNode } from "@lexical/rich-text";
12
12
  import { ListItemNode, ListNode } from "@lexical/list";
13
13
  import { createContext, useCallback, useContext, useState } from "react";
14
- // import EnterHandler from "./EnterHandler";
14
+ import EnterHandler from "./EnterHandler";
15
15
  import ActionBar from "./ActionBar";
16
16
  import { useSendMessage } from "../../../hooks/message/useSendMessage";
17
17
  import FilePreview from "./FilePreview";
@@ -66,6 +66,6 @@ const MessageFooterProvider = ({ currentSession }) => {
66
66
  }
67
67
  setListUploadFiles([]);
68
68
  }, [sendMergeMessage, sendTextMessage, listUploadFiles, currentSession]);
69
- return (_jsx(MessageFooterContext.Provider, { value: { onSendMessage, listUploadFiles, setListUploadFiles }, children: _jsxs(LexicalComposer, { initialConfig: initialConfig, children: [_jsxs("div", { className: "border-t pb-2 flex flex-col gap-1 bg-white", children: [listUploadFiles.length > 0 && _jsx(FilePreview, {}), _jsx(ToolbarPlugin, {}), _jsx("div", { className: "relative px-4", children: _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "border border-indigo-500 rounded-md bg-blue-100 min-h-[64px] max-h-[140px] overflow-y-auto px-3 py-2 text-sm" }), ErrorBoundary: LexicalErrorBoundary, "aria-placeholder": t("enter_message"), placeholder: _jsx("div", { className: "absolute top-2 left-7 pointer-events-none", children: _jsx("p", { className: "text-gray-500 text-sm", children: t("enter_message") }) }) }) }), _jsx(ActionBar, {})] }), _jsx(LinkPlugin, {}), _jsx(ListPlugin, {})] }) }));
69
+ return (_jsx(MessageFooterContext.Provider, { value: { onSendMessage, listUploadFiles, setListUploadFiles }, children: _jsxs(LexicalComposer, { initialConfig: initialConfig, children: [_jsxs("div", { className: "border-t pb-2 flex flex-col gap-1 bg-white", children: [listUploadFiles.length > 0 && _jsx(FilePreview, {}), _jsx(ToolbarPlugin, {}), _jsx("div", { className: "relative px-4", children: _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "border border-indigo-500 rounded-md bg-blue-100 min-h-[64px] max-h-[140px] overflow-y-auto px-3 py-2 text-sm" }), ErrorBoundary: LexicalErrorBoundary, "aria-placeholder": t("enter_message"), placeholder: _jsx("div", { className: "absolute top-2 left-7 pointer-events-none", children: _jsx("p", { className: "text-gray-500 text-sm", children: t("enter_message") }) }) }) }), _jsx(ActionBar, {})] }), _jsx(LinkPlugin, {}), _jsx(ListPlugin, {}), _jsx(EnterHandler, {})] }) }));
70
70
  };
71
71
  export default MessageFooterProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"SearchDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/searchConversation/SearchDrawer.tsx"],"names":[],"mappings":"AAQA,QAAA,MAAM,YAAY,+CAsEjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"SearchDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/searchConversation/SearchDrawer.tsx"],"names":[],"mappings":"AAQA,QAAA,MAAM,YAAY,+CAgFjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -4,7 +4,7 @@ import { Icon } from "../icon";
4
4
  import { useIsMobile } from "../../hooks/common/useIsMobile";
5
5
  import useBoolean from "ahooks/lib/useBoolean";
6
6
  import { useTranslation } from "react-i18next";
7
- import { useRef, useState } from "react";
7
+ import { useEffect, useRef, useState } from "react";
8
8
  import SearchMessageOnCurrentConversation from "./SearchMessageOnCurrentConversation";
9
9
  const SearchDrawer = () => {
10
10
  const { t } = useTranslation();
@@ -12,6 +12,15 @@ const SearchDrawer = () => {
12
12
  const [isOpen, { toggle }] = useBoolean(false);
13
13
  const [search, setSearch] = useState("");
14
14
  const isMobile = useIsMobile();
15
+ useEffect(() => {
16
+ if (isOpen) {
17
+ const timer = setTimeout(() => {
18
+ var _a;
19
+ (_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
20
+ }, 100);
21
+ return () => clearTimeout(timer);
22
+ }
23
+ }, [isOpen]);
15
24
  return (_jsxs("div", { children: [_jsx(Button, { type: "text", shape: "default", className: "text-gray-500 w-8 h-8 p-0", onClick: toggle, children: _jsx(Icon, { icon: "search-o", size: 22 }) }), _jsx(Drawer, { open: isOpen, onClose: toggle, mask: false, closeIcon: false, styles: {
16
25
  body: {
17
26
  padding: 0,
@@ -22,7 +22,7 @@ const SearchItemAsMessage = (props) => {
22
22
  if (isCrm)
23
23
  return false;
24
24
  const ownerId = (_c = (_b = (_a = JSON.parse((conversationData === null || conversationData === void 0 ? void 0 : conversationData.ex) || "{}")) === null || _a === void 0 ? void 0 : _a.sessionInfo) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.ownerId;
25
- return ownerId !== (message === null || message === void 0 ? void 0 : message.sendID);
25
+ return (user === null || user === void 0 ? void 0 : user.userID) !== (message === null || message === void 0 ? void 0 : message.sendID);
26
26
  }, [conversationData === null || conversationData === void 0 ? void 0 : conversationData.ex, message === null || message === void 0 ? void 0 : message.sendID, isCrm]);
27
27
  const onPressItem = async () => {
28
28
  const { data } = await DChatSDK.getOneConversation({
@@ -55,14 +55,14 @@ const SearchItemAsMessage = (props) => {
55
55
  }
56
56
  }
57
57
  return (_jsxs("div", { className: "py-3 px-2 flex items-center gap-3 hover:bg-gray-100 hover:rounded-sm cursor-pointer border-b mx-1", onClick: onPressItem, children: [_jsx("div", { children: _jsx(Avatar, { size: "large", src: useConversationDisplay
58
- ? conversationData === null || conversationData === void 0 ? void 0 : conversationData.faceURL
59
- : message.senderFaceUrl, alt: useConversationDisplay
60
- ? conversationData === null || conversationData === void 0 ? void 0 : conversationData.showName
61
- : message.senderNickname, children: useConversationDisplay
62
- ? conversationData === null || conversationData === void 0 ? void 0 : conversationData.showName.charAt(0).toUpperCase()
63
- : message.senderNickname.charAt(0).toUpperCase() }) }), _jsxs("div", { className: "flex flex-col flex-1 min-w-0 gap-1", children: [_jsxs("div", { className: "flex flex-1 items-center justify-between", children: [_jsx("span", { className: "text-sm flex-1 font-semibold truncate", children: useConversationDisplay
64
- ? conversationData === null || conversationData === void 0 ? void 0 : conversationData.showName
65
- : message.senderNickname }), _jsx("span", { className: "text-xs text-gray-500", children: formatTimestamp(message.sendTime, {
58
+ ? message.senderFaceUrl
59
+ : conversationData === null || conversationData === void 0 ? void 0 : conversationData.faceURL, alt: useConversationDisplay
60
+ ? message.senderNickname
61
+ : conversationData === null || conversationData === void 0 ? void 0 : conversationData.showName, children: useConversationDisplay
62
+ ? message.senderNickname.charAt(0).toUpperCase()
63
+ : conversationData === null || conversationData === void 0 ? void 0 : conversationData.showName.charAt(0).toUpperCase() }) }), _jsxs("div", { className: "flex flex-col flex-1 min-w-0 gap-1", children: [_jsxs("div", { className: "flex flex-1 items-center justify-between", children: [_jsx("span", { className: "text-sm flex-1 font-semibold truncate", children: useConversationDisplay
64
+ ? message.senderNickname
65
+ : conversationData === null || conversationData === void 0 ? void 0 : conversationData.showName }), _jsx("span", { className: "text-xs text-gray-500", children: formatTimestamp(message.sendTime, {
66
66
  hasTime: true,
67
67
  }) })] }), _jsx("div", { className: "flex flex-col flex-1 min-w-0", children: _jsx("span", { className: "text-xs flex-1 text-gray-500 truncate", dangerouslySetInnerHTML: {
68
68
  __html: highlightSearch(msgContent, searchTerm),