Processed some UI issues on journal

This commit is contained in:
StormRunner06106
2026-09-12 22:10:44 -07:00
parent 737b56e97e
commit 206bbbc5ed
27 changed files with 1245 additions and 327 deletions
+13
View File
@@ -0,0 +1,13 @@
// Starter articles use section arrays; the editor uses Tiptap documents.
export function editableDocument(content) {
if (!Array.isArray(content)) return content;
return { type: "doc", content: content.flatMap((section) => [
...(section.heading ? [{ type: "heading", attrs: { level: 2 }, content: [{ type: "text", text: section.heading }] }] : []),
...section.paragraphs.map((text) => ({ type: "paragraph", ...(text ? { content: [{ type: "text", text }] } : {}) })),
]) };
}
export function articlePlainText(node) {
if (!node) return "";
return [node.text ?? "", ...(node.content ?? []).map(articlePlainText)].filter(Boolean).join(" ").trim();
}