Expand description
A Notion-style block editor for gpui, over the markdown document model.
ⓘ
editor::init(cx); // once, at startup
let editor = cx.new(|cx| editor::Editor::new("# Title", cx));markdown holds the document, its markdown wire form, and the painting —
all of it testable without a window. What lives here is the half that needs
one: focus, keys, the platform input handler, the mouse, undo, and the menus.
Structs§
Enums§
- Edit
Kind - What an edit did, so a run of the same kind can coalesce into one step instead of giving the document back a character at a time.
- Source
- A picture with no address of its own, and what the app is asked about.
Constants§
- DEFAULT_
UNDO_ LIMIT - How many steps a document keeps.
Functions§
- init
- Install the editor’s key bindings. Scoped to the editor’s own key context,
so binding
tabhere does not maketabmean “indent” for the whole app. - set_
image_ store editor::set_image_store(cx, my_store)— call once at boot. Without it a screenshot cannot be pasted at all: there is nowhere to put the bytes, and a document holds a URL.
Type Aliases§
- Image
Store - The URL to write down for
source, andNonefor one the app will not keep — a dropped file then stays where it already is, and a screenshot is let go.