Editor plugins¶
TipTap and ProseMirror¶
yellowmist-tiptap adds on-device writing help to any TipTap or ProseMirror editor:
- Ghost text: the next word or phrase appears in grey at the cursor. Tab accepts, Escape dismisses.
- Autocorrect underlines (beta): words YellowMIST would change get a wavy underline, with the suggestion on
hover.
applyCorrectionsaccepts them all. - Restore punctuation: puts back punctuation and capitals in the selection or the current paragraph.
npm install yellowmist-tiptap
import { Editor } from "@tiptap/core";
import StarterKit from "@tiptap/starter-kit";
import { YellowMist } from "yellowmist-tiptap";
import "yellowmist-tiptap/style.css";
const editor = new Editor({
element: document.querySelector("#editor"),
extensions: [StarterKit, YellowMist.configure({ lang: "yor_Latn" })],
});
editor.commands.applyCorrections();
editor.commands.restorePunctuation();
Plain ProseMirror (no TipTap needed):
import { yellowMistPlugins, applyCorrections, restorePunctuation } from "yellowmist-tiptap/prosemirror";
const opts = { lang: "swh_Latn" };
const state = EditorState.create({ schema, plugins: [...yellowMistPlugins(opts)] });
| Option | Default | What it does |
|---|---|---|
lang |
"eng_Latn" |
the document's language label, or a function returning it |
ghostText |
true |
next-word suggestions at the cursor |
autocorrect |
true |
underline words autocorrect would change (beta) |
eagerness |
0.5 |
how often suggestions and underlines appear, 0–1: higher shows more; a number or a function |
suggestDelay / correctDelay |
300 / 800 |
ms after typing stops before each check |
client |
the yellowmist package |
where the models run; pass an object with suggest, mend and punct that forwards to a Web Worker |
onError |
console.warn |
model errors |
More editors¶
Plugins for Lexical, Quill, CKEditor, TinyMCE, a browser extension, VS Code, Obsidian, WordPress and Office are planned. They all build on the same JavaScript package.