Features
Track changes
Let writers suggest edits instead of changing the text, then accept or reject each suggestion, with the suggestions kept when saving and in Word files.
In suggestion mode, typing does not change the text. New text is shown as an insertion and deleted text stays visible, crossed out, until someone accepts or rejects it. Each suggestion keeps its author and time.
Track changes is part of the one-script build. With npm you add the extension and the review panel yourself.
Using suggestion mode
- Press Suggest changes on the toolbar to turn suggestion mode on or off. The button shows when it is on.
- Type, delete or press Enter as usual. Insertions are underlined in the author’s colour and deletions are crossed out. A new or removed paragraph break shows a ¶ mark.
- Deleting text you suggested yourself removes it for real, so you can fix your own typos.
- Formatting, lists, tables, images and Markdown shortcuts are turned off while suggesting. Trying one shows a short message instead.
- The Suggestions tab of the review panel lists every suggestion with its author and time. Accept or reject one, or all of them at once. Each one is a single undo step.
- Placing the cursor in a suggestion highlights its card in the panel.
One-script build
Add data-suggest to the textarea, together with the person who is writing:
<textarea name="body" data-editor data-suggest
data-user-id="42" data-user-name="Ayşe Yılmaz">…</textarea>
data-suggest(ordata-suggest="on") starts the editor in suggestion mode. The writer can still turn it off.data-suggest="locked"keeps suggestion mode on and hides accept and reject. Use it for people who may only suggest. Any value other thanonandoff(including a typo) also locks, so a mistake never gives a reviewer accept and reject.- Without both user attributes nobody can suggest. A locked editor without a user does not accept text changes at all.
- Suggestions in the saved HTML are always loaded and shown, with or without
data-suggest.
With npm
- Install the packages:
npm install @viveeditor/ext-track-changes @viveeditor/ui @viveeditor/core. - Add
TrackChangesto the extensions and import its stylesheet. - Add
commentsPanel()to thepluginsofcreateUI. It shows the suggestions tab when the extension is present.
import { Editor } from '@viveeditor/core'
import { basicExtensions } from '@viveeditor/ext-basic'
import { TrackChanges } from '@viveeditor/ext-track-changes'
import { createUI } from '@viveeditor/ui'
import { commentsPanel } from '@viveeditor/ui/review'
import '@viveeditor/ext-track-changes/style.css'
const user = { id: '42', name: 'Ayşe Yılmaz' }
const editor = await Editor.create(document.querySelector('#editor'), {
extensions: [...basicExtensions, TrackChanges.configure({ user, suggesting: true })],
content: savedHtml,
})
createUI(editor, { plugins: [commentsPanel({ user })] })
- Options:
user,suggesting(start in suggestion mode),locked(suggestion mode stays on, accept and reject are refused) andtypes(blocks that can hold a paragraph-break suggestion, by default paragraphs and headings). - Commands:
setSuggesting(on),toggleSuggesting(),setChangeAuthor(user),acceptChange(id),rejectChange(id),acceptAllChanges(),rejectAllChanges(),commitSuggestions()(marks text still being typed with an input method at once; the drop-in calls it before the form is sent). - Queries:
isSuggesting(),changes()(every suggestion with its kind, author, time and text),changesAt()(the ones under the cursor),suggestionRefusals().
What is stored
Suggestions are part of the HTML:
<p>The launch is <del data-vive-change="k3Jd…" data-author="42" data-name="Ayşe Yılmaz"
data-time="2026-11-26T09:00:00.000Z">Monday</del><ins data-vive-change="k3Jd…"
data-author="42" data-name="Ayşe Yılmaz" data-time="2026-11-26T09:00:00.000Z">Tuesday</ins>.</p>
<p data-vive-break="insert" data-vive-change="p8Qa…" data-author="42"
data-name="Ayşe Yılmaz" data-time="2026-11-26T09:01:00.000Z">A new paragraph.</p>
data-authoris the user id anddata-namethe name shown in the panel. Ids are 1 to 64 letters, digits,-or_; author ids up to 128 characters and names up to 100. Suggestions that break these rules are dropped when the HTML is loaded.data-vive-breakon a paragraph means the break before it was suggested (insert) or suggested for removal (delete).- A plain
<del>withoutdata-vive-changeis ordinary strikethrough. - Copying text with suggestions and pasting it elsewhere pastes the text without the suggestions. Saving as Markdown writes only the approved text.
On the server
- The server sanitizer shows only approved text by default (
suggestions: 'reject'). Use'keep'when you clean HTML that will be edited again, and'accept'to preview the text as if every suggestion were accepted. - In Laravel, the
ViveHtmlcast keeps suggestions and@viveHtmlshows approved text. The editor component takes asuggestprop. See Laravel.
Who may accept suggestions
The locked mode hides accept and reject in the browser only. Anyone who can save the document can send any HTML, with suggestions accepted, removed or written under other names. Decide on your server who may save a document, and keep a version history if authorship matters.
- Use an id that means nothing outside your app for
data-author, never an e-mail address: everyone who can open the document sees it.
Word files
With the File menu:
- Save as Word writes suggestions as Word tracked changes, with their authors and times.
- Open a Word file with tracked changes and they arrive as suggestions when the editor has track changes; otherwise they are accepted. Authors from Word are marked so they are not mistaken for people on your site.
With npm, importDocx(file, { trackedChanges: 'keep' }) keeps them and the default 'accept' accepts them.
Related pages
Frequently asked questions
Do readers see pending suggestions on the published page?
No. The server sanitizer shows only approved text by default, so suggested insertions are left out and suggested deletions stay as plain text until someone accepts them.
Can I suggest formatting changes, such as bold or a list?
Not in this version. Suggestion mode tracks typed text, deleted text and paragraph breaks. Formatting and structure changes are turned off while it is on, and the editor says so.
Can a reviewer accept their own suggestions?
Anyone who is not locked can accept or reject any suggestion. Use the locked mode for people who may only suggest, and check on your server who may save the document.