upd md render
This commit is contained in:
parent
1752e3c27c
commit
6e35822708
|
|
@ -1 +1 @@
|
|||
1.1.104
|
||||
1.1.105
|
||||
|
|
@ -35,18 +35,27 @@
|
|||
chip.style.color = color;
|
||||
}
|
||||
|
||||
function markUnknown(chip: HTMLElement, prefix: string) {
|
||||
// Replace the chip (and its preceding arrow span) with plain text
|
||||
const arrow = chip.previousElementSibling;
|
||||
const text = document.createTextNode(`${prefix}${chip.dataset.assignment ?? chip.dataset.person ?? ''}`);
|
||||
chip.parentNode?.insertBefore(text, chip);
|
||||
chip.remove();
|
||||
if (arrow && /→|→/.test(arrow.textContent ?? '')) arrow.remove();
|
||||
}
|
||||
|
||||
const assignmentChips = containerEl.querySelectorAll<HTMLElement>('[data-assignment]');
|
||||
const personChips = containerEl.querySelectorAll<HTMLElement>('[data-person]');
|
||||
await Promise.all([
|
||||
...Array.from(assignmentChips).map(async chip => {
|
||||
const ctx = await findContextByAbbreviation(chip.dataset.assignment!);
|
||||
if (!ctx) return;
|
||||
if (!ctx) { markUnknown(chip, '-> '); return; }
|
||||
const subType = (ctx.meta as Record<string, unknown> | null)?.personSubType as PersonSubType | undefined;
|
||||
applySubtypeColor(chip, subType);
|
||||
}),
|
||||
...Array.from(personChips).map(async chip => {
|
||||
const ctx = await findContextByMentionName(chip.dataset.person!, 'person');
|
||||
if (!ctx) return;
|
||||
if (!ctx) { markUnknown(chip, '@'); return; }
|
||||
const subType = (ctx.meta as Record<string, unknown> | null)?.personSubType as PersonSubType | undefined;
|
||||
applySubtypeColor(chip, subType);
|
||||
}),
|
||||
|
|
|
|||
Loading…
Reference in New Issue