Add Tiptap inline-preview editor, layout improvements, and README
Replace plain textarea with Tiptap (ProseMirror) WYSIWYG editor for notes and tasks. Headings, bold, lists, and code blocks now render inline while editing. Tags and wikilinks get visual highlighting via decoration plugins, and autocomplete uses @tiptap/suggestion with heading disambiguation. Layout: pin navbar with app-shell flex column (100dvh), sticky editor toolbar above scrolling content, AI Assist panel fixed at bottom 1/3 with full-height section selector and prompt. Increase max-width to 960px across all views. Hide assist controls during streaming/review. Other fixes: markdown paste handling, auto-syncing assist sections via body watcher, trailing newline on AI accept, ChatView height fix. Add README.md describing the app, usage guide, and technical overview. Update summary.md with Phase 5.2 roadmap and current status. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
export interface MarkdownSection {
|
||||
heading: string;
|
||||
level: number;
|
||||
content: string;
|
||||
startOffset: number;
|
||||
endOffset: number;
|
||||
}
|
||||
|
||||
const HEADING_RE = /^(#{1,6})\s+(.*)$/gm;
|
||||
|
||||
export function parseMarkdownSections(body: string): MarkdownSection[] {
|
||||
const sections: MarkdownSection[] = [];
|
||||
const matches: { index: number; level: number; heading: string }[] = [];
|
||||
|
||||
let match: RegExpExecArray | null;
|
||||
while ((match = HEADING_RE.exec(body)) !== null) {
|
||||
matches.push({
|
||||
index: match.index,
|
||||
level: match[1].length,
|
||||
heading: match[0],
|
||||
});
|
||||
}
|
||||
|
||||
// Preamble: text before the first heading
|
||||
if (matches.length === 0) {
|
||||
// Entire body is a single preamble section
|
||||
if (body.length > 0) {
|
||||
sections.push({
|
||||
heading: "",
|
||||
level: 0,
|
||||
content: body,
|
||||
startOffset: 0,
|
||||
endOffset: body.length,
|
||||
});
|
||||
}
|
||||
return sections;
|
||||
}
|
||||
|
||||
if (matches[0].index > 0) {
|
||||
sections.push({
|
||||
heading: "",
|
||||
level: 0,
|
||||
content: body.slice(0, matches[0].index),
|
||||
startOffset: 0,
|
||||
endOffset: matches[0].index,
|
||||
});
|
||||
}
|
||||
|
||||
for (let i = 0; i < matches.length; i++) {
|
||||
const start = matches[i].index;
|
||||
const end = i + 1 < matches.length ? matches[i + 1].index : body.length;
|
||||
sections.push({
|
||||
heading: matches[i].heading,
|
||||
level: matches[i].level,
|
||||
content: body.slice(start, end),
|
||||
startOffset: start,
|
||||
endOffset: end,
|
||||
});
|
||||
}
|
||||
|
||||
return sections;
|
||||
}
|
||||
Reference in New Issue
Block a user