Skip to content

Configuration reference

Pass a partial EditorInit object through the init prop. Missing properties use package defaults, arrays replace default arrays, and the supplied object is never mutated. Reactive ref, reactive, or computed values are supported.

vue
<script setup lang="ts">
import { computed, shallowRef } from 'vue';
import { Editor, type EditorInit } from '@erag/text-editor-vue';

const compact = shallowRef(false);
const content = shallowRef('');
const init = computed<EditorInit>(() => ({
    height: compact.value ? 280 : 420,
    menubar: !compact.value,
    toolbar: compact.value ? 'bold italic | link' : true,
}));
</script>

<template>
    <Editor v-model="content" :init="init" />
</template>

Layout and behavior

OptionTypeDefaultDescription
heightnumber | string420Initial editor height. Numbers are pixels.
minHeightnumber | string240Minimum resize height.
maxHeightnumber | stringOptional maximum resize height.
widthnumber | stringOptional editor width.
placeholderstring'Write something...'Empty-editor hint.
menubarboolean | EditorMenuName[]trueAll menus, no menu, or an exact ordered menu list.
toolbarboolean | string | EditorToolbarGroup[]trueDefault toolbar, no toolbar, compact string, or typed groups.
statusbarbooleantrueShows element path, counts, help text, and resize handle.
brandingbooleanfalseReserved presentation flag.
promotionbooleanfalseReserved presentation flag.
resizebooleantrueEnables vertical resizing from the status bar.
readonlybooleanfalseConfiguration-level readonly mode. The prop can also enable it.
autofocusbooleanfalseFocuses the editable root after client mount when editing is allowed.
spellcheckbooleantruePasses native spellcheck behavior to the editable area.
direction'ltr' | 'rtl''ltr'Text direction.
contentStylestring''Inline CSS declarations applied to the editable root.
contentClassstring''Additional class names applied to the editable root.
helpShortcutTextstring'Press Alt+0 for help'Status-bar help text.

Formatting choices

OptionTypeDefaultDescription
fontFamilyFormatsFontFamilyOption[]13 common families{ label, value } options for the font selector.
fontSizeFormatsFontSizeOption[]8pt through 36pt{ label, value } options for font size.
lineHeightFormatsLineHeightOption[]1 through 2{ label, value } options for line height.
blockFormatsBlockFormatOption[]paragraph, headings 1–6, pre, blockquoteAvailable block selector entries.
textColorsstring[]package color paletteText-color choices.
backgroundColorsstring[]package color paletteHighlight-color choices.
dateFormatsDateTimeFormatOption[]ISO, numeric, longDate options generated at insertion time.
timeFormatsDateTimeFormatOption[]24-hour, 12-hourTime options generated at insertion time.
ts
const init: EditorInit = {
    fontFamilyFormats: [
        { label: 'Arial', value: 'Arial' },
        { label: 'Georgia', value: 'Georgia' },
    ],
    lineHeightFormats: [
        { label: 'Compact', value: '1.2' },
        { label: 'Comfortable', value: '1.6' },
    ],
    dateFormats: [
        {
            label: 'Long date',
            type: 'date',
            options: { year: 'numeric', month: 'long', day: 'numeric' },
        },
    ],
};

Plugins

plugins defaults to every supported plugin. An explicit array filters controls that are marked as plugin-backed, including links, images, media, tables, source code, preview, fullscreen, find and replace, special characters, emoji, anchors, date-time, merge tags, and templates.

ts
const init: EditorInit = {
    plugins: ['history', 'formatting', 'lists', 'link'],
    menubar: ['edit', 'format'],
    toolbar: 'undo redo | bold italic | bullist numlist | link',
};

Feature names are listed in EditorPluginName. A plugin-backed toolbar item still needs its plugin in the array; adding its toolbar keyword alone does not bypass filtering. Core history, formatting, and list controls are selected directly through toolbar and menubar in the current release, while their plugin names remain valid configuration values.

Images and uploads

OptionTypeDefaultDescription
acceptedFormatsstring[]JPEG, PNG, WebP, GIFAllowed image MIME types.
maxImageSizenumber5 * 1024 * 1024Maximum bytes per image.
uploadFieldNamestring'file'Multipart field used by the URL uploader.
uploadHeadersRecord<string, string>{}Headers used by the URL uploader. Do not set multipart Content-Type manually.
uploadCredentialsRequestCredentials'same-origin'Fetch credential mode.
imagesUploadUrlstringEndpoint for the built-in Fetch uploader.
imagesUploadHandlerImagesUploadHandlerConsumer-controlled custom uploader.
imagesDeleteHandlerImagesDeleteHandlerOptional server cleanup callback before editor removal.
resolveUploadedImageUrl(response: unknown) => string | Promise<string>built-in common URL lookupResolves the URL uploader response. Use it for your response shape.
automaticUploadsbooleantrueAutomatically uploads selected or pasted files.
pasteImagesbooleantrueAccepts image files from the clipboard.
imageFilePickerbooleantrueShows file selection in the inline image card.
imageUrlInputbooleantrueShows URL insertion in the inline image card.
imageResizebooleantrueEnables four-corner image resizing.
imageDefaultWidthnumber640Maximum initial inserted width in pixels.

See image uploads and resizing for complete handlers.

Content and security

OptionTypeDefaultDescription
sanitizebooleantrueApplies the internal browser allowlist sanitizer.
allowedTagsstring[]package allowlistHTML elements preserved by the sanitizer.
allowedAttributesRecord<string, string[]>package allowlistAttributes preserved per tag; '*' applies to all allowed tags.
relativeUrlsbooleantrueAllows safe relative link and media URLs.
removeScriptHostbooleanfalseReserved compatibility option; current insertion does not rewrite hosts with it.
convertUrlsbooleantrueReserved compatibility option; current insertion preserves accepted URL values.

Client-side sanitization is not a server security boundary. See security and sanitization.

Tables and optional features

OptionTypeDefaultDescription
tableGridSizenumber10Maximum rows and columns shown by the table grid picker.
mentionsboolean | MentionConfigfalseEnables the fixed @ autocomplete.
mergeTagsboolean | MergeTagConfigfalseEnables the fixed {{ autocomplete and dynamic menu.
templatesboolean | EditorTemplatesConfigfalseEnables the configured template picker.

Each optional feature is documented on its own page with item and event examples.

Normalized aliases

Camel case is the primary API. These compatibility aliases are normalized once before merging:

AliasPreferred option
content_stylecontentStyle
font_family_formatsfontFamilyFormats
font_size_formatsfontSizeFormats
line_height_formatslineHeightFormats
images_upload_urlimagesUploadUrl
images_upload_handlerimagesUploadHandler
images_delete_handlerimagesDeleteHandler
automatic_uploadsautomaticUploads
relative_urlsrelativeUrls
remove_script_hostremoveScriptHost
convert_urlsconvertUrls

If both forms are supplied, the camel-case value wins.

Released under the MIT License. Copyright © Er Amit Gupta