lifeos_editor library
Novel for Flutter — a drop-in WYSIWYG editor with AI autocomplete, slash commands, floating toolbar, and markdown serialization.
import 'package:novel_editor/novel_editor.dart';
NovelEditor(
initialContent: '# Hello\nThis is **bold** text.',
onChanged: (markdown) => save(markdown),
ai: NovelAI.openAI(apiKey: 'sk-...'),
)
Classes
- AIProvider
- Abstract AI provider interface. Implement this to use any LLM.
- AISlashCommands
- AI-powered editing for the editor. Single entry point — user types natural language instructions.
- Delta
- Deltas are a simple, yet expressive format that can be used to describe contents and changes. The format is JSON based, and is human readable, yet easily parsible by machines. Deltas can describe any rich text document, includes all text and formatting information, without the ambiguity and complexity of HTML.
- Document
- Document represents an AppFlowy Editor document structure.
- DocumentAnalytics
- Document analytics — word count, character count, reading time.
- EditorState
- The state of the editor.
- LifeOSTableBlockComponentBuilder
-
Custom table block builder that replaces AppFlowy 4.0.0's broken
implementation. Upstream's
TableCelBlockWidgetreads cellheightandwidthattributes directly into BoxConstraints — they are null on any table that came from markdown import, producing NaN and crashing the entire render pipeline. This builder lays out cells using Flutter's intrinsic-sizedTablewidget, ignoring those attributes entirely. - LifeOSTableCellBlockComponentBuilder
-
Cell block builder. Renders a single
table/cellnode as a styled container whose first child (a paragraph) fills the cell's width so taps anywhere inside it land on the paragraph and place the cursor. - Node
- Node represents a node in the document tree.
- NovelAI
- Built-in AI provider factory.
- NovelAnalyticsBar
- A widget that displays live document analytics.
- NovelEditor
- Novel for Flutter — a drop-in WYSIWYG editor.
- NovelEditorState
- NovelEditorTheme
- Pre-built editor themes matching modern editors (Notion, Novel).
- NovelFixedToolbar
- A fixed toolbar at the top of the editor (like Notion/Novel web).
- Selection
- Selection represents the selected area or the cursor area in the editor.
Properties
-
lifeosFormatItems
→ List<
ToolbarItem> -
Inline format items.
no setter
- lifeOSTableSlashItem ↔ SelectionMenuItem
-
Slash menu item that inserts a clean 2-row × 3-column starter table
(1 header row + 1 data row).
getter/setter pair
-
lifeosToolbarItems
→ List<
ToolbarItem> -
Standard toolbar items for the floating selection toolbar.
no setter
Functions
-
lifeosToolbarItemsWithAI(
AIProvider ai) → List< ToolbarItem> - Toolbar items WITH AI actions for the floating toolbar.
-
normaliseMarkdownTables(
String markdown) → String - Normalises pipe-delimited rows for AppFlowy's GFM markdown parser.
Typedefs
- LifeOSEditor = NovelEditor
- LifeOSEditorState = NovelEditorState
- LifeOSEditorTheme = NovelEditorTheme
- NovelLinkTapHandler = bool Function(String href)
-
Callback for handling link taps. Return
trueif the link was handled and default browser-open behaviour should be suppressed. - NovelLinkTapTest = bool Function(String href)
-
Predicate to test whether a link href should be intercepted by
onLinkTap. Must be side-effect-free — it is called during every text span build.