WebLLM Integration Guide
Works with any ProseMirror editor via minimal configuration.
Ghost text, invisible triggers, and customizable workflows powered by prosemirror-completion.
pnpm add prosemirror-completionimport { EditorState } from "prosemirror-state";
import { EditorView } from "prosemirror-view";
import { keymap } from "prosemirror-keymap";
import { schema } from "prosemirror-schema-basic";
import { exampleSetup } from "prosemirror-example-setup";
import {
completion,
approveCompletion,
exitCompletion,
} from "prosemirror-completion";
const completionPlugin = completion({
debounceMs: 300,
callCompletion: async (context) => {
// Customize your completion logic
return "suggested text";
},
});
const completionKeymap = keymap({
Tab: approveCompletion,
Escape: exitCompletion,
});
const state = EditorState.create({
schema,
plugins: [completionPlugin, completionKeymap, ...exampleSetup({ schema })],
});
new EditorView(document.querySelector("#editor")!, { state });Continue with the Guide to configure the plugin and connect to WebLLM.
Experience the basic integration (ProseMirror + completion plugin + WebLLM) directly below.