localStorage; your app replaces that with its own storage.
1
Install the package
2
Add a root element
Declare UTF-8, which WebKit needs to load the bundle, and give the editor an element of its own:Inkkit adds the class
inkkit-root to the element and owns everything inside it.3
Mount, load and save
This example imports
@aicayzer/inkkit, which renders Mermaid diagrams. To leave Mermaid out of your page, import @aicayzer/inkkit/core instead; see Compatibility.What the example handles
What the example handles
changedonly prompts a save. At the moment you write, callsnapshot(generation)and write itstext.- A snapshot that throws saved nothing. Keep the document open and don’t treat it as unchanged.
compositionandoperation-pendingclear when text input or an image import finishes; for the other codes, see Save the document. generationnames this load. Pass it to every call that takes one, and give each later load a greater one. See Documents and saving.- Inkkit binds no formatting keys. Supply them in
keymap, by the same names as theformatcommands.Modis Command on Apple platforms and Control elsewhere. Undo, redo and moving blocks have default keys. To change bindings later, callsetKeymap, which replaces the whole map. See Bind shortcuts. errorreceives failures that no call is waiting for, such as an edit the person makes that Inkkit refuses because it would not save as shown.closesaves first, then awaitsdestroy()before it removes the root. If the save fails, the editor stays open.
Next steps
- Documents and saving: generations, reloads, read-only mode and switching documents.
- Toolbars, shortcuts and search: drive your own controls from
commandState. - Images, files and wiki links: connect Inkkit to your app’s storage.
- Embed in a web view: call Inkkit from a native app.
- Editor reference: every member, its result and its errors.

