@nextgensoftwares/folio-plugin-suggest
Suggest mode (track changes): typing and deleting as suggestion marks with author and time, accept/reject one or all, a suggestions panel. Guide: Suggest mode.
Entries: . (everything), ./core (no React or DOM), ./schema (the marks only, for servers).
Plugin
| Export | Description |
|---|---|
suggestPlugin(options?) | the FolioPlugin: schema, transaction gate, Suggestions sidebar tab, status bar cell, context menu items, commands |
type SuggestPlugin | the plugin plus setUser(user), setSuggesting(editor, on), isSuggesting(editor), suggestions(editor), accept(editor, id), reject(editor, id), acceptAll(editor, filter?), rejectAll(editor, filter?), subscribe(fn), controller |
type SuggestPluginOptions | user, now, newId, onRefused(reason, editor), passMarks (default ['comment']), canReview(editor), sidebar |
SuggestController | the plugin's live state: user, setUser, lastRefusal(editor), canReview(editor), can(editor, suggestion), subscribe |
setSuggesting(editor, on), isSuggesting(editor) | re-exported from @nextgensoftwares/folio-editor: suggest mode per editor |
Marks
| Export | Description |
|---|---|
suggestSchema(), schema (./schema) | the suggestInsert and suggestDelete marks |
SUGGEST_INSERT, SUGGEST_DELETE | the mark names |
type SuggestionAttrs | { id, author, authorName, time } |
type SuggestionKind | 'insert' | 'delete' |
suggestColor(author) | the author's colour (#rrggbb, stable) |
suggestionLook(marks) | how painters draw a run: { insert, delete, color } or null |
Editing
| Export | Description |
|---|---|
suggestGate(options), type SuggestGateOptions | the ProseMirror plugin with the folioGate that rewrites edits (active, user, now, newId, passMarks, onRefused) |
suggestKey | its plugin key |
rewriteAsSuggestion(state, tr, ctx), type RewriteContext | a user's transaction rebuilt as suggestions, or why it can't be (Unsuggestable) |
type SuggestUser | { id, name? } |
insertMarks(doc, pos) | the formatting inserted text gets at pos (besides its suggestInsert) |
textEditOf(step, doc), type TextEdit, type Unsuggestable | a step as a text edit inside one textblock, or 'format' | 'structure' | 'unmarked' |
markOfStep(step) | the mark type a mark step adds or removes |
REFUSALS | the user-facing reason per Unsuggestable (English; catalog keys) |
newSuggestionId() | a random id |
type HistoryBase | the gate's state while suggesting: undo/redo depths at the switch (undo/redo below them is refused) |
Server
| Export | Description |
|---|---|
isSuggestionStep(step, doc, options?), type SuggestionStepOptions | whether a step is what a suggester's editor sends: author (the pusher's id; required unless anyAuthor), passMarks (anchors, default ['comment']), allowPassMarkRemoval (removing anchors without an author attr; default false) |
suggestionPolicy(options?) | a PushPolicy (({ before, steps, userId }) => reason | null) checking every step of a push; refuses a push without userId |
Review
| Export | Description |
|---|---|
acceptSuggestion(id), rejectSuggestion(id) | commands for one suggestion |
acceptAll(filter?), rejectAll(filter?), type SuggestionFilter | every suggestion, or one author's |
REVIEW_META | meta on review transactions (they pass the gate) |
suggestionsOf(doc), suggestionsAt(doc, pos), type Suggestion | the suggestions in document order ({ id, kind, author, authorName, time, text, from, to }), or those at a position |
UI
| Export | Description |
|---|---|
createPanel(controller), SUGGEST_ICON | the Suggestions sidebar tab component, its icon |
createModeCell(controller) | the status bar cell ("Suggesting", the last refusal) |
SUGGEST_CSS, ensureSuggestStyles() | styles on Folio's UI tokens |