重新构建dev产物(收藏文本折叠/搜索高亮、跳转定位消息两处修复)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
68044fa1bb
commit
ca71667975
+73
-30
@@ -9166,6 +9166,46 @@ function LinkText({
|
|||||||
}, void 0, false)]
|
}, void 0, false)]
|
||||||
}, void 0, true);
|
}, void 0, true);
|
||||||
}
|
}
|
||||||
|
function FavoriteText({
|
||||||
|
text,
|
||||||
|
query,
|
||||||
|
onToast
|
||||||
|
}) {
|
||||||
|
const [expanded, setExpanded] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(false);
|
||||||
|
const [overflowing, setOverflowing] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(false);
|
||||||
|
const ref = react__WEBPACK_IMPORTED_MODULE_0___default().useRef(null);
|
||||||
|
react__WEBPACK_IMPORTED_MODULE_0___default().useEffect(() => {
|
||||||
|
const el = ref.current;
|
||||||
|
if (el) setOverflowing(el.scrollHeight - el.clientHeight > 1);
|
||||||
|
}, [text]);
|
||||||
|
const copy = () => {
|
||||||
|
navigator.clipboard.writeText(text || '').then(() => onToast('已复制')).catch(() => onToast('复制失败'));
|
||||||
|
};
|
||||||
|
return (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)("div", {
|
||||||
|
className: "library-text-wrap",
|
||||||
|
children: [(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)("p", {
|
||||||
|
ref: ref,
|
||||||
|
className: 'library-text-content' + (expanded ? '' : ' clamped'),
|
||||||
|
children: (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)(Highlight, {
|
||||||
|
text: text,
|
||||||
|
query: query
|
||||||
|
}, void 0, false)
|
||||||
|
}, void 0, false), (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)("div", {
|
||||||
|
className: "library-text-actions",
|
||||||
|
children: [overflowing ? (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)("button", {
|
||||||
|
type: "button",
|
||||||
|
onClick: () => setExpanded(v => !v),
|
||||||
|
children: expanded ? '收起' : '展开'
|
||||||
|
}, void 0, false) : null, (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)("button", {
|
||||||
|
type: "button",
|
||||||
|
onClick: copy,
|
||||||
|
children: [(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)(Icon, {
|
||||||
|
children: "content_copy"
|
||||||
|
}, void 0, false), "复制"]
|
||||||
|
}, void 0, true)]
|
||||||
|
}, void 0, true)]
|
||||||
|
}, void 0, true);
|
||||||
|
}
|
||||||
function MediaThumb({
|
function MediaThumb({
|
||||||
url,
|
url,
|
||||||
poster,
|
poster,
|
||||||
@@ -9208,7 +9248,9 @@ function FavoriteItem({
|
|||||||
onOpen,
|
onOpen,
|
||||||
selecting,
|
selecting,
|
||||||
selected,
|
selected,
|
||||||
onSelect
|
onSelect,
|
||||||
|
query,
|
||||||
|
onToast
|
||||||
}) {
|
}) {
|
||||||
const att = firstAttachment(item.snapshot && item.snapshot.content);
|
const att = firstAttachment(item.snapshot && item.snapshot.content);
|
||||||
const source = item.source_display || item.source && item.source.topic || '';
|
const source = item.source_display || item.source && item.source.topic || '';
|
||||||
@@ -9231,9 +9273,10 @@ function FavoriteItem({
|
|||||||
}, void 0, false), (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)("em", {
|
}, void 0, false), (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)("em", {
|
||||||
children: "文本已失效"
|
children: "文本已失效"
|
||||||
}, void 0, false)]
|
}, void 0, false)]
|
||||||
}, void 0, true) : (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)("p", {
|
}, void 0, true) : (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)(FavoriteText, {
|
||||||
className: "library-text-content",
|
text: plainTextOf(item.snapshot && item.snapshot.content, item.snapshot && item.snapshot.text),
|
||||||
children: plainTextOf(item.snapshot && item.snapshot.content, item.snapshot && item.snapshot.text)
|
query: query,
|
||||||
|
onToast: onToast
|
||||||
}, void 0, false) : null, item.type === 'file' ? (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)(FileCard, {
|
}, void 0, false) : null, item.type === 'file' ? (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)(FileCard, {
|
||||||
name: att && att.name,
|
name: att && att.name,
|
||||||
size: att && tinode_sdk__WEBPACK_IMPORTED_MODULE_1__.Drafty.getEntitySize(att),
|
size: att && tinode_sdk__WEBPACK_IMPORTED_MODULE_1__.Drafty.getEntitySize(att),
|
||||||
@@ -9408,7 +9451,9 @@ function Favorites({
|
|||||||
selecting: selecting,
|
selecting: selecting,
|
||||||
selected: selected.includes(item.favorite_id),
|
selected: selected.includes(item.favorite_id),
|
||||||
onSelect: () => toggle(item.favorite_id),
|
onSelect: () => toggle(item.favorite_id),
|
||||||
onOpen: () => openItem(item)
|
onOpen: () => openItem(item),
|
||||||
|
query: query,
|
||||||
|
onToast: onToast
|
||||||
}, item.favorite_id, false)), hasMore ? (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)("button", {
|
}, item.favorite_id, false)), hasMore ? (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)("button", {
|
||||||
type: "button",
|
type: "button",
|
||||||
className: "library-load-more",
|
className: "library-load-more",
|
||||||
@@ -13456,7 +13501,7 @@ function MessageHome({
|
|||||||
const [menuOpen, setMenuOpen] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(view === 'messages-menu');
|
const [menuOpen, setMenuOpen] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(view === 'messages-menu');
|
||||||
const [toast, setToast] = react__WEBPACK_IMPORTED_MODULE_0___default().useState('');
|
const [toast, setToast] = react__WEBPACK_IMPORTED_MODULE_0___default().useState('');
|
||||||
const [bootstrap] = (0,_lib_use_cached_data_js__WEBPACK_IMPORTED_MODULE_6__.useCachedData)(myUserId ? 'bootstrap:' + myUserId : null, _lib_im_api_js__WEBPACK_IMPORTED_MODULE_4__.getBootstrap, [myUserId]);
|
const [bootstrap] = (0,_lib_use_cached_data_js__WEBPACK_IMPORTED_MODULE_6__.useCachedData)(myUserId ? 'bootstrap:' + myUserId : null, _lib_im_api_js__WEBPACK_IMPORTED_MODULE_4__.getBootstrap, [myUserId]);
|
||||||
const offline = view === 'messages-offline' || !!myUserId && connected === false;
|
const offline = view === 'messages-offline' || !myUserId || connected === false;
|
||||||
const realConversations = normalizeConversations(chatList, myUserId).sort((a, b) => (b.pinned ? 1 : 0) - (a.pinned ? 1 : 0));
|
const realConversations = normalizeConversations(chatList, myUserId).sort((a, b) => (b.pinned ? 1 : 0) - (a.pinned ? 1 : 0));
|
||||||
const conversations = entryConversations(bootstrap).concat(realConversations);
|
const conversations = entryConversations(bootstrap).concat(realConversations);
|
||||||
const filtered = conversations.filter(item => `${item.title}${item.summary}`.toLowerCase().includes(query.trim().toLowerCase()));
|
const filtered = conversations.filter(item => `${item.title}${item.summary}`.toLowerCase().includes(query.trim().toLowerCase()));
|
||||||
@@ -13573,13 +13618,20 @@ function MessageHome({
|
|||||||
children: "notifications_off"
|
children: "notifications_off"
|
||||||
}, void 0, false) : null]
|
}, void 0, false) : null]
|
||||||
}, void 0, true)]
|
}, void 0, true)]
|
||||||
}, item.id, true)), filtered.length === 0 ? (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)("div", {
|
}, item.id, true)), filtered.length === 0 ? query.trim() ? (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)("div", {
|
||||||
className: "messages-empty",
|
className: "messages-empty",
|
||||||
children: [(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)(Icon, {
|
children: [(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)(Icon, {
|
||||||
children: "search_off"
|
children: "search_off"
|
||||||
}, void 0, false), (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)("p", {
|
}, void 0, false), (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)("p", {
|
||||||
children: "未找到相关会话"
|
children: "未找到相关会话"
|
||||||
}, void 0, false)]
|
}, void 0, false)]
|
||||||
|
}, void 0, true) : (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)("div", {
|
||||||
|
className: "messages-empty",
|
||||||
|
children: [(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)(Icon, {
|
||||||
|
children: "forum"
|
||||||
|
}, void 0, false), (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)("p", {
|
||||||
|
children: "暂无会话"
|
||||||
|
}, void 0, false)]
|
||||||
}, void 0, true) : null]
|
}, void 0, true) : null]
|
||||||
}, void 0, true)]
|
}, void 0, true)]
|
||||||
}, void 0, true), (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)(BottomNavigation, {}, void 0, false), menuOpen ? (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)(QuickMenu, {
|
}, void 0, true), (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)(BottomNavigation, {}, void 0, false), menuOpen ? (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxDEV)(QuickMenu, {
|
||||||
@@ -19841,40 +19893,31 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleCallRinging(callTopic, callSeq) {
|
sendCallSignal(callTopic, evt, callSeq, payload) {
|
||||||
const topic = this.tinode.getTopic(callTopic);
|
const topic = this.tinode.getTopic(callTopic);
|
||||||
if (!topic) {
|
if (!topic || !this.tinode.isConnected()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
topic.videoCall('ringing', callSeq);
|
try {
|
||||||
|
topic.videoCall(evt, callSeq, payload);
|
||||||
|
} catch (err) {
|
||||||
|
console.warn(`Failed to send call signal '${evt}'`, err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handleCallRinging(callTopic, callSeq) {
|
||||||
|
this.sendCallSignal(callTopic, 'ringing', callSeq);
|
||||||
}
|
}
|
||||||
handleCallHangup(callTopic, callSeq) {
|
handleCallHangup(callTopic, callSeq) {
|
||||||
const topic = this.tinode.getTopic(callTopic);
|
this.sendCallSignal(callTopic, 'hang-up', callSeq);
|
||||||
if (!topic) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
topic.videoCall('hang-up', callSeq);
|
|
||||||
}
|
}
|
||||||
handleCallSendOffer(callTopic, callSeq, sdp) {
|
handleCallSendOffer(callTopic, callSeq, sdp) {
|
||||||
const topic = this.tinode.getTopic(callTopic);
|
this.sendCallSignal(callTopic, 'offer', callSeq, sdp);
|
||||||
if (!topic) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
topic.videoCall('offer', callSeq, sdp);
|
|
||||||
}
|
}
|
||||||
handleCallIceCandidate(callTopic, callSeq, candidate) {
|
handleCallIceCandidate(callTopic, callSeq, candidate) {
|
||||||
const topic = this.tinode.getTopic(callTopic);
|
this.sendCallSignal(callTopic, 'ice-candidate', callSeq, candidate);
|
||||||
if (!topic) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
topic.videoCall('ice-candidate', callSeq, candidate);
|
|
||||||
}
|
}
|
||||||
handleCallSendAnswer(callTopic, callSeq, sdp) {
|
handleCallSendAnswer(callTopic, callSeq, sdp) {
|
||||||
const topic = this.tinode.getTopic(callTopic);
|
this.sendCallSignal(callTopic, 'answer', callSeq, sdp);
|
||||||
if (!topic) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
topic.videoCall('answer', callSeq, sdp);
|
|
||||||
}
|
}
|
||||||
handleCallClose() {
|
handleCallClose() {
|
||||||
if (this.callTimeoutTimer) {
|
if (this.callTimeoutTimer) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -323,6 +323,24 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
}
|
}
|
||||||
this.mountDnDEvents(this.dndRef);
|
this.mountDnDEvents(this.dndRef);
|
||||||
this.componentSetup({}, {});
|
this.componentSetup({}, {});
|
||||||
|
if (this.props.jumpToSeq) {
|
||||||
|
const seq = parseInt(this.props.jumpToSeq, 10);
|
||||||
|
const topicObj = this.props.tinode && this.props.topic ? this.props.tinode.getTopic(this.props.topic) : null;
|
||||||
|
const attemptJump = () => this.jumpToMessage(seq);
|
||||||
|
if (topicObj && !topicObj.isSubscribed()) {
|
||||||
|
let tries = 0;
|
||||||
|
const waitForSubscription = () => {
|
||||||
|
if (topicObj.isSubscribed() || ++tries > 25) {
|
||||||
|
attemptJump();
|
||||||
|
} else {
|
||||||
|
window.setTimeout(waitForSubscription, 200);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
waitForSubscription();
|
||||||
|
} else {
|
||||||
|
attemptJump();
|
||||||
|
}
|
||||||
|
}
|
||||||
(0,_lib_im_api_js__WEBPACK_IMPORTED_MODULE_19__.getBootstrap)().then(data => {
|
(0,_lib_im_api_js__WEBPACK_IMPORTED_MODULE_19__.getBootstrap)().then(data => {
|
||||||
this.setState({
|
this.setState({
|
||||||
messagePolicy: data.message_policy || null
|
messagePolicy: data.message_policy || null
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user