This commit is contained in:
Mateusz Gruszczyński committed 2026-10-18 14:45:59 +02:00
1 parent 5cb6960b04
commit 0d7ffea17a
13 files changed
+17 -135

No files matched your search

-8
View File
@@ -11,10 +11,6 @@ import { t } from "@rustpad/i18n";
import { normalizeMentionUsers } from "@rustpad/mention-autocomplete";
function escapeRegex(value) { return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); }
// Find real @mentions in the source, not arbitrary text that resembles an email
// address or an @username inside a code fence, inline code, link or URL.
// Offsets use UTF-16 code units, just like textarea.setSelectionRange().
export function collectMentionOccurrences(source, authorizedUsers, { markdown = true } = {}) {
const members = normalizeMentionUsers(authorizedUsers);
if (!members.length) return [];
@@ -39,7 +35,6 @@ export function collectMentionOccurrences(source, authorizedUsers, { markdown =
const excluded = [];
if (markdown) {
// The Markdown renderer stashes these constructs before highlighting mentions.
const hidden = [
/`[^`]+`/g,
/!?\[[^\]]*\]\([^\s)]+(?:\s+["'][^"']*["'])?\)/g,
@@ -90,8 +85,6 @@ export function createMentionNavigator({ container, list, previewContainer, prev
if (!entries.has(mention.key)) entries.set(mention.key, []);
entries.get(mention.key).push(mention);
}
// Keep a reference to each visible mention, so the jump can target the
// exact chip even if several mentions are on the same source line.
if (markdown) {
const visible = new Map();
for (const node of preview.querySelectorAll(".markdown-mention")) {
@@ -174,7 +167,6 @@ export function createMentionNavigator({ container, list, previewContainer, prev
}
if (view !== "edit") {
navigatePreview(mention);
// Split view scroll synchronization may run after the textarea scroll event.
if (view === "split") requestAnimationFrame(() => {
if (lastJump.get(key) === mention.start) navigatePreview(mention);
});