diff --git a/src/core/shape/RichTextShape.ts b/src/core/shape/RichTextShape.ts index f8b9b7d4..562f798b 100644 --- a/src/core/shape/RichTextShape.ts +++ b/src/core/shape/RichTextShape.ts @@ -377,20 +377,19 @@ export class RichTextShape } async applyLinks(doc: TextDoc, loader: LinkResolver): Promise { if (!Array.isArray(doc)) return - doc = doc.map(this.normalizeRow) const links = new Map() iterMarks(doc, mark => { if (mark[Mark.type] !== 'link') return - const id = mark[LinkMark.id] - if (id) links.set(mark, id) + const entryId = mark[LinkMark.entry] + if (entryId) links.set(mark, entryId) }) async function loadLinks() { const linkIds = Array.from(new Set(links.values())) const entries = await loader.resolveLinks(linkInfoFields, linkIds) const info = new Map(linkIds.map((id, i) => [id, entries[i]])) - for (const [mark, id] of links) { + for (const [mark, entryId] of links) { const type = mark![LinkMark.link] as 'entry' | 'file' | undefined - const data = info.get(id) + const data = info.get(entryId) if (data) mark!['href'] = type === 'file' ? data.location : data.url } } diff --git a/src/field/richtext/RichTextField.browser.tsx b/src/field/richtext/RichTextField.browser.tsx index 6248af38..71fb17b7 100644 --- a/src/field/richtext/RichTextField.browser.tsx +++ b/src/field/richtext/RichTextField.browser.tsx @@ -207,7 +207,6 @@ export function RichTextInput({ }), [fragment] ) - console.log(content) const onFocus = useCallback( ({event}: {event: Event}) => focusToggle(event.currentTarget), [focusToggle] diff --git a/src/ui/RichText.tsx b/src/ui/RichText.tsx index 0e596703..1e4a23af 100644 --- a/src/ui/RichText.tsx +++ b/src/ui/RichText.tsx @@ -59,7 +59,12 @@ function nodeElement( case 'small': return case 'link': - return + const props = { + href: attributes?.href, + target: attributes?.target, + title: attributes?.title + } + return } }