Skip to main content

Integration and Setup

These options control how Editor42 initializes, which element it targets, which plugins it loads, and how it communicates back to your application.

Options​

OptionTypeDefaultDescription
selectorstring—CSS selector matching the element(s) to replace with an editor instance.
targetHTMLElement—Direct DOM element reference to convert into an editor. Use instead of selector when you already have a reference.
inlinebooleanfalseEnable inline editing mode. The editor appears inside the target element itself rather than in an iframe.
base_urlstring—Base URL for loading Editor42 resource files (skins, themes, plugins).
suffixstring—Suffix appended to script filenames, e.g. '.min' for minified builds.
cache_suffixstring—Query string appended to resource URLs for cache busting, e.g. '?v=1.0'.
setupfunction—Callback invoked before the editor is fully initialized. Receives the editor instance as its argument. Use this to bind events or configure the editor early.
init_instance_callbackfunction—Callback invoked after the editor has fully initialized. Receives the editor instance.
pluginsstring[][]List of plugins to load. Each entry is a plugin alias name — see the available plugins.
external_pluginsobject—Map of plugin names to their script URLs, for loading plugins hosted outside the Editor42 package.
modelstring'dom'Content model the editor uses internally.
referrer_policystring''Referrer policy applied to resource requests made by the editor.
languagestring'en'Language code for the editor UI.
language_urlstring''URL to a custom language pack file.
language_loadbooleantrueWhether the editor should load its language pack automatically.
readonlybooleanfalseStart the editor in read-only mode. Content is displayed but not editable.
editable_rootbooleantrueWhether the root element of the editor body is editable. Set to false to make only specific child elements editable.
auto_focusstring/true—Automatically focus an editor on page load. Pass true to focus the last initialized editor, or an editor id string to focus a specific one.
idstring—Explicit id for the editor instance. If omitted, the id of the target element is used.
api_keystring—API key field. Not used in Editor42.
deprecation_warningsbooleantrueLog deprecation warnings to the browser console when deprecated options are used.

Example​

editor42.init({
selector: 'textarea#content',
plugins: ['lists', 'link', 'image', 'code'],
language: 'de',
setup: (editor) => {
editor.on('init', () => {
console.log('Editor ready');
});
},
init_instance_callback: (editor) => {
console.log('Fully initialized:', editor.id);
}
});