@alexsun-top/opencode-chat-room 0.7.5 → 0.7.7
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/CHANGELOG.md +27 -0
- package/README.md +5 -5
- package/README.zh-CN.md +5 -5
- package/cli.ts +20 -0
- package/dist/cli.js +753 -164
- package/package.json +2 -1
- package/plugin.ts +15 -3
- package/server/assets/base.css +0 -2
- package/server/assets/chat/doc-preview.js +122 -0
- package/server/assets/chat/editor.js +10 -7
- package/server/assets/chat/events.js +7 -1
- package/server/assets/chat/files.js +14 -6
- package/server/assets/chat/index.js +4 -0
- package/server/assets/chat/locales/de.js +21 -3
- package/server/assets/chat/locales/es.js +21 -3
- package/server/assets/chat/locales/fr.js +21 -3
- package/server/assets/chat/locales/it.js +21 -3
- package/server/assets/chat/locales/ja.js +21 -3
- package/server/assets/chat/locales/ko.js +21 -3
- package/server/assets/chat/markdown.js +39 -5
- package/server/assets/chat/messages.js +1 -0
- package/server/assets/chat/palette.js +18 -9
- package/server/assets/chat/questions.js +1 -0
- package/server/assets/chat/rooms.js +6 -1
- package/server/assets/chat/shortcuts.js +14 -3
- package/server/assets/chat/state.js +42 -6
- package/server/assets/chat/system-messages.js +9 -1
- package/server/assets/chat/task-form.js +197 -0
- package/server/assets/chat/task-row.js +169 -0
- package/server/assets/chat/tasks.js +494 -0
- package/server/assets/doc-preview.css +158 -0
- package/server/assets/edit-room.css +8 -0
- package/server/assets/responsive.css +26 -1
- package/server/assets/settings.css +9 -2
- package/server/assets/tasks.css +422 -0
- package/server/chat.html +129 -33
- package/server/member-routes.ts +3 -0
- package/server/sw.js +13 -2
- package/server/task-routes.ts +53 -0
- package/skills/chatroom/SKILL.md +3 -1
- package/src/README.md +3 -3
- package/src/agent/task-tool.ts +155 -0
- package/src/center/center-client.ts +44 -0
- package/src/rooms/tasks.ts +246 -0
- package/src/runtime/v2-plugin.ts +11 -2
- package/src/state/sqlite-state.ts +67 -0
- package/src/tui/app.mjs +21 -4
- package/src/tui/http.mjs +109 -10
- package/src/tui/info-app.mjs +435 -0
- package/src/tui/info-content.mjs +198 -0
- package/src/tui/join-app.mjs +71 -0
- package/src/tui/main.mjs +23 -4
- package/src/tui/markdown.mjs +293 -0
- package/src/tui/mentions.mjs +218 -0
- package/src/tui/message-app.mjs +178 -0
- package/src/tui/message-view.mjs +128 -0
- package/src/tui/palette-app.mjs +91 -8
- package/src/tui/palette.mjs +17 -2
- package/src/tui/reminder-app.mjs +189 -0
- package/src/tui/room-settings-app.mjs +249 -0
- package/src/tui/ui-content.mjs +144 -94
- package/src/tui/ui-mentions.mjs +44 -0
- package/src/tui/ui-overlay-view.mjs +255 -0
- package/src/tui/ui-suggest-view.mjs +63 -0
- package/src/tui/ui-suggest.mjs +197 -0
- package/src/tui/ui-theme.mjs +2 -1
- package/src/tui/ui-view.mjs +4 -190
- package/src/tui/ui.mjs +111 -1
|
@@ -44,7 +44,7 @@ export const ja = {
|
|
|
44
44
|
reminderEdit: "編集", reminderEditHeading: "リマインダーを編集", reminderSave: "変更を保存",
|
|
45
45
|
reminderCreated: "リマインダーを作成しました。", reminderUpdated: "リマインダーを更新しました。", reminderDeleted: "リマインダーを削除しました。",
|
|
46
46
|
reminderInvalid: "日時、5 フィールドの CRON 式、IANA タイムゾーン、リマインダーのテキストを確認してください。", reminderLoadFailed: "リマインダーを読み込めませんでした。下書きは残っています。",
|
|
47
|
-
diagramLoading: "図を描画中…", diagramRenderFailed: "図を表示できません。ソースを表示しています。", resourceLoading: "ファイルを読み込み中…", resourceFailed: "このファイルを読み込めませんでした。", resourceDownload: "ダウンロード", resourceMoreActions: "{name} のその他の操作", resourcePreview: "プレビュー", resourceHide: "プレビューを隠す", zoomImage: "画像を開く", imagePreviewTitle: "画像プレビュー", imageZoomControls: "画像のズーム", zoomIn: "拡大", zoomOut: "縮小", zoomReset: "ズームをリセット", installTitle: "OC Chat をインストール", installBody: "ホーム画面に追加すると、全画面でチャットできます。", installAction: "インストール", installHow: "インストール方法", installNotNow: "後で", installIosGuide: "共有をタップし、「ホーム画面に追加」を選択します。",
|
|
47
|
+
diagramLoading: "図を描画中…", diagramRenderFailed: "図を表示できません。ソースを表示しています。", resourceLoading: "ファイルを読み込み中…", resourceFailed: "このファイルを読み込めませんでした。", resourceDownload: "ダウンロード", resourceMoreActions: "{name} のその他の操作", resourcePreview: "プレビュー", resourceHide: "プレビューを隠す", docPreviewEyebrow: "Markdown プレビュー", docPreviewFailed: "このドキュメントを読み込めませんでした。", docPreviewEmpty: "このドキュメントは空です。", zoomImage: "画像を開く", imagePreviewTitle: "画像プレビュー", imageZoomControls: "画像のズーム", zoomIn: "拡大", zoomOut: "縮小", zoomReset: "ズームをリセット", installTitle: "OC Chat をインストール", installBody: "ホーム画面に追加すると、全画面でチャットできます。", installAction: "インストール", installHow: "インストール方法", installNotNow: "後で", installIosGuide: "共有をタップし、「ホーム画面に追加」を選択します。",
|
|
48
48
|
pwaUpdateTitle: "アップデートがあります", pwaUpdateBody: "新しいバージョンの準備ができました。今すぐ再読み込みするか、次回起動時に更新できます。", pwaUpdateNow: "今すぐ更新", pwaUpdateLater: "後で",
|
|
49
49
|
announcementDelete: "お知らせを削除",
|
|
50
50
|
announcementNew: "新しいお知らせ", announcementEmpty: "お知らせはまだありません。", announcementLoading: "お知らせを読み込み中…",
|
|
@@ -84,7 +84,7 @@ export const ja = {
|
|
|
84
84
|
shortcutsScroll: "入力中にメッセージをスクロール", shortcutsJump: "会話の先頭または末尾に移動", shortcutsMenus: "メニューとダイアログ",
|
|
85
85
|
shortcutsClose: "開いているメニュー、パネル、ダイアログを閉じる",
|
|
86
86
|
paletteTitle: "検索とコマンド", paletteSearchLabel: "メッセージを検索",
|
|
87
|
-
palettePlaceholder: "
|
|
87
|
+
palettePlaceholder: "メッセージを検索、/ でコマンド", paletteScopeRoom: "このルーム", paletteScopeAll: "すべてのルーム",
|
|
88
88
|
paletteScopeHint: "Tab でこのルームと参加中のすべてのルームを切り替えます", paletteSearchMode: "検索", paletteCommandMode: "コマンド",
|
|
89
89
|
paletteSearching: "検索中…", paletteNoResults: "メッセージは見つかりませんでした。", paletteNoCommands: "一致するコマンドはありません。",
|
|
90
90
|
paletteResults: ({ count }) => `${count} 件の結果`, paletteCommandsHint: "よく使うコマンド",
|
|
@@ -94,10 +94,28 @@ export const ja = {
|
|
|
94
94
|
filesUnknownUploader: "不明なアップロード者", filesSummary: ({ count, size }) => `${count} 個のファイル · ${size}`,
|
|
95
95
|
filesLoading: "ファイルを読み込み中…", filesLoadFailed: "ファイルを読み込めませんでした。もう一度お試しください。", filesEmpty: "このルームにはまだファイルがありません。",
|
|
96
96
|
filesEmptyFiltered: "このアップロード者のファイルはありません。", filesLoadMore: "さらに読み込む",
|
|
97
|
-
filesHint: "
|
|
97
|
+
filesHint: "画像・音声・動画・Markdown をプレビューできます。すべてのファイルをダウンロードできます。",
|
|
98
98
|
filesPreviewFailed: "プレビューを読み込めませんでした。", filesDownloadFailed: "このファイルをダウンロードできませんでした。",
|
|
99
99
|
filesPreviewLabel: ({ name }) => `${name} をプレビュー`, filesDownloadLabel: ({ name }) => `${name} をダウンロード`,
|
|
100
100
|
filesDeleteLabel: ({ name }) => `${name} を削除`, filesRefresh: "ファイルを更新",
|
|
101
|
+
tasksTitle: "タスク", tasksEyebrow: "ルームのタスク", tasksRefresh: "タスクを更新", tasksMenuLabel: "タスクの操作",
|
|
102
|
+
tasksClearCompleted: "完了したタスクを削除", tasksClearConfirm: ({ count }) => `完了したタスクを ${count} 件削除しますか?元に戻せません。`,
|
|
103
|
+
tasksClearFailed: "完了したタスクを削除できませんでした。もう一度お試しください。",
|
|
104
|
+
tasksLoading: "タスクを読み込み中…", tasksLoadFailed: "タスクを読み込めませんでした。もう一度お試しください。", tasksEmpty: "タスクはまだありません。最初のタスクを追加しましょう。",
|
|
105
|
+
tasksEmptyFiltered: "このステータスのタスクはありません。", tasksCreate: "タスクを追加", tasksTitleLabel: "タイトル",
|
|
106
|
+
tasksTitlePlaceholder: "何をしますか?", tasksDescriptionLabel: "説明", tasksDescriptionPlaceholder: "詳細、リンク、完了条件を追加",
|
|
107
|
+
tasksAssigneeLabel: "担当者", tasksUnassigned: "未割り当て", tasksFilterLabel: "表示", tasksFilterAll: "すべてのステータス",
|
|
108
|
+
tasksDueDateLabel: "期限日", tasksDueOn: ({ date }) => `期限 ${date}`, tasksOverdue: "期限切れ",
|
|
109
|
+
tasksParticipantsLabel: "参加者", tasksParticipantsMeta: ({ names }) => `参加者:${names}`,
|
|
110
|
+
tasksConclusionLabel: "結論", tasksConclusionPlaceholder: "最終的な結果を入力",
|
|
111
|
+
tasksStepsLabel: "手順", tasksAddStep: "手順を追加", tasksRemoveStep: "手順を削除", tasksStepPlaceholder: "手順を入力",
|
|
112
|
+
tasksStepDoneLabel: "完了した手順", tasksStepsHint: "手順は最大 30 件です。完了したものにチェックを入れてください。",
|
|
113
|
+
tasksStepsProgress: ({ done, total }) => `全 ${total} 手順中 ${done} 件完了`,
|
|
114
|
+
tasksStatusTodo: "未着手", tasksStatusDoing: "進行中", tasksStatusDone: "完了",
|
|
115
|
+
tasksSummary: ({ count }) => `${count} 件のタスク`, tasksCreator: ({ name }) => `${name} が作成`, tasksUpdated: ({ time }) => `${time} に更新`,
|
|
116
|
+
tasksEditLabel: ({ title }) => `${title} を編集`, tasksDeleteLabel: ({ title }) => `${title} を削除`, tasksStatusFor: ({ title }) => `${title} のステータス`,
|
|
117
|
+
tasksInvalid: "タイトルは 1〜200 文字で入力してください。", tasksCreateFailed: "タスクを追加できませんでした。もう一度お試しください。", tasksUpdateFailed: "タスクを更新できませんでした。もう一度お試しください。",
|
|
118
|
+
tasksDeleteFailed: "タスクを削除できませんでした。もう一度お試しください。", tasksDeleteConfirm: ({ title }) => `「${title}」を削除しますか?元に戻せません。`,
|
|
101
119
|
earlierMessages: "以前のメッセージは省略されています", messagesBetweenOmitted: "この閲覧位置と最新の間のメッセージは省略されています。", you: "あなた", saved: "保存済み",
|
|
102
120
|
savedMemory: "このタブにのみ保存", copyFailed: ({ id }) => `コピーに失敗しました。手動でコピーしてください:${id}`,
|
|
103
121
|
copyMessage: "コピー", copiedMessage: "コピーしました", copyMessageFailed: "コピーできませんでした。メッセージを選択して手動でコピーしてください。", wrapCode: "コードを折り返す",
|
|
@@ -44,7 +44,7 @@ export const ko = {
|
|
|
44
44
|
reminderEdit: "편집", reminderEditHeading: "리마인더 편집", reminderSave: "변경 사항 저장",
|
|
45
45
|
reminderCreated: "리마인더를 만들었습니다.", reminderUpdated: "리마인더를 수정했습니다.", reminderDeleted: "리마인더를 삭제했습니다.",
|
|
46
46
|
reminderInvalid: "날짜, 5필드 CRON 식, IANA 시간대, 리마인더 텍스트를 확인하세요.", reminderLoadFailed: "리마인더를 불러오지 못했습니다. 작성 중인 내용은 그대로 있습니다.",
|
|
47
|
-
diagramLoading: "다이어그램 그리는 중…", diagramRenderFailed: "다이어그램을 표시할 수 없습니다. 원본을 표시합니다.", resourceLoading: "파일 불러오는 중…", resourceFailed: "이 파일을 불러오지 못했습니다.", resourceDownload: "다운로드", resourceMoreActions: "{name}의 추가 작업", resourcePreview: "미리 보기", resourceHide: "미리 보기 숨기기", zoomImage: "이미지 열기", imagePreviewTitle: "이미지 미리 보기", imageZoomControls: "이미지 확대/축소", zoomIn: "확대", zoomOut: "축소", zoomReset: "확대/축소 초기화", installTitle: "OC Chat 설치", installBody: "홈 화면에 추가하면 전체 화면으로 채팅할 수 있습니다.", installAction: "설치", installHow: "설치 방법", installNotNow: "나중에", installIosGuide: "공유를 탭한 다음 홈 화면에 추가를 선택하세요.",
|
|
47
|
+
diagramLoading: "다이어그램 그리는 중…", diagramRenderFailed: "다이어그램을 표시할 수 없습니다. 원본을 표시합니다.", resourceLoading: "파일 불러오는 중…", resourceFailed: "이 파일을 불러오지 못했습니다.", resourceDownload: "다운로드", resourceMoreActions: "{name}의 추가 작업", resourcePreview: "미리 보기", resourceHide: "미리 보기 숨기기", docPreviewEyebrow: "Markdown 미리 보기", docPreviewFailed: "이 문서를 불러오지 못했습니다.", docPreviewEmpty: "이 문서는 비어 있습니다.", zoomImage: "이미지 열기", imagePreviewTitle: "이미지 미리 보기", imageZoomControls: "이미지 확대/축소", zoomIn: "확대", zoomOut: "축소", zoomReset: "확대/축소 초기화", installTitle: "OC Chat 설치", installBody: "홈 화면에 추가하면 전체 화면으로 채팅할 수 있습니다.", installAction: "설치", installHow: "설치 방법", installNotNow: "나중에", installIosGuide: "공유를 탭한 다음 홈 화면에 추가를 선택하세요.",
|
|
48
48
|
pwaUpdateTitle: "업데이트 가능", pwaUpdateBody: "새 버전이 준비되었습니다. 지금 새로고침하거나 다음에 앱을 열 때 업데이트할 수 있습니다.", pwaUpdateNow: "지금 업데이트", pwaUpdateLater: "나중에",
|
|
49
49
|
announcementDelete: "공지 삭제",
|
|
50
50
|
announcementNew: "새 공지", announcementEmpty: "아직 공지가 없습니다.", announcementLoading: "공지 불러오는 중…",
|
|
@@ -84,7 +84,7 @@ export const ko = {
|
|
|
84
84
|
shortcutsScroll: "입력 중에 메시지 스크롤", shortcutsJump: "대화의 시작이나 끝으로 이동", shortcutsMenus: "메뉴 및 대화 상자",
|
|
85
85
|
shortcutsClose: "열린 메뉴, 패널 또는 대화 상자 닫기",
|
|
86
86
|
paletteTitle: "검색 및 명령", paletteSearchLabel: "메시지 검색",
|
|
87
|
-
palettePlaceholder: "메시지를 검색하거나
|
|
87
|
+
palettePlaceholder: "메시지를 검색하거나 / 로 명령 사용", paletteScopeRoom: "이 방", paletteScopeAll: "모든 방",
|
|
88
88
|
paletteScopeHint: "Tab 키로 이 방과 참여 중인 모든 방을 전환합니다", paletteSearchMode: "검색", paletteCommandMode: "명령",
|
|
89
89
|
paletteSearching: "검색 중…", paletteNoResults: "메시지를 찾지 못했습니다.", paletteNoCommands: "일치하는 명령이 없습니다.",
|
|
90
90
|
paletteResults: ({ count }) => `결과 ${count}개`, paletteCommandsHint: "자주 쓰는 명령",
|
|
@@ -94,10 +94,28 @@ export const ko = {
|
|
|
94
94
|
filesUnknownUploader: "알 수 없는 업로더", filesSummary: ({ count, size }) => `${count}개 파일 · ${size}`,
|
|
95
95
|
filesLoading: "파일을 불러오는 중…", filesLoadFailed: "파일을 불러오지 못했습니다. 다시 시도해 주세요.", filesEmpty: "이 방에는 아직 파일이 없습니다.",
|
|
96
96
|
filesEmptyFiltered: "이 업로더의 파일이 없습니다.", filesLoadMore: "더 불러오기",
|
|
97
|
-
filesHint: "이미지, 오디오,
|
|
97
|
+
filesHint: "이미지, 오디오, 동영상, Markdown을 미리 볼 수 있습니다. 모든 파일을 다운로드할 수 있습니다.",
|
|
98
98
|
filesPreviewFailed: "미리보기를 불러오지 못했습니다.", filesDownloadFailed: "이 파일을 다운로드하지 못했습니다.",
|
|
99
99
|
filesPreviewLabel: ({ name }) => `${name} 미리보기`, filesDownloadLabel: ({ name }) => `${name} 다운로드`,
|
|
100
100
|
filesDeleteLabel: ({ name }) => `${name} 삭제`, filesRefresh: "파일 새로고침",
|
|
101
|
+
tasksTitle: "작업", tasksEyebrow: "방 작업", tasksRefresh: "작업 새로 고침", tasksMenuLabel: "작업 메뉴",
|
|
102
|
+
tasksClearCompleted: "완료한 작업 지우기", tasksClearConfirm: ({ count }) => `완료한 작업 ${count}개를 지울까요? 되돌릴 수 없습니다.`,
|
|
103
|
+
tasksClearFailed: "완료한 작업을 지우지 못했습니다. 다시 시도하세요.",
|
|
104
|
+
tasksLoading: "작업을 불러오는 중…", tasksLoadFailed: "작업을 불러오지 못했습니다. 다시 시도하세요.", tasksEmpty: "아직 작업이 없습니다. 첫 작업을 추가하세요.",
|
|
105
|
+
tasksEmptyFiltered: "이 상태의 작업이 없습니다.", tasksCreate: "작업 추가", tasksTitleLabel: "제목",
|
|
106
|
+
tasksTitlePlaceholder: "무엇을 해야 하나요?", tasksDescriptionLabel: "설명", tasksDescriptionPlaceholder: "세부 정보, 링크 또는 완료 기준 추가",
|
|
107
|
+
tasksAssigneeLabel: "담당자", tasksUnassigned: "미지정", tasksFilterLabel: "표시", tasksFilterAll: "모든 상태",
|
|
108
|
+
tasksDueDateLabel: "마감일", tasksDueOn: ({ date }) => `마감 ${date}`, tasksOverdue: "기한 지남",
|
|
109
|
+
tasksParticipantsLabel: "참여자", tasksParticipantsMeta: ({ names }) => `참여자: ${names}`,
|
|
110
|
+
tasksConclusionLabel: "결론", tasksConclusionPlaceholder: "최종 결과를 입력하세요",
|
|
111
|
+
tasksStepsLabel: "단계", tasksAddStep: "단계 추가", tasksRemoveStep: "단계 삭제", tasksStepPlaceholder: "단계 설명",
|
|
112
|
+
tasksStepDoneLabel: "완료한 단계", tasksStepsHint: "단계는 최대 30개입니다. 완료한 단계를 선택하세요.",
|
|
113
|
+
tasksStepsProgress: ({ done, total }) => `전체 ${total}단계 중 ${done}단계 완료`,
|
|
114
|
+
tasksStatusTodo: "할 일", tasksStatusDoing: "진행 중", tasksStatusDone: "완료",
|
|
115
|
+
tasksSummary: ({ count }) => `작업 ${count}개`, tasksCreator: ({ name }) => `${name} 생성`, tasksUpdated: ({ time }) => `${time} 업데이트`,
|
|
116
|
+
tasksEditLabel: ({ title }) => `${title} 편집`, tasksDeleteLabel: ({ title }) => `${title} 삭제`, tasksStatusFor: ({ title }) => `${title} 상태`,
|
|
117
|
+
tasksInvalid: "제목은 1–200자로 입력하세요.", tasksCreateFailed: "작업을 추가하지 못했습니다. 다시 시도하세요.", tasksUpdateFailed: "작업을 업데이트하지 못했습니다. 다시 시도하세요.",
|
|
118
|
+
tasksDeleteFailed: "작업을 삭제하지 못했습니다. 다시 시도하세요.", tasksDeleteConfirm: ({ title }) => `“${title}” 작업을 삭제할까요? 되돌릴 수 없습니다.`,
|
|
101
119
|
earlierMessages: "이전 메시지는 생략됨", messagesBetweenOmitted: "이 읽기 지점과 최신 메시지 사이는 생략되었습니다.", you: "나", saved: "저장됨",
|
|
102
120
|
savedMemory: "이 탭에만 저장됨", copyFailed: ({ id }) => `복사하지 못했습니다. 직접 복사하세요: ${id}`,
|
|
103
121
|
copyMessage: "복사", copiedMessage: "복사됨", copyMessageFailed: "복사하지 못했습니다. 메시지를 선택해 직접 복사하세요.", wrapCode: "코드 줄 바꿈",
|
|
@@ -6,8 +6,37 @@ const mentionPattern = /<at>@([^<]+)<\/at>/g;
|
|
|
6
6
|
const resourcePattern = /\[\[resource:([\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})\]\]/gi;
|
|
7
7
|
let mermaidReady = false;
|
|
8
8
|
const previewUrls = new Map();
|
|
9
|
+
const sanitizerTags = new Map();
|
|
9
10
|
let previewObserver;
|
|
10
11
|
|
|
12
|
+
// Raw HTML is not a formatting surface here: unknown tags must stay visible as
|
|
13
|
+
// text instead of disappearing inside the sanitizer. Known safe tags still pass
|
|
14
|
+
// through, and DOMPurify remains the final gate.
|
|
15
|
+
function preserveRawHtml(value) {
|
|
16
|
+
return String(value).replace(/<[^>]*>/g, (tag) => {
|
|
17
|
+
const name = /^<\/?([A-Za-z][\w:-]*)/.exec(tag)?.[1];
|
|
18
|
+
return name && sanitizerKeepsTag(name) ? tag : escapeHtmlText(tag);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function sanitizerKeepsTag(name) {
|
|
23
|
+
const key = name.toLowerCase();
|
|
24
|
+
if (!sanitizerTags.has(key)) {
|
|
25
|
+
const probe = `<${key}></${key}>`;
|
|
26
|
+
sanitizerTags.set(key, window.DOMPurify.sanitize(probe).toLowerCase().includes(`<${key}`));
|
|
27
|
+
}
|
|
28
|
+
return sanitizerTags.get(key);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function escapeHtmlText(value) {
|
|
32
|
+
return String(value).replace(/[&<>"']/g, (char) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[char]);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function isMarkdownResource(resource) {
|
|
36
|
+
const mime = String(resource?.mimeType || "").split(";")[0].trim().toLowerCase();
|
|
37
|
+
return mime === "text/markdown" || mime === "text/x-markdown" || /\.(?:md|markdown)$/i.test(String(resource?.name || ""));
|
|
38
|
+
}
|
|
39
|
+
|
|
11
40
|
export function renderMarkdown(root, text, app) {
|
|
12
41
|
const mentions = [], diagrams = new Map();
|
|
13
42
|
const nonce = createRandomId();
|
|
@@ -17,6 +46,7 @@ export function renderMarkdown(root, text, app) {
|
|
|
17
46
|
return token;
|
|
18
47
|
});
|
|
19
48
|
const renderer = new window.marked.Renderer(), renderCode = renderer.code.bind(renderer);
|
|
49
|
+
renderer.html = ({ text }) => preserveRawHtml(text);
|
|
20
50
|
renderer.code = (token) => {
|
|
21
51
|
if ((token.lang || "").trim().toLowerCase().split(/\s+/)[0] !== "mermaid") return renderCode(token);
|
|
22
52
|
const key = `CHATDIAGRAM${nonce}${diagrams.size}END`;
|
|
@@ -221,11 +251,14 @@ async function loadResourceCard(card, roomId, app) {
|
|
|
221
251
|
remove = resourceMenuItem("resourceDelete", () => deleteResource(card, roomId, id, resource, app, status, remove), app);
|
|
222
252
|
actions.append(resourceSplit(app, resource, download, remove));
|
|
223
253
|
} else actions.append(download);
|
|
224
|
-
|
|
225
|
-
|
|
254
|
+
const markdown = isMarkdownResource(resource);
|
|
255
|
+
if (previewKind(type) || markdown) {
|
|
256
|
+
const preview = resourceButton("resourcePreview", resource.name, () => markdown
|
|
257
|
+
? app.openDocPreview(roomId, resource, preview)
|
|
258
|
+
: previewResource(card, roomId, id, resource, type, preview, app, status), app);
|
|
226
259
|
actions.append(preview);
|
|
227
260
|
// Media you sent yourself is shown inline; other people's media stays collapsed.
|
|
228
|
-
if (card.closest(".msg.own")) void previewResource(card, roomId, id, resource, type, preview, app, status);
|
|
261
|
+
if (!markdown && card.closest(".msg.own")) void previewResource(card, roomId, id, resource, type, preview, app, status);
|
|
229
262
|
}
|
|
230
263
|
} catch (error) { if (card.isConnected) setResourceError(card, app, error?.status === 404 ? "resourceDeleted" : "resourceFailed"); }
|
|
231
264
|
}
|
|
@@ -384,7 +417,7 @@ function previewKind(type) {
|
|
|
384
417
|
if (["video/mp4", "video/webm", "video/ogg"].includes(type)) return "video";
|
|
385
418
|
return "";
|
|
386
419
|
}
|
|
387
|
-
function formatBytes(value) {
|
|
420
|
+
export function formatBytes(value) {
|
|
388
421
|
const bytes = Math.max(0, Number(value) || 0);
|
|
389
422
|
if (bytes < 1024) return `${bytes} B`;
|
|
390
423
|
return bytes < 1048576 ? `${(bytes / 1024).toFixed(1)} KB` : `${(bytes / 1048576).toFixed(1)} MB`;
|
|
@@ -428,7 +461,8 @@ function replaceMentionTokens(fragment, mentions, app) {
|
|
|
428
461
|
const chip = document.createElement("span");
|
|
429
462
|
chip.className = "mention-chip";
|
|
430
463
|
if (app.mentionNames().has(mention.name)) chip.classList.add("member");
|
|
431
|
-
chip.
|
|
464
|
+
chip.dataset.mention = mention.name;
|
|
465
|
+
chip.textContent = `@${mention.name === "all" ? app.t("allMembers") : mention.name}`;
|
|
432
466
|
replacement.appendChild(chip);
|
|
433
467
|
}
|
|
434
468
|
node.replaceWith(replacement);
|
|
@@ -11,6 +11,7 @@ export function initMessages(app) {
|
|
|
11
11
|
const $ = app.$;
|
|
12
12
|
installEditor($("#msgInput"));
|
|
13
13
|
$("#msgInput").isKnownMention = (name) => app.mentionExists(name);
|
|
14
|
+
$("#msgInput").mentionLabel = (name) => name === "all" ? app.t("allMembers") : name;
|
|
14
15
|
|
|
15
16
|
app.autoGrow = (textarea) => {
|
|
16
17
|
const thread = $("#thread"), atBottom = Boolean(app.state.room && Math.abs(thread.scrollHeight - thread.clientHeight - thread.scrollTop) < 1);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { icon } from "./icons.js";
|
|
2
2
|
|
|
3
|
-
// Alt+Space opens one keyboard-first surface: message search plus common room commands.
|
|
3
|
+
// Alt+Space or Ctrl+P opens one keyboard-first surface: message search plus common room commands.
|
|
4
4
|
|
|
5
5
|
const SEARCH_DEBOUNCE_MS = 220;
|
|
6
6
|
|
|
@@ -15,7 +15,8 @@ export function initPalette(app) {
|
|
|
15
15
|
|
|
16
16
|
// The eyebrow names the real key on this platform, matching the shortcut sheet.
|
|
17
17
|
const combo = app.$("#paletteCombo");
|
|
18
|
-
|
|
18
|
+
const mac = /Mac|iPhone|iPad|iPod/.test(navigator.platform || navigator.userAgent);
|
|
19
|
+
if (combo) combo.textContent = mac ? "Ctrl + P / Option + Space" : "Ctrl + P / Alt + Space";
|
|
19
20
|
|
|
20
21
|
const commands = () => {
|
|
21
22
|
const available = [
|
|
@@ -28,6 +29,7 @@ export function initPalette(app) {
|
|
|
28
29
|
{ id: "members", label: t("members"), icon: "people", keywords: "people roster", focusComposer: false, run: () => app.$("#btnMembers")?.click() },
|
|
29
30
|
{ id: "questions", label: t("questions"), icon: "question_circle", keywords: "answers", focusComposer: false, run: () => app.$("#btnQuestions")?.click() },
|
|
30
31
|
{ id: "announcements", label: t("announcements"), icon: "megaphone", keywords: "notice board", focusComposer: false, run: () => app.$("#btnAnnouncements")?.click() },
|
|
32
|
+
...(room().kind === "direct" ? [] : [{ id: "tasks", label: t("tasksTitle"), icon: "checkmark", keywords: "todo checklist work", focusComposer: false, run: () => app.openTasksDialog?.() }]),
|
|
31
33
|
{ id: "reminders", label: t("reminders"), icon: "alert", keywords: "schedule alarm", focusComposer: false, run: () => app.$("#btnReminders")?.click() },
|
|
32
34
|
{ id: "leave", label: t("paletteLeaveRoom"), icon: "arrow_exit", keywords: "exit quit", focusComposer: false, run: () => app.leaveRoom?.(false) },
|
|
33
35
|
{ id: "latest", label: t("paletteJumpLatest"), icon: "arrow_down", keywords: "bottom newest", run: () => app.jumpToBottom?.() },
|
|
@@ -231,7 +233,7 @@ export function initPalette(app) {
|
|
|
231
233
|
const token = ++sequence;
|
|
232
234
|
const value = input.value;
|
|
233
235
|
if (!value.trim()) { showCommands(""); return; }
|
|
234
|
-
if (value.startsWith("
|
|
236
|
+
if (value.startsWith("/")) { showCommands(value.slice(1)); return; }
|
|
235
237
|
const wasSearch = dialog.dataset.mode === "search";
|
|
236
238
|
dialog.dataset.mode = "search";
|
|
237
239
|
dialog.dataset.state = "searching";
|
|
@@ -292,7 +294,7 @@ export function initPalette(app) {
|
|
|
292
294
|
syncScope();
|
|
293
295
|
const value = input.value;
|
|
294
296
|
if (!value.trim()) showCommands("");
|
|
295
|
-
else if (value.startsWith("
|
|
297
|
+
else if (value.startsWith("/")) showCommands(value.slice(1));
|
|
296
298
|
else scheduleSearch();
|
|
297
299
|
};
|
|
298
300
|
|
|
@@ -331,8 +333,12 @@ export function initPalette(app) {
|
|
|
331
333
|
// A stacked dialog keeps its own focus; otherwise the composer owns the page.
|
|
332
334
|
if (document.querySelector("dialog[open]")) return;
|
|
333
335
|
const composer = app.$("#msgInput");
|
|
334
|
-
if (app.state.room && !app.$("#chatView")?.hidden && composer?.contentEditable === "true")
|
|
335
|
-
|
|
336
|
+
if (app.state.room && !app.$("#chatView")?.hidden && composer?.contentEditable === "true") {
|
|
337
|
+
const selection = getSelection();
|
|
338
|
+
const selectionInside = Boolean(selection?.anchorNode && composer.contains(selection.anchorNode));
|
|
339
|
+
composer.focus({ preventScroll: true });
|
|
340
|
+
if (!selectionInside) composer.setCaret?.(composer.value.length);
|
|
341
|
+
} else if (!app.state.room) app.$("#inRoomId")?.focus({ preventScroll: true });
|
|
336
342
|
});
|
|
337
343
|
});
|
|
338
344
|
|
|
@@ -377,8 +383,11 @@ export function initPalette(app) {
|
|
|
377
383
|
|
|
378
384
|
document.addEventListener("keydown", (event) => {
|
|
379
385
|
if (event.defaultPrevented || event.isComposing) return;
|
|
380
|
-
|
|
381
|
-
|
|
386
|
+
const altSpace = event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey
|
|
387
|
+
&& (event.code === "Space" || event.key === " ");
|
|
388
|
+
const ctrlP = event.ctrlKey && !event.altKey && !event.metaKey && !event.shiftKey
|
|
389
|
+
&& (event.code === "KeyP" || event.key.toLowerCase() === "p");
|
|
390
|
+
if (!altSpace && !ctrlP) return;
|
|
382
391
|
event.preventDefault();
|
|
383
392
|
event.stopPropagation();
|
|
384
393
|
openPalette();
|
|
@@ -390,7 +399,7 @@ export function initPalette(app) {
|
|
|
390
399
|
syncScope();
|
|
391
400
|
if (!dialog.open) return;
|
|
392
401
|
const value = input.value;
|
|
393
|
-
if (!value.trim() || value.startsWith("
|
|
402
|
+
if (!value.trim() || value.startsWith("/")) showCommands(value.startsWith("/") ? value.slice(1) : "");
|
|
394
403
|
else scheduleSearch();
|
|
395
404
|
};
|
|
396
405
|
}
|
|
@@ -109,6 +109,7 @@ export function initQuestions(app) {
|
|
|
109
109
|
input.setAttribute("aria-label", app.t("answerPlaceholder"));
|
|
110
110
|
installEditor(input);
|
|
111
111
|
input.isKnownMention = (name) => app.mentionExists(name);
|
|
112
|
+
input.mentionLabel = (name) => name === "all" ? app.t("allMembers") : name;
|
|
112
113
|
const key = `${roomId}\0${question.id}`;
|
|
113
114
|
input.draftValue = drafts.has(key) ? drafts.get(key) : questionAuthorMention(question, roomId, app);
|
|
114
115
|
input.dataset.empty = input.value ? "false" : "true";
|
|
@@ -133,6 +133,7 @@ export function initRooms(app) {
|
|
|
133
133
|
app.captureReadingPosition?.();
|
|
134
134
|
}
|
|
135
135
|
app.stopPolling();
|
|
136
|
+
app.state.previousRoomId = app.state.room?.id;
|
|
136
137
|
app.state.room = entry.room;
|
|
137
138
|
app.state.myName = entry.name;
|
|
138
139
|
app.state.unread = entry.unreadIds.size + (entry.unreadOverflow ? 100 : 0);
|
|
@@ -212,6 +213,7 @@ export function initRooms(app) {
|
|
|
212
213
|
};
|
|
213
214
|
|
|
214
215
|
app.createRoom = async (pending) => {
|
|
216
|
+
if (app.state.joinBusy) return;
|
|
215
217
|
const fromChat = pending?.fromChat ?? Boolean(app.state.room);
|
|
216
218
|
const name = pending?.name || (fromChat ? app.state.myName : $("#inName").value.trim()) || LS.name || app.t("guest");
|
|
217
219
|
const roomName = pending?.roomName || $(fromChat ? "#inRoomNameChat" : "#inRoomName").value.trim();
|
|
@@ -253,6 +255,7 @@ export function initRooms(app) {
|
|
|
253
255
|
};
|
|
254
256
|
|
|
255
257
|
app.setJoinBusy = (busy) => {
|
|
258
|
+
app.state.joinBusy = busy;
|
|
256
259
|
$("#btnJoin").disabled = busy;
|
|
257
260
|
$("#btnCreate").disabled = busy;
|
|
258
261
|
};
|
|
@@ -304,7 +307,9 @@ export function initRooms(app) {
|
|
|
304
307
|
if (next) app.activateRoom(next, true);
|
|
305
308
|
else {
|
|
306
309
|
LS.roomId = "";
|
|
307
|
-
|
|
310
|
+
// Leaving the last room returns to the start screen; reload the list so
|
|
311
|
+
// the room the user just left is available to rejoin without a manual refresh.
|
|
312
|
+
app.showJoin(true, true);
|
|
308
313
|
if (reason) app.showJoinError("roomNotFound");
|
|
309
314
|
}
|
|
310
315
|
}
|
|
@@ -124,12 +124,23 @@ export function initShortcuts(app) {
|
|
|
124
124
|
animateScroll(bottom ? thread.scrollHeight : 0);
|
|
125
125
|
};
|
|
126
126
|
app.animateRoomSwitch = (direction) => {
|
|
127
|
-
//
|
|
128
|
-
|
|
127
|
+
// Fluent motion lives in the selected indicator: the old bar collapses toward
|
|
128
|
+
// the direction of travel while the new bar expands from the opposite edge.
|
|
129
|
+
const oldId = app.state.previousRoomId;
|
|
130
|
+
const oldRows = oldId ? document.querySelectorAll(`#roomListChat .room-row[data-room-id="${CSS.escape(oldId)}"]`) : [];
|
|
131
|
+
for (const row of oldRows) {
|
|
132
|
+
row.classList.remove("room-switch-leave");
|
|
133
|
+
row.style.setProperty("--room-switch-origin", direction > 0 ? "bottom" : "top");
|
|
134
|
+
void row.offsetWidth;
|
|
135
|
+
row.classList.add("room-switch-leave");
|
|
136
|
+
setTimeout(() => row.classList.remove("room-switch-leave"), 220);
|
|
137
|
+
}
|
|
138
|
+
for (const row of document.querySelectorAll("#roomListChat .room-row.selected")) {
|
|
129
139
|
row.classList.remove("room-switch-enter");
|
|
130
|
-
row.style.setProperty("--room-switch-
|
|
140
|
+
row.style.setProperty("--room-switch-origin", direction > 0 ? "top" : "bottom");
|
|
131
141
|
void row.offsetWidth;
|
|
132
142
|
row.classList.add("room-switch-enter");
|
|
143
|
+
setTimeout(() => row.classList.remove("room-switch-enter"), 220);
|
|
133
144
|
row.scrollIntoView({ block: "nearest" });
|
|
134
145
|
}
|
|
135
146
|
};
|
|
@@ -248,7 +248,7 @@ export const messages = {
|
|
|
248
248
|
reminderEdit: "Edit", reminderEditHeading: "Edit reminder", reminderSave: "Save changes",
|
|
249
249
|
reminderCreated: "Reminder created.", reminderUpdated: "Reminder updated.", reminderDeleted: "Reminder deleted.",
|
|
250
250
|
reminderInvalid: "Check the date, 5-field CRON expression, IANA timezone, and reminder text.", reminderLoadFailed: "Could not load reminders. Your draft is still here.",
|
|
251
|
-
diagramLoading: "Rendering diagram…", diagramRenderFailed: "Diagram unavailable; showing its source.", resourceLoading: "Loading file…", resourceFailed: "This file could not be loaded.", resourceDownload: "Download", resourceMoreActions: "More actions for {name}", resourcePreview: "Preview", resourceHide: "Hide preview", zoomImage: "Open image", imagePreviewTitle: "Image preview", imageZoomControls: "Image zoom", zoomIn: "Zoom in", zoomOut: "Zoom out", zoomReset: "Reset zoom", installTitle: "Install OC Chat", installBody: "Add it to your home screen for a full-screen chat.", installAction: "Install", installHow: "How to install", installNotNow: "Not now", installIosGuide: "Tap Share, then Add to Home Screen.",
|
|
251
|
+
diagramLoading: "Rendering diagram…", diagramRenderFailed: "Diagram unavailable; showing its source.", resourceLoading: "Loading file…", resourceFailed: "This file could not be loaded.", resourceDownload: "Download", resourceMoreActions: "More actions for {name}", resourcePreview: "Preview", resourceHide: "Hide preview", docPreviewEyebrow: "Markdown preview", docPreviewFailed: "This document could not be loaded.", docPreviewEmpty: "This document is empty.", zoomImage: "Open image", imagePreviewTitle: "Image preview", imageZoomControls: "Image zoom", zoomIn: "Zoom in", zoomOut: "Zoom out", zoomReset: "Reset zoom", installTitle: "Install OC Chat", installBody: "Add it to your home screen for a full-screen chat.", installAction: "Install", installHow: "How to install", installNotNow: "Not now", installIosGuide: "Tap Share, then Add to Home Screen.",
|
|
252
252
|
pwaUpdateTitle: "Update available", pwaUpdateBody: "A new version is ready. Reload now, or update the next time you open the app.", pwaUpdateNow: "Update now", pwaUpdateLater: "Later",
|
|
253
253
|
announcementDelete: "Delete announcement",
|
|
254
254
|
announcementNew: "New announcement", announcementEmpty: "No announcements yet.", announcementLoading: "Loading announcements…",
|
|
@@ -289,7 +289,7 @@ export const messages = {
|
|
|
289
289
|
shortcutsScroll: "Scroll messages while typing", shortcutsJump: "Jump to the start or end of the conversation", shortcutsMenus: "Menus and dialogs",
|
|
290
290
|
shortcutsClose: "Close the open menu, panel, or dialog",
|
|
291
291
|
paletteTitle: "Search and commands", paletteSearchLabel: "Search messages",
|
|
292
|
-
palettePlaceholder: "Search messages, or type
|
|
292
|
+
palettePlaceholder: "Search messages, or type / for commands", paletteScopeRoom: "This room", paletteScopeAll: "All rooms",
|
|
293
293
|
paletteScopeHint: "Tab switches between this room and all joined rooms", paletteSearchMode: "Search", paletteCommandMode: "Commands",
|
|
294
294
|
paletteSearching: "Searching…", paletteNoResults: "No messages found.", paletteNoCommands: "No matching commands.",
|
|
295
295
|
paletteResults: ({ count }) => `${count} result${count === 1 ? "" : "s"}`, paletteCommandsHint: "Common commands",
|
|
@@ -299,10 +299,28 @@ export const messages = {
|
|
|
299
299
|
filesUnknownUploader: "Unknown uploader", filesSummary: ({ count, size }) => `${count} file${count === 1 ? "" : "s"} · ${size}`,
|
|
300
300
|
filesLoading: "Loading files…", filesLoadFailed: "Could not load files. Try again.", filesEmpty: "No files in this room yet.",
|
|
301
301
|
filesEmptyFiltered: "No files from this uploader.", filesLoadMore: "Load more",
|
|
302
|
-
filesHint: "Preview images, audio, and
|
|
302
|
+
filesHint: "Preview images, audio, video, and Markdown. Download any file.",
|
|
303
303
|
filesPreviewFailed: "Could not load this preview.", filesDownloadFailed: "Could not download this file.",
|
|
304
304
|
filesPreviewLabel: ({ name }) => `Preview ${name}`, filesDownloadLabel: ({ name }) => `Download ${name}`,
|
|
305
305
|
filesDeleteLabel: ({ name }) => `Delete ${name}`, filesRefresh: "Refresh files",
|
|
306
|
+
tasksTitle: "Tasks", tasksEyebrow: "Room tasks", tasksRefresh: "Refresh tasks", tasksMenuLabel: "Task actions",
|
|
307
|
+
tasksClearCompleted: "Clear completed", tasksClearConfirm: ({ count }) => `Clear ${count} completed task${count === 1 ? "" : "s"}? This cannot be undone.`,
|
|
308
|
+
tasksClearFailed: "Could not clear completed tasks. Try again.",
|
|
309
|
+
tasksLoading: "Loading tasks…", tasksLoadFailed: "Could not load tasks. Try again.", tasksEmpty: "No tasks yet. Add the first one.",
|
|
310
|
+
tasksEmptyFiltered: "No tasks with this status.", tasksCreate: "Add task", tasksTitleLabel: "Title",
|
|
311
|
+
tasksTitlePlaceholder: "What needs doing?", tasksDescriptionLabel: "Description", tasksDescriptionPlaceholder: "Add details, links, or acceptance notes",
|
|
312
|
+
tasksAssigneeLabel: "Assignee", tasksUnassigned: "Unassigned", tasksFilterLabel: "Show", tasksFilterAll: "All statuses",
|
|
313
|
+
tasksDueDateLabel: "Due date", tasksDueOn: ({ date }) => `Due ${date}`, tasksOverdue: "Overdue",
|
|
314
|
+
tasksParticipantsLabel: "Participants", tasksParticipantsMeta: ({ names }) => `Participants: ${names}`,
|
|
315
|
+
tasksConclusionLabel: "Conclusion", tasksConclusionPlaceholder: "What was the outcome?",
|
|
316
|
+
tasksStepsLabel: "Steps", tasksAddStep: "Add step", tasksRemoveStep: "Remove step", tasksStepPlaceholder: "Describe a step",
|
|
317
|
+
tasksStepDoneLabel: "Step done", tasksStepsHint: "Up to 30 steps. Check the ones that are done.",
|
|
318
|
+
tasksStepsProgress: ({ done, total }) => `${done} of ${total} step${total === 1 ? "" : "s"} done`,
|
|
319
|
+
tasksStatusTodo: "To do", tasksStatusDoing: "Doing", tasksStatusDone: "Done",
|
|
320
|
+
tasksSummary: ({ count }) => `${count} task${count === 1 ? "" : "s"}`, tasksCreator: ({ name }) => `Created by ${name}`, tasksUpdated: ({ time }) => `Updated ${time}`,
|
|
321
|
+
tasksEditLabel: ({ title }) => `Edit ${title}`, tasksDeleteLabel: ({ title }) => `Delete ${title}`, tasksStatusFor: ({ title }) => `Status for ${title}`,
|
|
322
|
+
tasksInvalid: "Add a title of 1–200 characters.", tasksCreateFailed: "Could not add this task. Try again.", tasksUpdateFailed: "Could not update this task. Try again.",
|
|
323
|
+
tasksDeleteFailed: "Could not delete this task. Try again.", tasksDeleteConfirm: ({ title }) => `Delete “${title}”? This cannot be undone.`,
|
|
306
324
|
earlierMessages: "Earlier messages omitted", messagesBetweenOmitted: "Messages between this reading point and latest are omitted.", you: "You", saved: "Saved",
|
|
307
325
|
savedMemory: "Saved for this tab only", copyFailed: ({ id }) => `Copy failed. Copy manually: ${id}`,
|
|
308
326
|
copyMessage: "Copy", copiedMessage: "Copied", copyMessageFailed: "Could not copy. Select and copy the message manually.", wrapCode: "Wrap code",
|
|
@@ -382,7 +400,7 @@ export const messages = {
|
|
|
382
400
|
reminderEdit: "编辑", reminderEditHeading: "编辑提醒", reminderSave: "保存修改",
|
|
383
401
|
reminderCreated: "提醒已创建。", reminderUpdated: "提醒已更新。", reminderDeleted: "提醒已删除。",
|
|
384
402
|
reminderInvalid: "请检查日期、5 字段 CRON 表达式、IANA 时区和提醒内容。", reminderLoadFailed: "无法加载提醒,草稿仍已保留。",
|
|
385
|
-
diagramLoading: "正在渲染图表…", diagramRenderFailed: "图表无法显示,以下为源代码。", resourceLoading: "正在加载文件…", resourceFailed: "无法加载此文件。", resourceDownload: "下载", resourceMoreActions: "{name} 的更多操作", resourcePreview: "预览", resourceHide: "收起预览", zoomImage: "查看大图", imagePreviewTitle: "图片预览", imageZoomControls: "图片缩放", zoomIn: "放大", zoomOut: "缩小", zoomReset: "重置缩放", installTitle: "安装 OC Chat", installBody: "添加到主屏幕,获得全屏聊天体验。", installAction: "安装", installHow: "如何安装", installNotNow: "暂不", installIosGuide: "点击共享按钮,然后选择“添加到主屏幕”。",
|
|
403
|
+
diagramLoading: "正在渲染图表…", diagramRenderFailed: "图表无法显示,以下为源代码。", resourceLoading: "正在加载文件…", resourceFailed: "无法加载此文件。", resourceDownload: "下载", resourceMoreActions: "{name} 的更多操作", resourcePreview: "预览", resourceHide: "收起预览", docPreviewEyebrow: "Markdown 预览", docPreviewFailed: "无法加载此文档。", docPreviewEmpty: "此文档为空。", zoomImage: "查看大图", imagePreviewTitle: "图片预览", imageZoomControls: "图片缩放", zoomIn: "放大", zoomOut: "缩小", zoomReset: "重置缩放", installTitle: "安装 OC Chat", installBody: "添加到主屏幕,获得全屏聊天体验。", installAction: "安装", installHow: "如何安装", installNotNow: "暂不", installIosGuide: "点击共享按钮,然后选择“添加到主屏幕”。",
|
|
386
404
|
pwaUpdateTitle: "有可用更新", pwaUpdateBody: "新版本已准备好。可以立即刷新,或下次打开时再升级。", pwaUpdateNow: "立即升级", pwaUpdateLater: "稍后",
|
|
387
405
|
announcementDelete: "删除公告",
|
|
388
406
|
announcementNew: "新建公告", announcementEmpty: "暂无公告。", announcementLoading: "正在加载公告…",
|
|
@@ -419,7 +437,7 @@ export const messages = {
|
|
|
419
437
|
shortcutsScroll: "输入时滚动消息", shortcutsJump: "跳到会话开头或结尾", shortcutsMenus: "菜单和对话框",
|
|
420
438
|
shortcutsClose: "关闭当前菜单、面板或对话框",
|
|
421
439
|
paletteTitle: "搜索与命令", paletteSearchLabel: "搜索消息",
|
|
422
|
-
palettePlaceholder: "搜索消息,输入
|
|
440
|
+
palettePlaceholder: "搜索消息,输入 / 使用命令", paletteScopeRoom: "当前房间", paletteScopeAll: "全部房间",
|
|
423
441
|
paletteScopeHint: "按 Tab 在当前房间和全部已加入房间之间切换", paletteSearchMode: "搜索", paletteCommandMode: "命令",
|
|
424
442
|
paletteSearching: "正在搜索…", paletteNoResults: "没有找到消息。", paletteNoCommands: "没有匹配的命令。",
|
|
425
443
|
paletteResults: ({ count }) => `${count} 条结果`, paletteCommandsHint: "常用命令",
|
|
@@ -429,10 +447,28 @@ export const messages = {
|
|
|
429
447
|
filesUnknownUploader: "未知上传者", filesSummary: ({ count, size }) => `${count} 个文件 · ${size}`,
|
|
430
448
|
filesLoading: "正在加载文件…", filesLoadFailed: "无法加载文件,请重试。", filesEmpty: "这个房间还没有文件。",
|
|
431
449
|
filesEmptyFiltered: "此上传者没有文件。", filesLoadMore: "加载更多",
|
|
432
|
-
filesHint: "
|
|
450
|
+
filesHint: "可预览图片、音频、视频和 Markdown,所有文件都可下载。",
|
|
433
451
|
filesPreviewFailed: "无法加载预览。", filesDownloadFailed: "无法下载此文件。",
|
|
434
452
|
filesPreviewLabel: ({ name }) => `预览 ${name}`, filesDownloadLabel: ({ name }) => `下载 ${name}`,
|
|
435
453
|
filesDeleteLabel: ({ name }) => `删除 ${name}`, filesRefresh: "刷新文件",
|
|
454
|
+
tasksTitle: "任务", tasksEyebrow: "房间任务", tasksRefresh: "刷新任务", tasksMenuLabel: "任务操作",
|
|
455
|
+
tasksClearCompleted: "清除已完成任务", tasksClearConfirm: ({ count }) => `清除 ${count} 个已完成任务?此操作无法撤销。`,
|
|
456
|
+
tasksClearFailed: "无法清除已完成任务,请重试。",
|
|
457
|
+
tasksLoading: "正在加载任务…", tasksLoadFailed: "无法加载任务,请重试。", tasksEmpty: "还没有任务,添加第一个吧。",
|
|
458
|
+
tasksEmptyFiltered: "此状态下没有任务。", tasksCreate: "添加任务", tasksTitleLabel: "标题",
|
|
459
|
+
tasksTitlePlaceholder: "需要做什么?", tasksDescriptionLabel: "描述", tasksDescriptionPlaceholder: "补充细节、链接或完成标准",
|
|
460
|
+
tasksAssigneeLabel: "负责人", tasksUnassigned: "未指派", tasksFilterLabel: "显示", tasksFilterAll: "全部状态",
|
|
461
|
+
tasksDueDateLabel: "截止日期", tasksDueOn: ({ date }) => `截止 ${date}`, tasksOverdue: "已逾期",
|
|
462
|
+
tasksParticipantsLabel: "参与人员", tasksParticipantsMeta: ({ names }) => `参与人员:${names}`,
|
|
463
|
+
tasksConclusionLabel: "结论", tasksConclusionPlaceholder: "最终结果如何?",
|
|
464
|
+
tasksStepsLabel: "完成步骤", tasksAddStep: "添加步骤", tasksRemoveStep: "删除步骤", tasksStepPlaceholder: "描述一个步骤",
|
|
465
|
+
tasksStepDoneLabel: "步骤已完成", tasksStepsHint: "最多 30 个步骤,勾选已完成的步骤。",
|
|
466
|
+
tasksStepsProgress: ({ done, total }) => `已完成 ${done}/${total} 步`,
|
|
467
|
+
tasksStatusTodo: "待办", tasksStatusDoing: "进行中", tasksStatusDone: "已完成",
|
|
468
|
+
tasksSummary: ({ count }) => `${count} 个任务`, tasksCreator: ({ name }) => `由 ${name} 创建`, tasksUpdated: ({ time }) => `更新于 ${time}`,
|
|
469
|
+
tasksEditLabel: ({ title }) => `编辑 ${title}`, tasksDeleteLabel: ({ title }) => `删除 ${title}`, tasksStatusFor: ({ title }) => `${title} 的状态`,
|
|
470
|
+
tasksInvalid: "标题需为 1–200 个字符。", tasksCreateFailed: "无法添加任务,请重试。", tasksUpdateFailed: "无法更新任务,请重试。",
|
|
471
|
+
tasksDeleteFailed: "无法删除任务,请重试。", tasksDeleteConfirm: ({ title }) => `删除“${title}”?此操作无法撤销。`,
|
|
436
472
|
joined: "已加入", joinAction: "加入房间", unreadMessages: ({ count }) => `${count} 条未读`,
|
|
437
473
|
today: "今天", yesterday: "昨天", earlierMessages: "更早的消息已省略", messagesBetweenOmitted: "此阅读位置与最新消息之间的部分消息已省略。", you: "我", saved: "已保存",
|
|
438
474
|
savedMemory: "仅保存于当前标签页", copyFailed: ({ id }) => `复制失败,请手动复制:${id}`,
|
|
@@ -23,7 +23,15 @@ function formatLine(line, app) {
|
|
|
23
23
|
|
|
24
24
|
export function formatSystemMessage(message, app) {
|
|
25
25
|
// `<at>@name</at>` is an editor token; system rows and previews show the plain mention.
|
|
26
|
-
|
|
26
|
+
let text = String(message?.text ?? "")
|
|
27
|
+
.replace(/<at>@all<\/at>/g, `@${app.t("allMembers")}`)
|
|
28
|
+
.replace(/<at>([\s\S]*?)<\/at>/g, "$1");
|
|
29
|
+
// Resource markers are internal IDs. A rail preview must not expose them.
|
|
30
|
+
const resources = /\[\[resource:[0-9a-f-]{36}\]\]/gi;
|
|
31
|
+
if (resources.test(text)) {
|
|
32
|
+
text = text.replace(resources, "").trim();
|
|
33
|
+
text = text ? `${text} · ${app.t("attachments")}` : app.t("attachments");
|
|
34
|
+
}
|
|
27
35
|
if (message?.senderId !== "system") return text;
|
|
28
36
|
// One edit can log several changes joined by "; "; translate each line.
|
|
29
37
|
return text.split("; ").map((line) => formatLine(line, app)).join("; ");
|