Editor options
Options are the second argument of VEditor.create() (and of the VEditor constructor). The first argument is a <textarea> element or a selector. VEditor.create() loads the interface language first, see Translations.
import { VEditor } from '/veditor/js/index.js';
const editor = await VEditor.create('#content', {
language: 'en',
height: '400px',
placeholder: 'Write your article…',
licenseKey: 'VED1.…', // your key; leave it out on local and test addresses
});
General
| Option | Default | Description | |
|---|---|---|---|
toolbar | DEFAULT_TOOLBAR | list of toolbar items, `' | '` is a separator; the toolbar wraps onto more rows (see Toolbar) |
plugins | DEFAULT_PLUGINS | list of plugins | |
language | the document lang or en | interface language, one of 36 (see Translations) | |
height | '300px' | minimum height of the editing area (the editor grows with the content) | |
maxHeight | none | maximum height of the editing area, then it scrolls | |
placeholder | '' | text shown in an empty editor | |
label | “Rich text editor” | accessible label of the editing area | |
readOnly | false | read-only mode (editor.setReadOnly() changes it at runtime) | |
direction | none | 'ltr' or 'rtl' for the whole editor | |
licenseKey | '' | licence key; not needed on local and test addresses | |
inline | false | editing without a frame; the toolbar appears above the content only while the editor has focus | |
balloonToolbar | none | list of toolbar items shown above selected text, with or without inline |
Content
| Option | Default | Description |
|---|---|---|
heading.options | paragraph, H1–H6 | [{ tag, label }] |
styles | [] | [{ name, element, classes }]: the “Style” list, see HTML sanitizer |
font | predefined | { colors, backgrounds, sizes }: classes color-*, background-*, size-* |
codeBlock.languages | common languages | [{ value, label }] |
templates | [] | [{ title, description, html }] |
specialCharacters | default groups | [{ group, chars: [...] }] |
emoji | default groups | [{ group, chars: [...] }] |
dateTime.formats | 4 formats | Intl.DateTimeFormat options for “Insert date and time” |
headingIds | false | every heading in the output gets an id (an anchor from its text) |
typography | true | replacements while typing: ... → …, -- → – , (c) → ©, quotes by language |
link.externalNewTab | false | a new link to another domain opens in a new tab by default |
image.lazyLoading | true | loading="lazy" on inserted images |
Files, uploads and AI
| Option | Default | Description |
|---|---|---|
filePicker | none | function (callback, meta): your file manager, see File manager and uploads |
upload | none | function (file) → Promise<{ url, alt?, srcset?, sizes? }> for dropped and pasted images |
ai | none | { url, csrfToken, headers, autocomplete, autocompleteDelay, languages, language }, see AI |
Working comfort
| Option | Default | Description |
|---|---|---|
autosave | off | true or { key, delay }: a draft in localStorage with restore or discard |
wordCount.onUpdate | none | function (stats) after every change |
Toolbar
The toolbar option is the list of toolbar items in the order they appear; '|' is a separator. Without it the editor shows the full default toolbar. Each editor on a page can have its own toolbar, for example a short one for comments and a full one for articles.
Basic: comments
await VEditor.create('#comment', {
toolbar: ['bold', 'italic', 'link', '|', 'bulletedList', 'numberedList', '|', 'undo', 'redo'],
height: '150px',
});
Standard: articles
await VEditor.create('#content', {
toolbar: [
'heading', 'style', '|',
'bold', 'italic', 'underline', 'removeFormat', '|',
'link', '|',
'bulletedList', 'numberedList', 'outdent', 'indent', '|',
'alignLeft', 'alignCenter', 'alignRight', '|',
'blockQuote', 'image', 'mediaEmbed', 'insertTable', '|',
'undo', 'redo', '|',
'sourceEditing', 'fullscreen',
],
});
Full: the default
Without the toolbar option the editor shows every item (DEFAULT_TOOLBAR):
[
'heading', 'style', '|',
'aiAssistant', 'aiChat',
'bold', 'italic', 'underline', 'strikethrough', 'subscript', 'superscript', 'code', 'removeFormat', '|',
'fontColor', 'fontBackgroundColor', 'fontSize', '|',
'link', 'anchor', '|',
'bulletedList', 'numberedList', 'taskList', 'listStyle', 'listStart', 'outdent', 'indent', '|',
'alignLeft', 'alignCenter', 'alignRight', 'alignJustify', 'textDirection', '|',
'blockQuote', 'codeBlock', 'accordion', 'horizontalLine', 'pageBreak', '|',
'image', 'mediaEmbed', 'insertTable', 'insertToc', 'insertTemplate', 'specialCharacters', 'emoji', 'insertDateTime', '|',
'findAndReplace', 'review', 'pasteAsText', '|',
'undo', 'redo', '|',
'sourceEditing', 'showBlocks', 'preview', 'print', 'fullscreen', 'help',
]
The AI buttons appear only when ai.url is set and the licence covers the AI edition. To start from the default list and remove a few items, import DEFAULT_TOOLBAR:
import { VEditor, DEFAULT_TOOLBAR } from '/veditor/js/index.js';
await VEditor.create('#content', {
toolbar: DEFAULT_TOOLBAR.filter((name) => !['emoji', 'pageBreak', 'print'].includes(name)),
});
The balloonToolbar option (a toolbar above selected text) takes the same names.
Toolbar items
| Item | Button |
|---|---|
heading | paragraph or heading H1–H6 (the list from heading.options) |
style | the “Style” list from the styles option |
aiAssistant | AI assistant: quick actions and your own prompt (AI edition) |
aiChat | AI chat in a side panel (AI edition) |
bold, italic, underline, strikethrough | bold (Ctrl+B), italic (Ctrl+I), underline (Ctrl+U), strikethrough (Ctrl+Shift+X) |
subscript, superscript | subscript, superscript |
code | inline code |
removeFormat | removes text formatting |
fontColor, fontBackgroundColor, fontSize | text colour, background colour and size from the font option |
link | link: address, new tab, relation (rel) |
anchor | anchor (id) that a link can point to |
bulletedList, numberedList, taskList | bulleted, numbered and task list |
listStyle | list marker style (disc, square, a, i…) |
listStart | list properties: start number, reversed counting |
outdent, indent | decrease and increase indent |
alignLeft, alignCenter, alignRight, alignJustify | text alignment |
textDirection | right-to-left text |
blockQuote, codeBlock | block quote, code block with a language |
accordion | collapsible section (<details>) |
horizontalLine, pageBreak | horizontal line, page break for printing |
image | image: file manager, upload, alt text, alignment, size |
mediaEmbed | YouTube and Vimeo videos, video and audio files |
insertTable | table |
insertToc | table of contents built from the headings |
insertTemplate | templates from the templates option |
specialCharacters, emoji | special characters, emoji |
insertDateTime | date and time in the formats from dateTime.formats |
findAndReplace | find and replace (Ctrl+F) |
review | review panel: accessibility checks, with AI also a text check |
pasteAsText | toggles pasting as plain text |
undo, redo | undo (Ctrl+Z), redo (Ctrl+Y) |
sourceEditing | HTML source |
showBlocks | shows the outlines of blocks |
preview, print | preview, print |
fullscreen | full screen |
help | keyboard shortcuts (Alt+0) |
Outside the default list you can also use unlink (remove link) and indentList / outdentList (list indentation only, also Tab and Shift+Tab).
Styles for a sticky toolbar
The toolbar sticks to the top of the window while you scroll. If your page has a fixed header, move it down with a CSS variable:
.veditor { --ve-sticky-top: 64px; }
Next steps
Something unclear? Send feedback on the documentation.