@alexsun-top/opencode-chat-room 0.7.6 → 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 +13 -0
- package/README.md +5 -5
- package/README.zh-CN.md +5 -5
- package/dist/cli.js +735 -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 +11 -2
- package/server/assets/chat/editor.js +10 -7
- package/server/assets/chat/events.js +1 -1
- package/server/assets/chat/index.js +2 -0
- package/server/assets/chat/locales/de.js +18 -0
- package/server/assets/chat/locales/es.js +18 -0
- package/server/assets/chat/locales/fr.js +18 -0
- package/server/assets/chat/locales/it.js +18 -0
- package/server/assets/chat/locales/ja.js +18 -0
- package/server/assets/chat/locales/ko.js +18 -0
- package/server/assets/chat/markdown.js +27 -1
- package/server/assets/chat/messages.js +1 -0
- package/server/assets/chat/palette.js +9 -4
- 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 +36 -0
- package/server/assets/chat/system-messages.js +3 -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/responsive.css +26 -1
- package/server/assets/tasks.css +422 -0
- package/server/chat.html +97 -19
- package/server/member-routes.ts +3 -0
- package/server/sw.js +12 -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 +5 -3
- package/src/tui/main.mjs +4 -4
- package/src/tui/markdown.mjs +29 -5
- package/src/tui/mentions.mjs +218 -0
- package/src/tui/message-app.mjs +3 -2
- package/src/tui/palette-app.mjs +9 -2
- package/src/tui/ui-content.mjs +9 -2
- package/src/tui/ui-mentions.mjs +44 -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 +2 -0
- package/src/tui/ui.mjs +17 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexsun-top/opencode-chat-room",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.7",
|
|
4
4
|
"description": "A chat-room server, web client, terminal client, and OpenCode/Codex/dsh plugins.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"server/join-requests.ts",
|
|
41
41
|
"server/room-join.ts",
|
|
42
42
|
"server/member-routes.ts",
|
|
43
|
+
"server/task-routes.ts",
|
|
43
44
|
"server/announcement-routes.ts",
|
|
44
45
|
"server/resource-routes.ts",
|
|
45
46
|
"server/admin-routes.ts",
|
package/plugin.ts
CHANGED
|
@@ -30,6 +30,7 @@ import { explicitlyAddresses } from "./src/center/mentions.ts";
|
|
|
30
30
|
import { createV2Setup, type V2Runtime } from "./src/runtime/v2-plugin.ts";
|
|
31
31
|
import { createV1Server } from "./src/runtime/v1-plugin.ts";
|
|
32
32
|
import { runAnnouncementTool } from "./src/agent/announcement-tool.ts";
|
|
33
|
+
import { runTaskTool } from "./src/agent/task-tool.ts";
|
|
33
34
|
import { uploadAgentResource } from "./src/rooms/resource-upload.ts";
|
|
34
35
|
import { readAgentResource, resourceReadFailure } from "./src/rooms/resource-read.ts";
|
|
35
36
|
import { adminTool, adminToolDescription, adminToolSchema } from "./src/agent/admin-client.ts";
|
|
@@ -247,7 +248,7 @@ export async function pollKnownSessions(
|
|
|
247
248
|
await flushReceiptCandidates({ destination: receiptDestination(""), receiverOwnerID: transport.receiverOwnerID }).catch(() => {});
|
|
248
249
|
}
|
|
249
250
|
|
|
250
|
-
const READ_ONLY_ACTIONS = new Set(["list", "members", "poll", "join_status", "announcement_list", "announcement_read"]);
|
|
251
|
+
const READ_ONLY_ACTIONS = new Set(["list", "members", "poll", "join_status", "announcement_list", "announcement_read", "task_list"]);
|
|
251
252
|
|
|
252
253
|
function actionableError(error: unknown): string {
|
|
253
254
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -270,7 +271,7 @@ function actionableError(error: unknown): string {
|
|
|
270
271
|
}
|
|
271
272
|
|
|
272
273
|
export const roomArgs = z.object({
|
|
273
|
-
action: z.enum(["create", "join", "join_status", "leave", "list", "send", "poll", "recall", "members", "upload_resource", "read_resource", "delete_resource", "announcement_list", "announcement_read", "announcement_write", "announcement_delete", "reminder_list", "reminder_create", "reminder_update", "reminder_delete"]),
|
|
274
|
+
action: z.enum(["create", "join", "join_status", "leave", "list", "send", "poll", "recall", "members", "upload_resource", "read_resource", "delete_resource", "announcement_list", "announcement_read", "announcement_write", "announcement_delete", "reminder_list", "reminder_create", "reminder_update", "reminder_delete", "task_list", "task_create", "task_update", "task_delete"]),
|
|
274
275
|
name: z.string().max(64).optional().describe("For join: your own participant display name, NOT the room name (required). For create: the new room name."),
|
|
275
276
|
roomId: z.string().optional().describe("Room UUID, not the room name. Required for resource actions and every room-scoped action."),
|
|
276
277
|
messageId: z.string().optional().describe("For recall: the full message ID returned by send or poll; required for recall."),
|
|
@@ -280,6 +281,15 @@ export const roomArgs = z.object({
|
|
|
280
281
|
isQuestion: z.boolean().optional().describe("For send: mark the message as a question awaiting an answer."),
|
|
281
282
|
announcementName: z.string().optional().describe("Exact announcement name from announcement_list; distinct from participant or room name."),
|
|
282
283
|
content: z.string().optional().describe("Announcement content, at most 5000 Unicode characters; required for announcement_write."),
|
|
284
|
+
taskId: z.string().optional().describe("Task UUID from task_list; required for task_update and task_delete."),
|
|
285
|
+
title: z.string().optional().describe("Task title, 1 to 200 characters; required for task_create."),
|
|
286
|
+
description: z.string().optional().describe("Task description, at most 5000 characters."),
|
|
287
|
+
assignee: z.string().optional().describe("Participant display name responsible for the task; empty leaves it unassigned."),
|
|
288
|
+
status: z.enum(["todo", "doing", "done"]).optional().describe("Task status; the assignee may change only this field."),
|
|
289
|
+
dueDate: z.string().optional().describe("Task due date as YYYY-MM-DD; empty clears it."),
|
|
290
|
+
participants: z.array(z.string()).optional().describe("Task participants as room participant display names; empty clears them."),
|
|
291
|
+
conclusion: z.string().optional().describe("Task conclusion, at most 5000 characters; empty clears it."),
|
|
292
|
+
steps: z.array(z.union([z.string(), z.object({ text: z.string(), done: z.boolean().optional() })])).optional().describe("Task checklist, at most 30 steps; each is text of 1 to 300 characters or {text, done}; empty clears them."),
|
|
283
293
|
reminderId: z.string().optional().describe("Reminder UUID from reminder_list; required for reminder_update and reminder_delete."),
|
|
284
294
|
schedule: z.discriminatedUnion("type", [z.object({ type: z.literal("once"), at: z.string(), timezone: z.string().refine((value) => { try { new Intl.DateTimeFormat("en", { timeZone: value }); return true; } catch { return false; } }, "timezone must be an IANA timezone").optional() }), z.object({ type: z.literal("cron"), expression: z.string().regex(/^\S+\s+\S+\s+\S+\s+\S+\s+\S+$/), timezone: z.string().refine((value) => { try { new Intl.DateTimeFormat("en", { timeZone: value }); return true; } catch { return false; } }, "timezone must be an IANA timezone").optional() })]).optional(),
|
|
285
295
|
paused: z.boolean().optional(),
|
|
@@ -343,6 +353,8 @@ const roomExecute = async (
|
|
|
343
353
|
}
|
|
344
354
|
const announcementResult = await runAnnouncementTool(args, context.sessionID);
|
|
345
355
|
if (announcementResult !== undefined) return announcementResult;
|
|
356
|
+
const taskResult = await runTaskTool(args, context.sessionID);
|
|
357
|
+
if (taskResult !== undefined) return taskResult;
|
|
346
358
|
// ponytail: act as the identity this session registered with on join
|
|
347
359
|
let selfName = identity();
|
|
348
360
|
let joinPrevName: string | undefined;
|
|
@@ -525,7 +537,7 @@ const roomExecute = async (
|
|
|
525
537
|
}
|
|
526
538
|
};
|
|
527
539
|
const room = tool({
|
|
528
|
-
description: "Chat room operations: create, join, leave and list rooms; send, poll and recall messages; list members and
|
|
540
|
+
description: "Chat room operations: create, join, leave and list rooms; send, poll and recall messages; list members, announcements and tasks; create, update and delete room tasks; manage reminders. Sent and polled messages carry full message IDs; recall takes roomId plus messageId and withdraws the message for everyone (agents their own, room admins any). Reminder schedules use the server timezone unless an IANA timezone is provided; once schedules require an ISO datetime. Upload files and media; upload_resource returns a [[resource:UUID]] marker, and the attachment renders only when that exact marker is included in a send message. Resource actions need both roomId (the room UUID) and resourceId (the UUID in the marker); the marker alone does not identify the room. read_resource saves files to a private temporary path and leaves them there until removed or system cleanup. delete_resource removes an uploaded file; servers allow human room administrators any resource and agents only their own uploads. Room joinPolicy \"approval\" makes join a pending request: you are not a member while pending, never claim otherwise, and use join_status to check whether a human administrator approved it.",
|
|
529
541
|
args: roomArgs.shape,
|
|
530
542
|
execute: roomExecute,
|
|
531
543
|
});
|
package/server/assets/base.css
CHANGED
|
@@ -347,8 +347,6 @@
|
|
|
347
347
|
transition: background .12s, border-color .12s;
|
|
348
348
|
}
|
|
349
349
|
.room-row:hover { background: var(--surface-2); border-color: var(--line); }
|
|
350
|
-
.room-row.room-switch-enter { animation: room-switch-row .15s cubic-bezier(.1, .9, .2, 1); }
|
|
351
|
-
@keyframes room-switch-row { from { opacity: .55; transform: translateY(var(--room-switch-shift, 3px)); } }
|
|
352
350
|
.r-name { font-weight: 600; font-size: 14px; }
|
|
353
351
|
.r-meta { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
|
|
354
352
|
.r-go {
|
|
@@ -11,7 +11,7 @@ export function initDocPreview(app) {
|
|
|
11
11
|
const status = app.$("#docPreviewStatus"), body = app.$("#docPreviewBody");
|
|
12
12
|
const empty = app.$("#docPreviewEmpty"), download = app.$("#btnDocPreviewDownload");
|
|
13
13
|
const chatView = app.$("#chatView"), pane = matchMedia(PANE_QUERY);
|
|
14
|
-
let current = null, blob = null, token = 0, opener = null, pendingReopen = false;
|
|
14
|
+
let current = null, blob = null, token = 0, opener = null, pendingReopen = false, restoreOnClose = true;
|
|
15
15
|
|
|
16
16
|
const show = () => {
|
|
17
17
|
if (pane.matches) {
|
|
@@ -36,6 +36,7 @@ export function initDocPreview(app) {
|
|
|
36
36
|
|
|
37
37
|
const open = async (roomId, resource, source) => {
|
|
38
38
|
opener = source instanceof HTMLElement ? source : null;
|
|
39
|
+
restoreOnClose = true;
|
|
39
40
|
current = { roomId, resource };
|
|
40
41
|
const request = ++token;
|
|
41
42
|
blob = null;
|
|
@@ -65,8 +66,13 @@ export function initDocPreview(app) {
|
|
|
65
66
|
};
|
|
66
67
|
|
|
67
68
|
const close = (restoreFocus = true) => {
|
|
69
|
+
restoreOnClose = restoreFocus;
|
|
68
70
|
if (!restoreFocus) opener = null;
|
|
71
|
+
// Remove the column class now; the queued close event must not leave Tasks
|
|
72
|
+
// hidden behind a column the task pane is about to take back.
|
|
73
|
+
chatView.classList.remove("has-doc");
|
|
69
74
|
if (dialog.open) dialog.close();
|
|
75
|
+
else restoreOnClose = true;
|
|
70
76
|
};
|
|
71
77
|
|
|
72
78
|
const downloadDocument = () => {
|
|
@@ -95,7 +101,9 @@ export function initDocPreview(app) {
|
|
|
95
101
|
dialog.addEventListener("close", () => {
|
|
96
102
|
// A breakpoint switch closes and reopens the same dialog; its queued close event
|
|
97
103
|
// must not wipe the document that is already back on screen.
|
|
98
|
-
if (pendingReopen) { pendingReopen = false; return; }
|
|
104
|
+
if (pendingReopen) { pendingReopen = false; restoreOnClose = true; return; }
|
|
105
|
+
const shouldRestore = restoreOnClose;
|
|
106
|
+
restoreOnClose = true;
|
|
99
107
|
token++;
|
|
100
108
|
current = null; blob = null;
|
|
101
109
|
chatView.classList.remove("has-doc");
|
|
@@ -103,6 +111,7 @@ export function initDocPreview(app) {
|
|
|
103
111
|
title.textContent = ""; size.textContent = ""; status.textContent = "";
|
|
104
112
|
body.textContent = ""; empty.hidden = true; download.disabled = true;
|
|
105
113
|
const target = opener; opener = null;
|
|
114
|
+
if (!shouldRestore) return;
|
|
106
115
|
if (target?.isConnected && target.getClientRects().length) target.focus({ preventScroll: true });
|
|
107
116
|
else app.focusChatComposer?.({ force: true });
|
|
108
117
|
});
|
|
@@ -4,7 +4,10 @@ const trustedChipNames = new Map();
|
|
|
4
4
|
const autoSeparator = "\uE000\uE001";
|
|
5
5
|
function mentionName(node) {
|
|
6
6
|
const name = trustedChipNames.get(node.dataset?.chatChip);
|
|
7
|
-
return name !== undefined && node.dataset.mention === name
|
|
7
|
+
return name !== undefined && node.dataset.mention === name ? name : null;
|
|
8
|
+
}
|
|
9
|
+
function chipLabel(editor, name) {
|
|
10
|
+
return editor.mentionLabel ? editor.mentionLabel(name) : name;
|
|
8
11
|
}
|
|
9
12
|
|
|
10
13
|
export function editorText(editor, draft = false) {
|
|
@@ -53,7 +56,7 @@ export function setEditorText(editor, value, draft = false) {
|
|
|
53
56
|
if (draft && match[0] === autoSeparator) { editor.append(createAutoSeparator()); offset = pattern.lastIndex; continue; }
|
|
54
57
|
if (draft && match[0] === "\uE000\uE000") { appendText(editor, "\uE000"); offset = pattern.lastIndex; continue; }
|
|
55
58
|
if (draft && match[0].startsWith("\uE000")) { appendText(editor, match[0].slice(1)); offset = pattern.lastIndex; continue; }
|
|
56
|
-
editor.append(createMention(draft ? match[2] : match[1])); offset = pattern.lastIndex;
|
|
59
|
+
editor.append(createMention(editor, draft ? match[2] : match[1])); offset = pattern.lastIndex;
|
|
57
60
|
}
|
|
58
61
|
appendText(editor, String(value).slice(offset));
|
|
59
62
|
editor.dataset.empty = value ? "false" : "true";
|
|
@@ -194,9 +197,9 @@ export function replaceEditorRange(editor, start, end, value, parseMentions = tr
|
|
|
194
197
|
let html = "", cursor = 0, match;
|
|
195
198
|
while (token && (match = token.exec(content))) {
|
|
196
199
|
html += textHTML(content.slice(cursor, match.index));
|
|
197
|
-
const name = escapeHTML(match[1]);
|
|
200
|
+
const name = escapeHTML(match[1]), label = escapeHTML(chipLabel(editor, match[1]));
|
|
198
201
|
const chipID = createRandomId(); trustedChipNames.set(chipID, match[1]);
|
|
199
|
-
html += `<span class="editor-mention" data-mention="${name}" data-chat-chip="${chipID}" data-insert-marker="${marker}" contenteditable="false" role="img" aria-label="Mention ${
|
|
202
|
+
html += `<span class="editor-mention" data-mention="${name}" data-chat-chip="${chipID}" data-insert-marker="${marker}" contenteditable="false" role="img" aria-label="Mention ${label}">@${label}</span>`;
|
|
200
203
|
cursor = token.lastIndex;
|
|
201
204
|
}
|
|
202
205
|
html += textHTML(content.slice(cursor));
|
|
@@ -247,12 +250,12 @@ function knownMentions(editor, text) {
|
|
|
247
250
|
function escapeHTML(text) { return String(text).replace(/[&<>"']/g, (char) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[char]); }
|
|
248
251
|
function textHTML(text) { return escapeHTML(text).replace(/\r\n|\r|\n/g, "<br>"); }
|
|
249
252
|
|
|
250
|
-
function createMention(name) {
|
|
251
|
-
const chip = document.createElement("span");
|
|
253
|
+
function createMention(editor, name) {
|
|
254
|
+
const chip = document.createElement("span"), label = chipLabel(editor, name);
|
|
252
255
|
chip.className = "editor-mention"; chip.dataset.mention = name;
|
|
253
256
|
chip.dataset.chatChip = createRandomId(); trustedChipNames.set(chip.dataset.chatChip, name);
|
|
254
257
|
chip.contentEditable = "false"; chip.setAttribute("role", "img");
|
|
255
|
-
chip.setAttribute("aria-label", `Mention ${
|
|
258
|
+
chip.setAttribute("aria-label", `Mention ${label}`); chip.textContent = `@${label}`;
|
|
256
259
|
return chip;
|
|
257
260
|
}
|
|
258
261
|
function createAutoSeparator() {
|
|
@@ -383,7 +383,7 @@ export function initEvents(app) {
|
|
|
383
383
|
const fragment = copyRange.cloneContents();
|
|
384
384
|
const selectedChips = fragment.querySelectorAll(".mention-chip");
|
|
385
385
|
if (!selectedChips.length) return;
|
|
386
|
-
selectedChips.forEach((chip) => chip.replaceWith(document.createTextNode(`<at>@${chip.textContent?.slice(1) ?? ""}</at>`)));
|
|
386
|
+
selectedChips.forEach((chip) => chip.replaceWith(document.createTextNode(`<at>@${chip.dataset.mention ?? chip.textContent?.slice(1) ?? ""}</at>`)));
|
|
387
387
|
const text = fragment.textContent ?? "";
|
|
388
388
|
const html = `<div data-chatroom-mentions>${text.replace(/[&<>"]/g, (char) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[char])}</div>`;
|
|
389
389
|
event.clipboardData?.setData("text/plain", text);
|
|
@@ -23,6 +23,7 @@ import { initInstallPrompt } from "./install-prompt.js";
|
|
|
23
23
|
import { initShortcuts } from "./shortcuts.js";
|
|
24
24
|
import { initPalette } from "./palette.js";
|
|
25
25
|
import { initFiles } from "./files.js";
|
|
26
|
+
import { initTasks } from "./tasks.js";
|
|
26
27
|
import { initDocPreview } from "./doc-preview.js";
|
|
27
28
|
import { initViewport } from "./viewport.js";
|
|
28
29
|
import { initSettings } from "./settings.js";
|
|
@@ -53,4 +54,5 @@ initViewport();
|
|
|
53
54
|
initInstallPrompt(app);
|
|
54
55
|
initPalette(app);
|
|
55
56
|
initFiles(app);
|
|
57
|
+
initTasks(app);
|
|
56
58
|
initDocPreview(app);
|
|
@@ -98,6 +98,24 @@ export const de = {
|
|
|
98
98
|
filesPreviewFailed: "Vorschau konnte nicht geladen werden.", filesDownloadFailed: "Diese Datei konnte nicht heruntergeladen werden.",
|
|
99
99
|
filesPreviewLabel: ({ name }) => `${name} ansehen`, filesDownloadLabel: ({ name }) => `${name} herunterladen`,
|
|
100
100
|
filesDeleteLabel: ({ name }) => `${name} löschen`, filesRefresh: "Dateien aktualisieren",
|
|
101
|
+
tasksTitle: "Aufgaben", tasksEyebrow: "Raumaufgaben", tasksRefresh: "Aufgaben aktualisieren", tasksMenuLabel: "Aufgabenaktionen",
|
|
102
|
+
tasksClearCompleted: "Erledigte Aufgaben löschen", tasksClearConfirm: ({ count }) => `${count} erledigte Aufgabe${count === 1 ? "" : "n"} löschen? Dies kann nicht rückgängig gemacht werden.`,
|
|
103
|
+
tasksClearFailed: "Erledigte Aufgaben konnten nicht gelöscht werden. Erneut versuchen.",
|
|
104
|
+
tasksLoading: "Aufgaben werden geladen…", tasksLoadFailed: "Aufgaben konnten nicht geladen werden. Erneut versuchen.", tasksEmpty: "Noch keine Aufgaben. Fügen Sie die erste hinzu.",
|
|
105
|
+
tasksEmptyFiltered: "Keine Aufgaben mit diesem Status.", tasksCreate: "Aufgabe hinzufügen", tasksTitleLabel: "Titel",
|
|
106
|
+
tasksTitlePlaceholder: "Was ist zu tun?", tasksDescriptionLabel: "Beschreibung", tasksDescriptionPlaceholder: "Details, Links oder Abnahmekriterien ergänzen",
|
|
107
|
+
tasksAssigneeLabel: "Zuständig", tasksUnassigned: "Nicht zugewiesen", tasksFilterLabel: "Anzeigen", tasksFilterAll: "Alle Status",
|
|
108
|
+
tasksDueDateLabel: "Fälligkeitsdatum", tasksDueOn: ({ date }) => `Fällig ${date}`, tasksOverdue: "Überfällig",
|
|
109
|
+
tasksParticipantsLabel: "Teilnehmende", tasksParticipantsMeta: ({ names }) => `Teilnehmende: ${names}`,
|
|
110
|
+
tasksConclusionLabel: "Ergebnis", tasksConclusionPlaceholder: "Wie ist es ausgegangen?",
|
|
111
|
+
tasksStepsLabel: "Schritte", tasksAddStep: "Schritt hinzufügen", tasksRemoveStep: "Schritt entfernen", tasksStepPlaceholder: "Schritt beschreiben",
|
|
112
|
+
tasksStepDoneLabel: "Schritt erledigt", tasksStepsHint: "Bis zu 30 Schritte. Erledigte Schritte abhaken.",
|
|
113
|
+
tasksStepsProgress: ({ done, total }) => `${done} von ${total} Schritten erledigt`,
|
|
114
|
+
tasksStatusTodo: "Offen", tasksStatusDoing: "In Arbeit", tasksStatusDone: "Erledigt",
|
|
115
|
+
tasksSummary: ({ count }) => `${count} Aufgabe${count === 1 ? "" : "n"}`, tasksCreator: ({ name }) => `Erstellt von ${name}`, tasksUpdated: ({ time }) => `Aktualisiert ${time}`,
|
|
116
|
+
tasksEditLabel: ({ title }) => `${title} bearbeiten`, tasksDeleteLabel: ({ title }) => `${title} löschen`, tasksStatusFor: ({ title }) => `Status für ${title}`,
|
|
117
|
+
tasksInvalid: "Geben Sie einen Titel mit 1–200 Zeichen ein.", tasksCreateFailed: "Aufgabe konnte nicht hinzugefügt werden. Erneut versuchen.", tasksUpdateFailed: "Aufgabe konnte nicht aktualisiert werden. Erneut versuchen.",
|
|
118
|
+
tasksDeleteFailed: "Aufgabe konnte nicht gelöscht werden. Erneut versuchen.", tasksDeleteConfirm: ({ title }) => `„${title}“ löschen? Dies kann nicht rückgängig gemacht werden.`,
|
|
101
119
|
earlierMessages: "Frühere Nachrichten ausgelassen", messagesBetweenOmitted: "Nachrichten zwischen diesem Lesepunkt und den neuesten werden ausgelassen.", you: "Sie", saved: "Gespeichert",
|
|
102
120
|
savedMemory: "Nur für diesen Tab gespeichert", copyFailed: ({ id }) => `Kopieren fehlgeschlagen. Manuell kopieren: ${id}`,
|
|
103
121
|
copyMessage: "Kopieren", copiedMessage: "Kopiert", copyMessageFailed: "Kopieren fehlgeschlagen. Wählen Sie die Nachricht aus und kopieren Sie sie manuell.", wrapCode: "Code umbrechen",
|
|
@@ -98,6 +98,24 @@ export const es = {
|
|
|
98
98
|
filesPreviewFailed: "No se pudo cargar la vista previa.", filesDownloadFailed: "No se pudo descargar este archivo.",
|
|
99
99
|
filesPreviewLabel: ({ name }) => `Vista previa de ${name}`, filesDownloadLabel: ({ name }) => `Descargar ${name}`,
|
|
100
100
|
filesDeleteLabel: ({ name }) => `Eliminar ${name}`, filesRefresh: "Actualizar archivos",
|
|
101
|
+
tasksTitle: "Tareas", tasksEyebrow: "Tareas de la sala", tasksRefresh: "Actualizar tareas", tasksMenuLabel: "Acciones de tareas",
|
|
102
|
+
tasksClearCompleted: "Borrar tareas completadas", tasksClearConfirm: ({ count }) => `¿Borrar ${count} tarea${count === 1 ? "" : "s"} completada${count === 1 ? "" : "s"}? No se puede deshacer.`,
|
|
103
|
+
tasksClearFailed: "No se pudieron borrar las tareas completadas. Inténtalo de nuevo.",
|
|
104
|
+
tasksLoading: "Cargando tareas…", tasksLoadFailed: "No se pudieron cargar las tareas. Inténtalo de nuevo.", tasksEmpty: "Aún no hay tareas. Añade la primera.",
|
|
105
|
+
tasksEmptyFiltered: "No hay tareas con este estado.", tasksCreate: "Añadir tarea", tasksTitleLabel: "Título",
|
|
106
|
+
tasksTitlePlaceholder: "¿Qué hay que hacer?", tasksDescriptionLabel: "Descripción", tasksDescriptionPlaceholder: "Añade detalles, enlaces o criterios",
|
|
107
|
+
tasksAssigneeLabel: "Responsable", tasksUnassigned: "Sin asignar", tasksFilterLabel: "Mostrar", tasksFilterAll: "Todos los estados",
|
|
108
|
+
tasksDueDateLabel: "Fecha límite", tasksDueOn: ({ date }) => `Vence ${date}`, tasksOverdue: "Vencida",
|
|
109
|
+
tasksParticipantsLabel: "Participantes", tasksParticipantsMeta: ({ names }) => `Participantes: ${names}`,
|
|
110
|
+
tasksConclusionLabel: "Conclusión", tasksConclusionPlaceholder: "¿Cuál fue el resultado?",
|
|
111
|
+
tasksStepsLabel: "Pasos", tasksAddStep: "Añadir paso", tasksRemoveStep: "Eliminar paso", tasksStepPlaceholder: "Describe un paso",
|
|
112
|
+
tasksStepDoneLabel: "Paso completado", tasksStepsHint: "Hasta 30 pasos. Marca los que estén completados.",
|
|
113
|
+
tasksStepsProgress: ({ done, total }) => `${done} de ${total} pasos completados`,
|
|
114
|
+
tasksStatusTodo: "Pendiente", tasksStatusDoing: "En curso", tasksStatusDone: "Hecha",
|
|
115
|
+
tasksSummary: ({ count }) => `${count} tarea${count === 1 ? "" : "s"}`, tasksCreator: ({ name }) => `Creada por ${name}`, tasksUpdated: ({ time }) => `Actualizada ${time}`,
|
|
116
|
+
tasksEditLabel: ({ title }) => `Editar ${title}`, tasksDeleteLabel: ({ title }) => `Eliminar ${title}`, tasksStatusFor: ({ title }) => `Estado de ${title}`,
|
|
117
|
+
tasksInvalid: "Introduce un título de 1 a 200 caracteres.", tasksCreateFailed: "No se pudo añadir la tarea. Inténtalo de nuevo.", tasksUpdateFailed: "No se pudo actualizar la tarea. Inténtalo de nuevo.",
|
|
118
|
+
tasksDeleteFailed: "No se pudo eliminar la tarea. Inténtalo de nuevo.", tasksDeleteConfirm: ({ title }) => `¿Eliminar «${title}»? No se puede deshacer.`,
|
|
101
119
|
earlierMessages: "Se han omitido mensajes anteriores", messagesBetweenOmitted: "Se han omitido los mensajes entre este punto de lectura y los más recientes.", you: "Tú", saved: "Guardado",
|
|
102
120
|
savedMemory: "Guardado solo para esta pestaña", copyFailed: ({ id }) => `No se pudo copiar. Copia manualmente: ${id}`,
|
|
103
121
|
copyMessage: "Copiar", copiedMessage: "Copiado", copyMessageFailed: "No se pudo copiar. Selecciona y copia el mensaje manualmente.", wrapCode: "Ajustar código",
|
|
@@ -98,6 +98,24 @@ export const fr = {
|
|
|
98
98
|
filesPreviewFailed: "Impossible de charger cet aperçu.", filesDownloadFailed: "Impossible de télécharger ce fichier.",
|
|
99
99
|
filesPreviewLabel: ({ name }) => `Aperçu de ${name}`, filesDownloadLabel: ({ name }) => `Télécharger ${name}`,
|
|
100
100
|
filesDeleteLabel: ({ name }) => `Supprimer ${name}`, filesRefresh: "Actualiser les fichiers",
|
|
101
|
+
tasksTitle: "Tâches", tasksEyebrow: "Tâches du salon", tasksRefresh: "Actualiser les tâches", tasksMenuLabel: "Actions des tâches",
|
|
102
|
+
tasksClearCompleted: "Effacer les tâches terminées", tasksClearConfirm: ({ count }) => `Effacer ${count} tâche${count === 1 ? "" : "s"} terminée${count === 1 ? "" : "s"} ? Cette action est irréversible.`,
|
|
103
|
+
tasksClearFailed: "Impossible d’effacer les tâches terminées. Réessayez.",
|
|
104
|
+
tasksLoading: "Chargement des tâches…", tasksLoadFailed: "Impossible de charger les tâches. Réessayez.", tasksEmpty: "Aucune tâche pour l’instant. Ajoutez la première.",
|
|
105
|
+
tasksEmptyFiltered: "Aucune tâche avec ce statut.", tasksCreate: "Ajouter une tâche", tasksTitleLabel: "Titre",
|
|
106
|
+
tasksTitlePlaceholder: "Que faut-il faire ?", tasksDescriptionLabel: "Description", tasksDescriptionPlaceholder: "Ajoutez des détails, des liens ou des critères",
|
|
107
|
+
tasksAssigneeLabel: "Responsable", tasksUnassigned: "Non attribuée", tasksFilterLabel: "Afficher", tasksFilterAll: "Tous les statuts",
|
|
108
|
+
tasksDueDateLabel: "Date limite", tasksDueOn: ({ date }) => `Échéance ${date}`, tasksOverdue: "En retard",
|
|
109
|
+
tasksParticipantsLabel: "Participants", tasksParticipantsMeta: ({ names }) => `Participants : ${names}`,
|
|
110
|
+
tasksConclusionLabel: "Conclusion", tasksConclusionPlaceholder: "Quel a été le résultat ?",
|
|
111
|
+
tasksStepsLabel: "Étapes", tasksAddStep: "Ajouter une étape", tasksRemoveStep: "Supprimer l’étape", tasksStepPlaceholder: "Décrivez une étape",
|
|
112
|
+
tasksStepDoneLabel: "Étape terminée", tasksStepsHint: "Jusqu’à 30 étapes. Cochez celles qui sont terminées.",
|
|
113
|
+
tasksStepsProgress: ({ done, total }) => `${done} étape${done === 1 ? "" : "s"} sur ${total} terminée${done === 1 ? "" : "s"}`,
|
|
114
|
+
tasksStatusTodo: "À faire", tasksStatusDoing: "En cours", tasksStatusDone: "Terminée",
|
|
115
|
+
tasksSummary: ({ count }) => `${count} tâche${count === 1 ? "" : "s"}`, tasksCreator: ({ name }) => `Créée par ${name}`, tasksUpdated: ({ time }) => `Mise à jour ${time}`,
|
|
116
|
+
tasksEditLabel: ({ title }) => `Modifier ${title}`, tasksDeleteLabel: ({ title }) => `Supprimer ${title}`, tasksStatusFor: ({ title }) => `Statut de ${title}`,
|
|
117
|
+
tasksInvalid: "Saisissez un titre de 1 à 200 caractères.", tasksCreateFailed: "Impossible d’ajouter la tâche. Réessayez.", tasksUpdateFailed: "Impossible de modifier la tâche. Réessayez.",
|
|
118
|
+
tasksDeleteFailed: "Impossible de supprimer la tâche. Réessayez.", tasksDeleteConfirm: ({ title }) => `Supprimer « ${title} » ? Cette action est irréversible.`,
|
|
101
119
|
earlierMessages: "Messages précédents omis", messagesBetweenOmitted: "Les messages entre ce point de lecture et les derniers sont omis.", you: "Vous", saved: "Enregistré",
|
|
102
120
|
savedMemory: "Enregistré pour cet onglet uniquement", copyFailed: ({ id }) => `Copie impossible. Copiez manuellement : ${id}`,
|
|
103
121
|
copyMessage: "Copier", copiedMessage: "Copié", copyMessageFailed: "Copie impossible. Sélectionnez et copiez le message manuellement.", wrapCode: "Retour à la ligne",
|
|
@@ -98,6 +98,24 @@ export const it = {
|
|
|
98
98
|
filesPreviewFailed: "Impossibile caricare l’anteprima.", filesDownloadFailed: "Impossibile scaricare questo file.",
|
|
99
99
|
filesPreviewLabel: ({ name }) => `Anteprima di ${name}`, filesDownloadLabel: ({ name }) => `Scarica ${name}`,
|
|
100
100
|
filesDeleteLabel: ({ name }) => `Elimina ${name}`, filesRefresh: "Aggiorna i file",
|
|
101
|
+
tasksTitle: "Attività", tasksEyebrow: "Attività della stanza", tasksRefresh: "Aggiorna attività", tasksMenuLabel: "Azioni attività",
|
|
102
|
+
tasksClearCompleted: "Elimina attività completate", tasksClearConfirm: ({ count }) => `Eliminare ${count} attività completate? L’operazione non è reversibile.`,
|
|
103
|
+
tasksClearFailed: "Impossibile eliminare le attività completate. Riprova.",
|
|
104
|
+
tasksLoading: "Caricamento attività…", tasksLoadFailed: "Impossibile caricare le attività. Riprova.", tasksEmpty: "Nessuna attività. Aggiungi la prima.",
|
|
105
|
+
tasksEmptyFiltered: "Nessuna attività con questo stato.", tasksCreate: "Aggiungi attività", tasksTitleLabel: "Titolo",
|
|
106
|
+
tasksTitlePlaceholder: "Cosa c’è da fare?", tasksDescriptionLabel: "Descrizione", tasksDescriptionPlaceholder: "Aggiungi dettagli, link o criteri di completamento",
|
|
107
|
+
tasksAssigneeLabel: "Assegnatario", tasksUnassigned: "Non assegnata", tasksFilterLabel: "Mostra", tasksFilterAll: "Tutti gli stati",
|
|
108
|
+
tasksDueDateLabel: "Scadenza", tasksDueOn: ({ date }) => `Scade ${date}`, tasksOverdue: "In ritardo",
|
|
109
|
+
tasksParticipantsLabel: "Partecipanti", tasksParticipantsMeta: ({ names }) => `Partecipanti: ${names}`,
|
|
110
|
+
tasksConclusionLabel: "Conclusione", tasksConclusionPlaceholder: "Qual è stato il risultato?",
|
|
111
|
+
tasksStepsLabel: "Passaggi", tasksAddStep: "Aggiungi passaggio", tasksRemoveStep: "Rimuovi passaggio", tasksStepPlaceholder: "Descrivi un passaggio",
|
|
112
|
+
tasksStepDoneLabel: "Passaggio completato", tasksStepsHint: "Fino a 30 passaggi. Spunta quelli completati.",
|
|
113
|
+
tasksStepsProgress: ({ done, total }) => `${done} di ${total} passaggi completati`,
|
|
114
|
+
tasksStatusTodo: "Da fare", tasksStatusDoing: "In corso", tasksStatusDone: "Completata",
|
|
115
|
+
tasksSummary: ({ count }) => `${count} attività`, tasksCreator: ({ name }) => `Creata da ${name}`, tasksUpdated: ({ time }) => `Aggiornata ${time}`,
|
|
116
|
+
tasksEditLabel: ({ title }) => `Modifica ${title}`, tasksDeleteLabel: ({ title }) => `Elimina ${title}`, tasksStatusFor: ({ title }) => `Stato di ${title}`,
|
|
117
|
+
tasksInvalid: "Inserisci un titolo da 1 a 200 caratteri.", tasksCreateFailed: "Impossibile aggiungere l’attività. Riprova.", tasksUpdateFailed: "Impossibile aggiornare l’attività. Riprova.",
|
|
118
|
+
tasksDeleteFailed: "Impossibile eliminare l’attività. Riprova.", tasksDeleteConfirm: ({ title }) => `Eliminare «${title}»? L’operazione non può essere annullata.`,
|
|
101
119
|
earlierMessages: "Messaggi precedenti omessi", messagesBetweenOmitted: "I messaggi tra questo punto di lettura e i più recenti sono omessi.", you: "Tu", saved: "Salvato",
|
|
102
120
|
savedMemory: "Salvato solo per questa scheda", copyFailed: ({ id }) => `Copia non riuscita. Copia manualmente: ${id}`,
|
|
103
121
|
copyMessage: "Copia", copiedMessage: "Copiato", copyMessageFailed: "Impossibile copiare. Seleziona e copia il messaggio manualmente.", wrapCode: "Adatta il codice",
|
|
@@ -98,6 +98,24 @@ export const ja = {
|
|
|
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: "コードを折り返す",
|
|
@@ -98,6 +98,24 @@ export const ko = {
|
|
|
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,32 @@ 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
|
+
|
|
11
35
|
export function isMarkdownResource(resource) {
|
|
12
36
|
const mime = String(resource?.mimeType || "").split(";")[0].trim().toLowerCase();
|
|
13
37
|
return mime === "text/markdown" || mime === "text/x-markdown" || /\.(?:md|markdown)$/i.test(String(resource?.name || ""));
|
|
@@ -22,6 +46,7 @@ export function renderMarkdown(root, text, app) {
|
|
|
22
46
|
return token;
|
|
23
47
|
});
|
|
24
48
|
const renderer = new window.marked.Renderer(), renderCode = renderer.code.bind(renderer);
|
|
49
|
+
renderer.html = ({ text }) => preserveRawHtml(text);
|
|
25
50
|
renderer.code = (token) => {
|
|
26
51
|
if ((token.lang || "").trim().toLowerCase().split(/\s+/)[0] !== "mermaid") return renderCode(token);
|
|
27
52
|
const key = `CHATDIAGRAM${nonce}${diagrams.size}END`;
|
|
@@ -436,7 +461,8 @@ function replaceMentionTokens(fragment, mentions, app) {
|
|
|
436
461
|
const chip = document.createElement("span");
|
|
437
462
|
chip.className = "mention-chip";
|
|
438
463
|
if (app.mentionNames().has(mention.name)) chip.classList.add("member");
|
|
439
|
-
chip.
|
|
464
|
+
chip.dataset.mention = mention.name;
|
|
465
|
+
chip.textContent = `@${mention.name === "all" ? app.t("allMembers") : mention.name}`;
|
|
440
466
|
replacement.appendChild(chip);
|
|
441
467
|
}
|
|
442
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?.() },
|
|
@@ -381,8 +383,11 @@ export function initPalette(app) {
|
|
|
381
383
|
|
|
382
384
|
document.addEventListener("keydown", (event) => {
|
|
383
385
|
if (event.defaultPrevented || event.isComposing) return;
|
|
384
|
-
|
|
385
|
-
|
|
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;
|
|
386
391
|
event.preventDefault();
|
|
387
392
|
event.stopPropagation();
|
|
388
393
|
openPalette();
|
|
@@ -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
|
};
|