# Editor42: all pages > Editor42 is a free, open-source, MIT-licensed WYSIWYG HTML editor: a security-maintained fork of TinyMCE 6.8.6 with the same API and configuration, for websites, apps and CMSs. The pages https://editor42.com/llms.txt lists, in the same order, each one as its Markdown copy (its URL + `.md`). --- # Editor42 > Editor42 — free, open-source, MIT-licensed WYSIWYG HTML editor. A maintained fork of TinyMCE with security fixes and full API compatibility. Source: https://editor42.com/ **Free, open-source, MIT-licensed WYSIWYG HTML editor — an auditable fork of TinyMCE, the world's most popular rich text editor.** Editor42 is based on the last MIT-licensed release of TinyMCE and provides you the same power of rich text editing on your websites and in apps. - **[Secure](https://editor42.com/docs/security).** All known CVEs and security-related bugs are fixed and maintained. - **Stable.** Well-maintained editor with a dedicated team monitoring bug reports and fixing code. - **[Compatible](https://editor42.com/docs/about-this-fork/technical-specs).** Easily switch from your current TinyMCE installation — same API, same configuration. - **[Auditable](https://editor42.com/docs/about-this-fork/auditing).** Code changes are kept minimal, with a clear history traceable back to the original TinyMCE source. - **Predictable.** We focus strictly on security and bug fixes — no surprise breaking changes. [Install](https://editor42.com/docs/install/self-hosted) [Star on GitHub](https://github.com/editor42com/editor42) We are a new project looking for your support. Star us, share us, and tell others about us. ![Git history graph showing the Editor42 fork from TinyMCE](https://editor42.com/img/git-tree.svg) [Motivation & Goals](https://editor42.com/docs/about-this-fork/motivation) [![Editor42 full-featured WYSIWYG HTML editor showing its menu bar, toolbar and a formatted article](https://editor42.com/img/screenshots/editor42-wysiwyg-html-editor.png)](https://editor42.com/examples/full-featured) ## Getting Started Choose your preferred deployment method: - [**Self-hosted**](https://editor42.com/docs/install/self-hosted) — download and host Editor42 on your own infrastructure - [**CDN**](https://editor42.com/docs/install/cdn) — load Editor42 directly from a content delivery network - [**WordPress**](https://editor42.com/docs/install/wordpress) and [**ClassicPress**](https://editor42.com/docs/install/classicpress) — the Editor42 plugin replaces the outdated TinyMCE 4 they ship, as a block in the block editor or as the whole classic editor - [**NPM**](https://editor42.com/docs/install/npm) — install the package and bundle it with Vite, Webpack or Rollup - [**Composer**](https://editor42.com/docs/install/composer) — require the same build as a package in any PHP project Editor42 integrates with any JavaScript framework — [React](https://editor42.com/docs/install/react), [Vue](https://editor42.com/docs/install/vue), [Angular](https://editor42.com/docs/install/angular), [Svelte](https://editor42.com/docs/install/svelte), [jQuery](https://editor42.com/docs/install/jquery) — and with plain HTML just as well, through the [Web Component](https://editor42.com/docs/install/web-component). Each one has its own component, with the same options and the same MIT licence. [Full documentation](https://editor42.com/docs) CMS modules - [WordPress](https://editor42.com/docs/install/wordpress) - [ClassicPress](https://editor42.com/docs/install/classicpress) Packages & Components - [NPM](https://editor42.com/docs/install/npm) - [Composer](https://editor42.com/docs/install/composer) - [React](https://editor42.com/docs/install/react) - [Vue](https://editor42.com/docs/install/vue) - [Angular](https://editor42.com/docs/install/angular) - [Svelte](https://editor42.com/docs/install/svelte) - [jQuery](https://editor42.com/docs/install/jquery) - [Web Component](https://editor42.com/docs/install/web-component) ## Features - **Rich plugin ecosystem** — dozens of built-in [plugins](https://editor42.com/plugins) for tables, lists, images, media, code editing, search and replace, autosave, and more - **Multiple editing modes** — classic iframe editor, inline editing, and distraction-free writing mode - **Fully customizable UI** — configure toolbars, menus, context menus, and skins; create your own themes - **Custom plugins** — extend the editor using a comprehensive, well-documented [API](https://editor42.com/api) - **Content filtering and validation** — control allowed HTML, clean up pasted content, enforce content rules - **Accessibility** — full keyboard navigation and screen reader support - **Localization** — built-in support for dozens of languages - **Self-hosted or CDN** — deploy on your own terms: no accounts, no API keys, no phone-home ## Migrating from TinyMCE From some point, TinyMCE changed its license from MIT to GPL. Editor42 is built from the latest MIT-licensed state of TinyMCE, so you get a maintained, secure editor under a permissive license without rewriting your integration. You can migrate from any version of TinyMCE — the process is the same regardless of which release you are currently on, and in most cases the switch is seamless. All APIs, configuration options, plugins, and themes remain compatible. [Migration Guide](https://editor42.com/docs/migration/from-tinymce) ## License [MIT](https://editor42.com/docs/license) — free to use in commercial, proprietary, and open-source projects with no copyleft restrictions. --- # Editor42 Documentation > Editor42 documentation: every way to install it, the configuration options and the API, migration from TinyMCE, the security fixes and the changelog. Source: https://editor42.com/docs Section: Index Editor42 is a free, open-source, MIT-licensed WYSIWYG HTML editor — an auditable fork of TinyMCE based on its last permissively licensed release. ## Getting Started - [Self-hosted installation](https://editor42.com/docs/install/self-hosted) — download and host Editor42 on your own infrastructure - [CDN installation](https://editor42.com/docs/install/cdn) — load Editor42 directly from a content delivery network - [CMS](https://editor42.com/docs/install#cms) — the Editor42 plugin for [WordPress](https://editor42.com/docs/install/wordpress) and [ClassicPress](https://editor42.com/docs/install/classicpress), in place of the outdated TinyMCE 4 they ship - [Integrations](https://editor42.com/docs/install#integrations) — the [NPM package](https://editor42.com/docs/install/npm) for Vite, Webpack or Rollup, the [Composer package](https://editor42.com/docs/install/composer) for PHP projects, components for [React](https://editor42.com/docs/install/react), [Vue](https://editor42.com/docs/install/vue), [Angular](https://editor42.com/docs/install/angular), [Svelte](https://editor42.com/docs/install/svelte) and [jQuery](https://editor42.com/docs/install/jquery), and a [Web Component](https://editor42.com/docs/install/web-component) - [**Migration from TinyMCE**](https://editor42.com/docs/migration/from-tinymce) — switch from TinyMCE to Editor42 with minimal effort - [Security](https://editor42.com/docs/security) — fixed CVEs and how to report a vulnerability - [Changelog](https://editor42.com/docs/changelog) — version history and release notes ## Explore - [Plugins](https://editor42.com/plugins) — the full set of built-in plugins - [Examples](https://editor42.com/examples/full-featured) — try Editor42 live in your browser ## API Reference - [Configuration Options](https://editor42.com/api/configuration) — all available settings for customizing the editor - [Editor API](https://editor42.com/api/editor) — methods, properties, and sub-APIs for programmatic editor control - [Commands](https://editor42.com/api/commands) — all built-in commands that can be executed via `execCommand()` - [Events](https://editor42.com/api/events) — all events fired by the editor, with payload types and usage examples - [Content Formatting](https://editor42.com/api/formatting) — Formatter API for applying, removing, and querying formats programmatically - [UI Components](https://editor42.com/api/ui-components) — register custom toolbar buttons, menu items, context menus, sidebars, and more ## Dev Resources - [GitHub](https://github.com/editor42com/editor42) — source code, issues, and contributions --- # Use Editor42 with AI > Give ChatGPT, Claude, Cursor or any coding agent the Editor42 docs: any page as Markdown, all docs in one file, llms.txt and the Editor42 skill. Source: https://editor42.com/docs/ai Ask ChatGPT, Claude, Cursor or any coding agent about Editor42, with these docs as the source. The files below are made from these docs every time the site is built, so they always say what the pages say. ## Ask about one page Every docs page has a **Copy page for AI** button next to its breadcrumbs. It copies the page as Markdown, ready to paste into your chat. Its menu opens the page's Markdown, or opens the page in ChatGPT or Claude so you can ask about it. ## Give your AI all the docs All Editor42 docs in one Markdown file. Attach it to a chat or an AI project. [Download all docs](https://editor42.com/llms-full.txt) - [llms.txt](https://editor42.com/llms.txt): the index AI agents read first, every page with a one-line description. - Any page as Markdown: add `.md` to its URL, like [https://editor42.com/docs/ai.md](https://editor42.com/docs/ai.md) for this page. ## The Editor42 skill for AI assistants A skill teaches an AI assistant how to install, configure and troubleshoot Editor42: which editor and which way of installing, the exact steps, the configuration options, the common questions. It is made from these docs every time the site is built. [Download the skill](https://editor42.com/ai/editor42.zip) [View SKILL.md](https://editor42.com/ai/editor42/SKILL.md) | Where | How to add it | |---|---| | Claude apps | Settings > Capabilities > Skills, then upload the zip | | Claude Code | Unzip into `.claude/skills/` of your project, or into `~/.claude/skills/` | | Other coding agents | Unzip into the folder the agent reads skills from | | ChatGPT and other chats | Attach `SKILL.md` to the chat | | Any agent that reads the web | Tell it: `Read https://editor42.com/ai/editor42/SKILL.md and follow it` | ## Coding agents Start the conversation with: ```text Read https://editor42.com/llms.txt first, then help me add Editor42 to my project. ``` ## What every AI should know about Editor42 - `editor42.init()` starts the editor; `tinymce.init()` works too, because Editor42 sets `window.tinymce` as an alias of `window.editor42`. - The CDN script is `https://cdn.editor42.com/editor42/latest/editor42.min.js`. Editor42 needs no API key. - Moving from TinyMCE: replace the script (or the TinyMCE framework wrapper with its Editor42 fork) and keep the configuration; the options, plugins and API are TinyMCE 6's. The same list opens [llms.txt](https://editor42.com/llms.txt) and the skill. --- # Install Editor42 > Install the Editor42 WYSIWYG HTML editor self-hosted, from the CDN, as a WordPress or ClassicPress plugin, from NPM or Composer, or for your framework. Source: https://editor42.com/docs/install Section: Installation Editor42 is one editor with several ways in. Take the script if you have a page, the plugin if you run WordPress or ClassicPress, the package if you have a bundler or Composer, or the component for the framework you are already using — the editor and its options are the same in all of them, and none of them needs an account or an API key. - [Self-hosted](https://editor42.com/docs/install/self-hosted): Download the build and serve it from your own infrastructure. - [CDN](https://editor42.com/docs/install/cdn): One script tag, nothing to host, always the latest fix release. ## CMS The Editor42 plugin, in place of the outdated TinyMCE 4.9.11 these CMSs still ship. - [WordPress](https://editor42.com/docs/install/wordpress): The Editor42 plugin: a block for the block editor, or the classic screen with Editor42. - [ClassicPress](https://editor42.com/docs/install/classicpress): The same plugin, in place of the TinyMCE 4 ClassicPress ships. ## Integrations Each of these installs with a package manager: the editor itself, from NPM for your bundler or from Composer for a PHP project, or a component for the framework you already use. - [NPM](https://editor42.com/docs/install/npm): The editor as a package, for Vite, Webpack or Rollup. - [Composer](https://editor42.com/docs/install/composer): The editor as the editor42/editor42 package, for PHP projects. - [React](https://editor42.com/docs/install/react): The @editor42/editor42-react component, React 16.7 to 19. - [Vue](https://editor42.com/docs/install/vue): The @editor42/editor42-vue component, with v-model support. - [Angular](https://editor42.com/docs/install/angular): The @editor42/editor42-angular standalone component. - [Svelte](https://editor42.com/docs/install/svelte): The @editor42/editor42-svelte component, written with runes. - [jQuery](https://editor42.com/docs/install/jquery): A jQuery plugin that patches .val(), .html() and friends. - [Web Component](https://editor42.com/docs/install/web-component): The \ custom element, for any framework or none. ## After the installation - Configure the editor with the [configuration options](https://editor42.com/api/configuration) — toolbars, menus, plugins, content rules. - Coming from TinyMCE? The [migration guide](https://editor42.com/docs/migration/from-tinymce) covers the editor, and each component page covers its own `@tinymce/*` wrapper. - Try it first: the [live demos](https://editor42.com/examples) run Editor42 on a plain page and in every framework component. --- # Self-Hosted Installation > Download the pre-built Editor42, unpack it into your public directory and load editor42.min.js from your own server, with full control over updates. Source: https://editor42.com/docs/install/self-hosted Section: Installation > Self-Hosted Host Editor42 on your own server for full control over updates and availability. Using a framework? [React, Vue, Angular, Svelte, jQuery and the Web Component](https://editor42.com/docs/install) can all be pointed at your own copy of the script. ## Download Editor42 ships pre-built, so there is nothing to compile. The archive holds a single `editor42/` folder — unpack it into your project's public directory. [Download Editor42](https://editor42.com/download/editor42.zip) Inside it, `editor42.min.js` sits next to the `skins/`, `icons/`, `themes/`, `models/`, `plugins/` and `langs/` folders it loads while running. The editor resolves those relative to its own script, so keep them all side by side. ## Basic Setup Add Editor42 to your HTML page: ```html ``` ## Configuration Editor42 uses the same configuration options as TinyMCE. See the [Configuration Options](https://editor42.com/api/configuration) for the full list of available settings. --- # CDN Installation > Load Editor42 from cdn.editor42.com with one script tag: nothing to download or build, no API key, and always the latest fix release of the editor. Source: https://editor42.com/docs/install/cdn Section: Installation > CDN Load Editor42 from a CDN for the fastest setup with no downloads required. Using React, Vue, Angular, Svelte, jQuery or a bundler? Each has [its own way in](https://editor42.com/docs/install), and they load this same script for you. ## Quick Start Add the following script tag to your HTML: ```html ``` ## Advantages - No files to host or maintain - Fast setup — one script tag, no build step - Automatic updates — always get the latest security and bug-fix release --- # WordPress Installation > Replace the outdated TinyMCE 4.9.11 of WordPress with Editor42, a maintained MIT-licensed fork: a block for the block editor, or the classic screen. Source: https://editor42.com/docs/install/wordpress Section: Installation > CMS > WordPress The Editor42 plugin brings Editor42 to WordPress: an Editor42 block in the block editor or, with one switch, the classic editing screen with Editor42 in place of the TinyMCE WordPress ships. It is free and MIT-licensed, needs no account and no API key, and loads nothing from outside your site. ## Why replace TinyMCE in WordPress WordPress 7.0 still edits classic content with TinyMCE 4.9.11, released in July 2020 and the last TinyMCE 4 there is. The Classic Editor plugin, the Classic block and the visual editor fields of themes and plugins (`wp_editor()`) all run on it. TinyMCE's later releases fixed a series of cross-site scripting (XSS) issues, from 5.6.0 in November 2020 to 6.8.4 in June 2024, and none of those fixes was ever released for TinyMCE 4. Editor42 is a maintained fork of the last MIT-licensed TinyMCE, with those fixes and the ones listed on the [Security](https://editor42.com/docs/security) page. The plugin bundles it and never loads the TinyMCE inside WordPress, so it keeps working on future WordPress versions that no longer ship one. ## Step 1: Download the plugin The zip installs on WordPress 6.2 and newer. Do not unzip it: WordPress takes the zip as it is. [Download Editor42 for WordPress](https://editor42.com/download/editor42-wordpress.zip) ## Step 2: Install the plugin In your WordPress admin, open **Plugins → Add Plugin** and press **Upload Plugin**. Choose the zip, press **Install Now**, then **Activate Plugin**. - [![The Upload Plugin form of the WordPress admin with the Editor42 zip chosen](https://editor42.com/img/screenshots/docs/integrations/wordpress/thumbs/upload-plugin-zip.jpg)](https://editor42.com/img/screenshots/docs/integrations/wordpress/upload-plugin-zip.png) *Plugins → Add Plugin → Upload Plugin: choose the zip, then Install Now* ## Step 3: Choose your editor Open **Settings → Editor42**. **Default editor** has two options: - **Only a Gutenberg block** (the default): the block editor stays, and Editor42 is one of its blocks. - **Editor42 as the main editor**: posts and pages open in Editor42 instead of the block editor. Try the Editor42 block first, then switch to Editor42 as the main editor. - [![The Editor42 settings screen in WordPress, with the Default editor switch at the top](https://editor42.com/img/screenshots/docs/integrations/wordpress/thumbs/default-editor-settings.jpg)](https://editor42.com/img/screenshots/docs/integrations/wordpress/default-editor-settings.png) *Settings → Editor42: the Default editor switch* ## ✓ Write with Editor42 Add an **Editor42** block from the block inserter. Once Editor42 is the main editor, every post and page opens in it. - [![An Editor42 block in the WordPress block editor: a table and a numbered list with the Editor42 toolbar above them](https://editor42.com/img/screenshots/docs/integrations/wordpress/thumbs/rich-text-block-editor.jpg)](https://editor42.com/img/screenshots/docs/integrations/wordpress/rich-text-block-editor.png) *The Editor42 block in the block editor* - [![The WordPress classic editing screen with Editor42: the menubar, two toolbar rows and a post with a captioned picture](https://editor42.com/img/screenshots/docs/integrations/wordpress/thumbs/classic-editor-screen.jpg)](https://editor42.com/img/screenshots/docs/integrations/wordpress/classic-editor-screen.png) *The classic editing screen with Editor42* ## What you get - A rich toolbar out of the box: two rows with tables, colors, emoji, code view, find and replace and accordions, with the menubar above it. - Your own toolbar: in **Settings → Editor42**, drag buttons in and out or load the Simple or Full-featured preset. - Editor42 in the other classic editor fields too: product descriptions, text widgets, plugin fields. - The WordPress media library wherever a picture comes in: Add Media, the Browse button of the image dialog, and pictures you paste or drop into the text, which are uploaded to the library. - Image alignment and captions stored exactly as the classic editor stored them; the older `[caption]` spellings are read too. - The WordPress link dialog, with search over your posts and pages. - The Text tab with quicktags, next to the Visual tab. - Live previews of galleries, embeds and media shortcodes, the shortcode text kept byte for byte. - In the block editor: paragraphs, headings, lists and quotes turn into an Editor42 block and back with one click, a toolbar that stays in view on long texts, fullscreen editing over the whole window, in-place editing in the Site Editor, the pattern editor and the device previews, and the block editor's own shortcuts (save, the list view, moving or removing the block) from inside the text. - The text wears your theme's styles while you edit. - A right-to-left site gets a right-to-left editor. ## Your content stays yours Content is stored the way the classic editor always stored it: standard HTML in `post_content`, paragraphs restored by `wpautop` on output, captions as the regular `[caption]` shortcode. Posts written before the plugin open and save unchanged, apart from scripts and style blocks, which the editor drops. An Editor42 block is saved as the HTML it shows, so your site renders it as it is. The plugin stores one option of its own. ## Buttons from other plugins Buttons that other plugins add to the classic editor through the `mce_buttons` and `mce_external_plugins` filters are written for the TinyMCE inside WordPress core, and Editor42 does not load them. A plugin can offer its button to Editor42 through the `editor42_toolbar_buttons` and `editor42_external_plugins` filters, described in the README inside the plugin; the button then shows up in the toolbar configurator like any other. ## Requirements - WordPress 6.2 or newer, tested up to 7.1, or [ClassicPress 2](https://editor42.com/docs/install/classicpress) - PHP 7.0 or newer Everything the plugin uses ships inside it and loads from your own site: no CDN, no accounts, no tracking. ## Source and licence The plugin is MIT-licensed, and its own PHP, JavaScript and CSS ship unminified. The bundled engine is Editor42 42.0.0 as published in [editor42com/editor42-dist](https://github.com/editor42com/editor42-dist) (tag `42.0.0`), minified with the readable file next to every minified one. Its source is the `editor42` branch of [editor42com/editor42](https://github.com/editor42com/editor42), at its 42.0.0 release commit; `yarn && yarn build` there writes the same files to `modules/editor42/js/editor42/`. --- # ClassicPress Installation > Replace the outdated TinyMCE 4.9.11 of ClassicPress with Editor42, a maintained MIT-licensed fork with the security fixes TinyMCE 4 never got. Source: https://editor42.com/docs/install/classicpress Section: Installation > CMS > ClassicPress The Editor42 plugin puts Editor42 in place of the TinyMCE ClassicPress ships: on the editing screen and in every other visual editor field of your site. It is the same plugin as [for WordPress](https://editor42.com/docs/install/wordpress), free and MIT-licensed, with no account, no API key and nothing loaded from outside your site. ## Why replace TinyMCE in ClassicPress ClassicPress 2 edits with TinyMCE 4.9.11, released in July 2020 and the last TinyMCE 4 there is. TinyMCE's later releases fixed a series of cross-site scripting (XSS) issues, from 5.6.0 in November 2020 to 6.8.4 in June 2024, and none of those fixes was ever released for TinyMCE 4. Editor42 is a maintained fork of the last MIT-licensed TinyMCE, with those fixes and the ones listed on the [Security](https://editor42.com/docs/security) page. The plugin bundles it and never loads the TinyMCE inside ClassicPress. ## Step 1: Download the plugin The zip installs on ClassicPress 2. Do not unzip it: ClassicPress takes the zip as it is. [Download Editor42 for ClassicPress](https://editor42.com/download/editor42-wordpress.zip) ## Step 2: Install the plugin In your ClassicPress admin, open **Plugins → Upload**. Choose the zip, press **Install Now**, then **Activate Plugin**. - [![The plugin upload form of the ClassicPress admin with the Editor42 zip chosen](https://editor42.com/img/screenshots/docs/integrations/classicpress/thumbs/upload-plugin-zip.jpg)](https://editor42.com/img/screenshots/docs/integrations/classicpress/upload-plugin-zip.png) *Plugins → Upload: choose the zip, then Install Now* ## ✓ Write with Editor42 Open any post or page: it opens in Editor42. - [![The ClassicPress editing screen with Editor42: the menubar, two toolbar rows and a post with a captioned picture](https://editor42.com/img/screenshots/docs/integrations/classicpress/thumbs/edit-post-rich-toolbar.jpg)](https://editor42.com/img/screenshots/docs/integrations/classicpress/edit-post-rich-toolbar.png) *The editing screen with Editor42* ## What you get - A rich toolbar out of the box: two rows with tables, colors, emoji, code view, find and replace and accordions, with the menubar above it. - Your own toolbar: in **Settings → Editor42**, drag buttons in and out or load the Simple or Full-featured preset. - Editor42 in the other classic editor fields too: product descriptions, text widgets, plugin fields. - The media library wherever a picture comes in: Add Media, the Browse button of the image dialog, and pictures you paste or drop into the text, which are uploaded to the library. - Image alignment and captions stored exactly as the classic editor stored them; the older `[caption]` spellings are read too. - The link dialog, with search over your posts and pages. - The Text tab with quicktags, next to the Visual tab. - Live previews of galleries, embeds and media shortcodes, the shortcode text kept byte for byte. - A right-to-left site gets a right-to-left editor. ## Your content stays yours Content is stored the way the classic editor always stored it: standard HTML in `post_content`, paragraphs restored by `wpautop` on output, captions as the regular `[caption]` shortcode. Posts written before the plugin open and save unchanged, apart from scripts and style blocks, which the editor drops. The plugin stores one option of its own. ## Buttons from other plugins Buttons that other plugins add to the classic editor through the `mce_buttons` and `mce_external_plugins` filters are written for the TinyMCE inside ClassicPress, and Editor42 does not load them. A plugin can offer its button to Editor42 through the `editor42_toolbar_buttons` and `editor42_external_plugins` filters, described in the README inside the plugin; the button then shows up in the toolbar configurator like any other. ## Requirements - ClassicPress 2.0 or newer - PHP 7.4 or newer, which ClassicPress 2 itself requires (the plugin runs on PHP 7.0 and newer) Everything the plugin uses ships inside it and loads from your own site: no CDN, no accounts, no tracking. ## Source and licence The plugin is MIT-licensed, and its own PHP, JavaScript and CSS ship unminified. The bundled engine is Editor42 42.0.0 as published in [editor42com/editor42-dist](https://github.com/editor42com/editor42-dist) (tag `42.0.0`), minified with the readable file next to every minified one. Its source is the `editor42` branch of [editor42com/editor42](https://github.com/editor42com/editor42), at its 42.0.0 release commit; `yarn && yarn build` there writes the same files to `modules/editor42/js/editor42/`. --- # NPM Installation > Install the Editor42 WYSIWYG HTML editor from NPM and bundle it with Vite, Webpack or Rollup. MIT-licensed, no account and no API key. Source: https://editor42.com/docs/install/npm Section: Installation > Integrations > NPM The `editor42` package is the editor itself, ready for a bundler. There is no account, no sign-up and no key of any kind. ## Install ```sh npm install editor42 ``` or for Yarn users: ```sh yarn add editor42 ``` ## Basic Setup ```js import editor42 from 'editor42'; editor42.init({ selector: '#my-editor' }); ``` The package also sets `window.editor42` (and `window.tinymce`, for compatibility) when it loads, so existing code that reaches for the global keeps working. ## Where the Editor Loads Its Files From Editor42 is not a single file. Skins, icons, themes, models and plugins are fetched at runtime, relative to the script that loaded the editor — and a bundler rewrites your code into a hashed file somewhere else, so the editor cannot guess that path. Tell it with `base_url`. ### From your own project Copy the runtime folders out of the package into your public directory — `skins/`, `icons/`, `themes/`, `models/` and `plugins/` from `node_modules/editor42/` into `public/editor42/` — then point at your copy: ```js editor42.init({ selector: '#my-editor', base_url: '/editor42' }); ``` In Vite that copy is a job for `vite-plugin-static-copy`; in Webpack, for `copy-webpack-plugin`. ### From the CDN Nothing to copy: point at the same folders on the CDN. ```js editor42.init({ selector: '#my-editor', base_url: 'https://cdn.editor42.com/editor42/latest' }); ``` ## TypeScript Type definitions ship inside the package, so nothing extra is needed: ```ts import editor42, { Editor, EditorOptions } from 'editor42'; const options: EditorOptions['init_instance_callback'] = (editor: Editor) => { console.log(editor.id + ' is ready'); }; ``` ## Framework Components Using a framework? Each one has its own component with the same options: [React](https://editor42.com/docs/install/react) · [Vue](https://editor42.com/docs/install/vue) · [Angular](https://editor42.com/docs/install/angular) · [Svelte](https://editor42.com/docs/install/svelte) · [jQuery](https://editor42.com/docs/install/jquery) · [Web Component](https://editor42.com/docs/install/web-component) ## Configuration Editor42 uses the same configuration options as TinyMCE. See the [Configuration Options](https://editor42.com/api/configuration) for the full list. ## Live Demo See it running, with its full source: the [NPM demo](https://editor42.com/examples/npm). ## Links - NPM: [`editor42`](https://www.npmjs.com/package/editor42) - GitHub: [editor42com/editor42](https://github.com/editor42com/editor42) --- # Composer Installation > Install the Editor42 WYSIWYG HTML editor with Composer, from the editor42/editor42 package. MIT-licensed, no account and no API key. Source: https://editor42.com/docs/install/composer Section: Installation > Integrations > Composer The `editor42/editor42` package is the editor's ready-to-use build, the same one you can [download](https://editor42.com/docs/install/self-hosted), for PHP projects that take their front-end libraries from Composer. There is no account and no key of any kind. ## Install ```sh composer require editor42/editor42 ``` ## Basic Setup The files land in `vendor/editor42/editor42/`. Serve that folder, or copy it into your public directory, and load the editor from it: ```html ``` Keep the folder whole: `editor42.min.js` loads its plugins, skins, icons, themes and models from the folders next to it. ## Updates ```sh composer update editor42/editor42 ``` The package carries the editor's own version number, so a constraint of `^42` takes every fix release. --- # React Installation > Add the Editor42 WYSIWYG HTML editor to a React app with @editor42/editor42-react, a drop-in replacement for @tinymce/tinymce-react. No API key. Source: https://editor42.com/docs/install/react Section: Installation > Integrations > React `@editor42/editor42-react` is a thin wrapper around Editor42 that makes it a React component. There is no account, no sign-up and no key of any kind. ## Install ```sh npm install @editor42/editor42-react ``` or for Yarn users: ```sh yarn add @editor42/editor42-react ``` React 16.7 and newer are supported, up to React 19. ## Basic Setup ```jsx import { Editor } from '@editor42/editor42-react'; export default function App() { return ( ); } ``` With no extra props the editor script is loaded from `https://cdn.editor42.com` on the `latest` channel. That pointer only ever moves for security and bug-fix releases, because the Editor42 major version is fixed forever. ## Reading and Writing the Content Pass `value` and `onEditorChange` to control the editor from your own state: ```jsx import { useState } from 'react'; import { Editor } from '@editor42/editor42-react'; export default function App() { const [content, setContent] = useState('

Hello from Editor42

'); return ( setContent(newContent)} init={{ height: 400, plugins: 'lists link', toolbar: 'bold italic | bullist link' }} /> ); } ``` Use `initialValue` instead when you only need a starting point and will read the content later. ## Self-Hosting Point the component at your own copy of the script, using the full file URL: ```jsx ``` An array is accepted for loading the editor plus separate bundles, and array items may set `integrity` and `crossOrigin` for CSP-hardened deployments. Passing an empty array opts out of script loading entirely, for pages that load the editor themselves. ## Pinning a Version ```jsx ``` `channel` accepts `latest`, a `latest-N` alias, or an exact version. ## Editor Options Everything else is an Editor42 option, passed through `init`: ```jsx ``` See the [Configuration Options](https://editor42.com/api/configuration) for the full list. ## Migrating from @tinymce/tinymce-react ```sh npm uninstall @tinymce/tinymce-react npm install @editor42/editor42-react ``` Change the import to `@editor42/editor42-react` and you are done. Prop, event and component names are unchanged, and the old `tinymceScriptSrc` and `cloudChannel` props keep working as deprecated aliases of `editor42ScriptSrc` and `channel`. All API-key and licence-key handling has been removed. The corresponding props are still accepted so existing code compiles, but they do nothing: no key is read, stored or sent anywhere, and no request ever reaches a vendor cloud. The component also drives a stock TinyMCE if that is what is already loaded on the page, which keeps the switch reversible. See the [migration guide](https://editor42.com/docs/migration/from-tinymce) for the editor side of the move. ## Live Demo See it running, with its full source: the [React demo](https://editor42.com/examples/react). ## Links - NPM: [`@editor42/editor42-react`](https://www.npmjs.com/package/@editor42/editor42-react) - GitHub: [editor42com/editor42-react](https://github.com/editor42com/editor42-react) --- # Vue Installation > Add the Editor42 WYSIWYG HTML editor to a Vue 3 app with @editor42/editor42-vue, a drop-in replacement for @tinymce/tinymce-vue. No API key. Source: https://editor42.com/docs/install/vue Section: Installation > Integrations > Vue `@editor42/editor42-vue` is a thin wrapper around Editor42 that makes it a Vue 3 component. There is no account, no sign-up and no key of any kind. ## Install ```sh npm install @editor42/editor42-vue ``` or for Yarn users: ```sh yarn add @editor42/editor42-vue ``` Vue 3 is supported; Vue 2 is not. ## Basic Setup ```html ``` With no extra props the editor script is loaded from `https://cdn.editor42.com` on the `latest` channel. That pointer only ever moves for security and bug-fix releases, because the Editor42 major version is fixed forever. ## Reading and Writing the Content The component supports `v-model`: ```html ``` Use `initial-value` instead when you only need a starting point and will read the content later. ## Self-Hosting Point the component at your own copy of the script, using the full file URL: ```html ``` ## Pinning a Version ```html ``` `channel` accepts `latest`, a `latest-N` alias, or an exact version. ## Editor Options Everything else is an Editor42 option, passed through `init`: ```html ``` See the [Configuration Options](https://editor42.com/api/configuration) for the full list. ## Migrating from @tinymce/tinymce-vue ```sh npm uninstall @tinymce/tinymce-vue npm install @editor42/editor42-vue ``` Change the import to `@editor42/editor42-vue` and you are done. Prop and event names are unchanged, and the old `tinymce-script-src` and `cloud-channel` props keep working as deprecated aliases of `editor42-script-src` and `channel`. All API-key and licence-key handling has been removed. The corresponding props are still accepted so existing code compiles, but they do nothing: no key is read, stored or sent anywhere, and no request ever reaches a vendor cloud. The component also drives a stock TinyMCE if that is what is already loaded on the page, which keeps the switch reversible. See the [migration guide](https://editor42.com/docs/migration/from-tinymce) for the editor side of the move. ## Live Demo See it running, with its full source: the [Vue demo](https://editor42.com/examples/vue). ## Links - NPM: [`@editor42/editor42-vue`](https://www.npmjs.com/package/@editor42/editor42-vue) - GitHub: [editor42com/editor42-vue](https://github.com/editor42com/editor42-vue) --- # Angular Installation > Add the Editor42 WYSIWYG HTML editor to an Angular app with @editor42/editor42-angular, a drop-in replacement for @tinymce/tinymce-angular. No API key. Source: https://editor42.com/docs/install/angular Section: Installation > Integrations > Angular `@editor42/editor42-angular` is a thin wrapper around Editor42 that makes it an Angular component. There is no account, no sign-up and no key of any kind. ## Install ```sh npm install @editor42/editor42-angular ``` or for Yarn users: ```sh yarn add @editor42/editor42-angular ``` ## Basic Setup The editor is a standalone component: ```ts import { Component } from '@angular/core'; import { EditorComponent } from '@editor42/editor42-angular'; @Component({ selector: 'app-root', standalone: true, imports: [ EditorComponent ], template: '' }) export class AppComponent {} ``` With no extra inputs the editor script is loaded from `https://cdn.editor42.com` on the `latest` channel. That pointer only ever moves for security and bug-fix releases, because the Editor42 major version is fixed forever. `EditorModule` is exported as well, for applications that are still organised in NgModules. ## Reading and Writing the Content The component implements `ControlValueAccessor`, so it works with both forms APIs: ```ts @Component({ selector: 'app-root', standalone: true, imports: [ EditorComponent, FormsModule ], template: '' }) export class AppComponent { content = '

Hello from Editor42

'; } ``` ## Self-Hosting Provide the full script URL through dependency injection: ```ts import { EDITOR42_SCRIPT_SRC } from '@editor42/editor42-angular'; providers: [ { provide: EDITOR42_SCRIPT_SRC, useValue: '/js/editor42/editor42.min.js' } ] ``` ## Pinning a Version ```html ``` `channel` accepts `latest`, a `latest-N` alias, or an exact version. ## Editor Options Everything else is an Editor42 option, passed through the init input: ```html ``` See the [Configuration Options](https://editor42.com/api/configuration) for the full list. ## Migrating from @tinymce/tinymce-angular ```sh npm uninstall @tinymce/tinymce-angular npm install @editor42/editor42-angular ``` Change the import to `@editor42/editor42-angular` and you are done. Input, output and component names are unchanged. The `TINYMCE_SCRIPT_SRC` injection token still works as a deprecated alias of `EDITOR42_SCRIPT_SRC` (the Editor42 token wins when both are provided), and `cloudChannel` remains as a deprecated alias of `channel`. All API-key and licence-key handling has been removed. The corresponding inputs are still accepted so existing code compiles, but they do nothing: no key is read, stored or sent anywhere, and no request ever reaches a vendor cloud. The component also drives a stock TinyMCE if that is what is already loaded on the page, which keeps the switch reversible. See the [migration guide](https://editor42.com/docs/migration/from-tinymce) for the editor side of the move. ## Live Demo See it running, with its full source: the [Angular demo](https://editor42.com/examples/angular). ## Links - NPM: [`@editor42/editor42-angular`](https://www.npmjs.com/package/@editor42/editor42-angular) - GitHub: [editor42com/editor42-angular](https://github.com/editor42com/editor42-angular) --- # Svelte Installation > Add the Editor42 WYSIWYG HTML editor to a Svelte 5 app with @editor42/editor42-svelte, a drop-in replacement for @tinymce/tinymce-svelte. No API key. Source: https://editor42.com/docs/install/svelte Section: Installation > Integrations > Svelte `@editor42/editor42-svelte` is a thin wrapper around Editor42 that makes it a Svelte 5 component. There is no account, no sign-up and no key of any kind. ## Install ```sh npm install @editor42/editor42-svelte ``` or for Yarn users: ```sh yarn add @editor42/editor42-svelte ``` Svelte 5 is required — the component is written with runes. ## Basic Setup ```html ``` With no extra props the editor script is loaded from `https://cdn.editor42.com` on the `latest` channel. That pointer only ever moves for security and bug-fix releases, because the Editor42 major version is fixed forever. ## Reading and Writing the Content `value` is bindable, so the content travels both ways: ```html ``` ## Self-Hosting Point the component at your own copy of the script, using the full file URL: ```html ``` ## Pinning a Version ```html ``` `channel` accepts `latest`, a `latest-N` alias, or an exact version. ## Editor Options Everything else is an Editor42 option, passed through `conf`: ```html ``` See the [Configuration Options](https://editor42.com/api/configuration) for the full list. ## Migrating from @tinymce/tinymce-svelte ```sh npm uninstall @tinymce/tinymce-svelte npm install @editor42/editor42-svelte ``` Change the import to `@editor42/editor42-svelte` and you are done. `scriptSrc`, `channel` and `conf` keep their names, and TinyMCE-style numeric channels resolve to `latest`. All API-key and licence-key handling has been removed. The corresponding props are still accepted so existing code compiles, but they do nothing: no key is read, stored or sent anywhere, and no request ever reaches a vendor cloud. The wrapper div class defaults to `editor42-wrapper` (it was `tinymce-wrapper`); set the `cssClass` prop if your styles target the old name. The component also drives a stock TinyMCE if that is what is already loaded on the page, which keeps the switch reversible. See the [migration guide](https://editor42.com/docs/migration/from-tinymce) for the editor side of the move. ## Live Demo See it running, with its full source: the [Svelte demo](https://editor42.com/examples/svelte). ## Links - NPM: [`@editor42/editor42-svelte`](https://www.npmjs.com/package/@editor42/editor42-svelte) - GitHub: [editor42com/editor42-svelte](https://github.com/editor42com/editor42-svelte) --- # jQuery Installation > Add the Editor42 WYSIWYG HTML editor to a jQuery page with @editor42/editor42-jquery, a drop-in replacement for @tinymce/tinymce-jquery. No API key. Source: https://editor42.com/docs/install/jquery Section: Installation > Integrations > jQuery `@editor42/editor42-jquery` is a thin wrapper around Editor42 that makes it a jQuery plugin. There is no account, no sign-up and no key of any kind. It patches `.val()`, `.html()`, `.text()`, `.append()`, `.prepend()`, `.remove()`, `.empty()` and `.attr()` so they work naturally against editor-bound elements — reading from and writing to the editor instead of the hidden textarea underneath it. ## Install ```sh npm install @editor42/editor42-jquery ``` or for Yarn users: ```sh yarn add @editor42/editor42-jquery ``` ## Basic Setup Load jQuery first, then the integration: ```html ``` With no `script_url` the editor script is loaded from `https://cdn.editor42.com` on the `latest` channel. That pointer only ever moves for security and bug-fix releases, because the Editor42 major version is fixed forever. ## Reading and Writing the Content Once an element is bound, the usual jQuery accessors talk to the editor: ```js $('#editor').html(); // the editor's HTML $('#editor').html('

New content

'); // replaces it $('*:editor42'); // every element bound to an editor ``` ## Self-Hosting ```js $('#editor').editor42({ script_url: '/js/editor42/editor42.min.js' }); ``` Any full script URL works. ## Pinning a Version ```js $('#editor').editor42({ channel: '42.0.0' }); ``` `channel` accepts `latest`, a `latest-N` alias, or an exact version. ## Editor Options Everything else is an Editor42 option, passed in the same settings object: ```js $('#editor').editor42({ height: 400, menubar: false, plugins: 'lists link' }); ``` See the [Configuration Options](https://editor42.com/api/configuration) for the full list. ## Migrating from @tinymce/tinymce-jquery ```sh npm uninstall @tinymce/tinymce-jquery npm install @editor42/editor42-jquery ``` `$(el).tinymce(settings)` and the `:tinymce` pseudo keep working as deprecated aliases of `$(el).editor42(settings)` and `:editor42`. `script_url`, `channel`, `script_loaded` and `oninit` keep their names, and TinyMCE-style numeric channels resolve to `latest`. All API-key and licence-key handling has been removed. The `api_key` setting is still accepted so existing code compiles, but it does nothing: no key is read, stored or sent anywhere, and no request ever reaches a vendor cloud. The integration also drives a stock TinyMCE if that is what is already loaded on the page, which keeps the switch reversible. See the [migration guide](https://editor42.com/docs/migration/from-tinymce) for the editor side of the move. ## Live Demo See it running, with its full source: the [jQuery demo](https://editor42.com/examples/jquery). ## Links - NPM: [`@editor42/editor42-jquery`](https://www.npmjs.com/package/@editor42/editor42-jquery) - GitHub: [editor42com/editor42-jquery](https://github.com/editor42com/editor42-jquery) --- # Web Component Installation > Add the Editor42 WYSIWYG HTML editor to any page with the \ custom element: plain HTML, Astro, htmx, Solid or Qwik. No API key. Source: https://editor42.com/docs/install/web-component Section: Installation > Integrations > Web Component `@editor42/editor42-webcomponent` registers ``, a W3C custom element wrapping Editor42. It works anywhere HTML works — plain pages, Astro, htmx, Solid, Qwik, or any framework with no component of its own. There is no account, no sign-up and no key of any kind. ## Install ```sh npm install @editor42/editor42-webcomponent ``` or for Yarn users: ```sh yarn add @editor42/editor42-webcomponent ``` ## Basic Setup ```html ``` With no `src` attribute the editor script is loaded from `https://cdn.editor42.com` on the `latest` channel. That pointer only ever moves for security and bug-fix releases, because the Editor42 major version is fixed forever. ## Reading and Writing the Content The element's own text content is its starting value, and the element is form-associated — give it a `name` and it submits with the surrounding `
` like any other field: ```html <p>Hello from Editor42</p>
``` ## Self-Hosting ```html ``` Any full script URL works. ## Pinning a Version ```html ``` `channel` accepts `latest`, a `latest-N` alias, or an exact version. ## Editor Options Common options are attributes — `toolbar`, `menubar`, `plugins`, `height`, `width`, `content_css`, `resize`, `skin` and more: ```html ``` A full configuration object can be referenced by name through the `config` attribute: ```html ``` Editor events are `on-*` attributes naming a global handler (`on-Init`, `on-Change`, `on-KeyUp`, …). See the [Configuration Options](https://editor42.com/api/configuration) for the full option list. ## Migrating from @tinymce/tinymce-webcomponent ```sh npm uninstall @tinymce/tinymce-webcomponent npm install @editor42/editor42-webcomponent ``` The deprecated `` tag is still registered as an alias, so existing markup keeps working, and TinyMCE-style numeric `channel` values resolve to `latest`. All API-key and licence-key handling has been removed. The `api-key` attribute is still accepted so existing markup compiles, but it does nothing: no key is read, stored or sent anywhere, and no request ever reaches a vendor cloud. The element also drives a stock TinyMCE if that is what is already loaded on the page, which keeps the switch reversible. See the [migration guide](https://editor42.com/docs/migration/from-tinymce) for the editor side of the move. ## Live Demo See it running, with its full source: the [Web Component demo](https://editor42.com/examples/web-component). ## Links - NPM: [`@editor42/editor42-webcomponent`](https://www.npmjs.com/package/@editor42/editor42-webcomponent) - GitHub: [editor42com/editor42-webcomponent](https://github.com/editor42com/editor42-webcomponent) --- # Migration > Move an existing TinyMCE installation of any version to Editor42, the maintained MIT-licensed fork, without rewriting the integration. Source: https://editor42.com/docs/migration Editor42 keeps TinyMCE's API, configuration options and plugins, so moving a TinyMCE integration to it is a swap rather than a rewrite. It works from any TinyMCE version, and the steps are the same whichever release you are on: - **Self-hosted**: replace the TinyMCE directory with the Editor42 distribution and point the script tag at `editor42.min.js`. - **CDN**: load `https://cdn.editor42.com/editor42/latest/editor42.min.js` in place of the Tiny Cloud URL. Editor42 needs no API key. - **Framework components**: the TinyMCE wrappers for React, Vue, Angular, Svelte, jQuery and the Web Component each have an Editor42 fork with the same props, events and component names. `tinymce.init()` keeps working, because Editor42 sets `window.tinymce` as an alias of `window.editor42`. What can need an edit is code that reaches into the editor by its brand-bearing names, such as the `.tox` classes of its UI, the `mce` commands and the `x-tinymce/html` clipboard type. The guide lists every one of them. - [Migration from TinyMCE](https://editor42.com/docs/migration/from-tinymce): Step by step: the script, the CDN URL, the init call, the framework packages and what your own code may need. --- # Migration from TinyMCE > Move any TinyMCE version to Editor42, the MIT-licensed fork: swap the script, the CDN URL or the framework package, and keep your configuration and plugins. Source: https://editor42.com/docs/migration/from-tinymce Section: Migration > Migration from TinyMCE From some point, TinyMCE changed its license from MIT to GPL. Editor42 is built from the latest MIT-licensed state of TinyMCE, so you get a maintained, secure rich text editor under a permissive license without rewriting your integration. You can migrate from any version of TinyMCE — the process is the same regardless of which release you are currently on, and in most cases the switch is seamless. ## Step by Step ### Self-Hosted Replace the TinyMCE directory with the Editor42 distribution and update your script tag: ```diff - + ``` ### CDN Update the CDN URL: ```diff - + ``` ### Init Call ```diff - tinymce.init({ + editor42.init({ selector: '#my-editor' }); ``` The old `tinymce.init()` call will also work — Editor42 sets `window.tinymce` as an alias for compatibility. ### Framework Components If your project uses one of TinyMCE's framework wrappers, there is an Editor42 fork of it with the same props, events and component names. Uninstall the old one, install ours, change the import: | TinyMCE | Editor42 | | |---|---|---| | `@tinymce/tinymce-react` | `@editor42/editor42-react` | [React](https://editor42.com/docs/install/react) | | `@tinymce/tinymce-vue` | `@editor42/editor42-vue` | [Vue](https://editor42.com/docs/install/vue) | | `@tinymce/tinymce-angular` | `@editor42/editor42-angular` | [Angular](https://editor42.com/docs/install/angular) | | `@tinymce/tinymce-svelte` | `@editor42/editor42-svelte` | [Svelte](https://editor42.com/docs/install/svelte) | | `@tinymce/tinymce-jquery` | `@editor42/editor42-jquery` | [jQuery](https://editor42.com/docs/install/jquery) | | `@tinymce/tinymce-webcomponent` | `@editor42/editor42-webcomponent` | [Web Component](https://editor42.com/docs/install/web-component) | The old prop and setting names (`tinymceScriptSrc`, `cloudChannel`, `TINYMCE_SCRIPT_SRC`, the `:tinymce` selector, the `` tag) keep working as deprecated aliases, and every API-key setting is still accepted but does nothing — no key is read, stored or sent anywhere. Each component page above lists its own aliases. If you install the editor from NPM rather than a script tag, `tinymce` becomes [`editor42`](https://editor42.com/docs/install/npm). ## API Compatibility TinyMCE APIs, events, configuration options, and plugins work with Editor42. Both `window.editor42` and `window.tinymce` are available by default, so existing code that references `window.tinymce` will continue to work as-is. If you want to disable the `window.tinymce` alias — reducing compatibility but getting rid of that TinyMCE-branded global — set `EDITOR42_NO_SHIM` before loading Editor42: ```html ``` ## What your own code may need to change Your configuration and the API carry over unchanged. What changes are the brand-bearing names inside the editor, so code that reaches into the editor's DOM or calls its internals by name needs these edits: - **CSS for the editor's UI**: `.tox` and `.tox-*` are `.editor42-t` and `.editor42-t-*`. A selector on a bare `.tox` matches nothing ([UI classes](https://editor42.com/docs/about-this-fork/technical-specs#editor-ui-css-classes-the-tox-namespace)). - **CSS or scripts for the editable content**: the `mce-*` classes are `editor42-m-*`, and the `data-mce-*` and `data-ephox-*` attributes are `data-editor42-*` ([content classes](https://editor42.com/docs/about-this-fork/technical-specs#editable-content-css-classes-the-mce-namespace), [data attributes](https://editor42.com/docs/about-this-fork/technical-specs#dom-data-attributes)). - **`editor.execCommand()` with an `mce` command**: `mceInsertContent` is `editor42InsertContent`, `mceLink` is `editor42Link`, and so on; the old names are not kept ([commands](https://editor42.com/docs/about-this-fork/technical-specs#editor-commands)). - **Content saved with `mceNonEditable` or `mceEditable`**: set `noneditable_class: 'mceNonEditable'` (and `editable_class: 'mceEditable'`) in your config, because the defaults follow the rename ([option defaults](https://editor42.com/docs/about-this-fork/technical-specs#option-defaults-that-embed-class-names)). - **`window.tinyMCEPreInit`**: set `window.editor42PreInit` instead; the old name is ignored ([globals](https://editor42.com/docs/about-this-fork/technical-specs#compatibility-shims)). - **Clipboard code that reads `x-tinymce/html`**: the MIME type is `x-editor42/html` ([MIME type](https://editor42.com/docs/about-this-fork/technical-specs#mime-type)). - **The `tinymce-5` skins**: they are `editor42-5` and `editor42-5-dark`, while `oxide` and `default` keep their names ([skins](https://editor42.com/docs/about-this-fork/technical-specs#skin-directories)). ## Technical Details Editor42 rebrands the editor's identifiers — CSS classes, global variables, hooks, and MIME types — while keeping the TinyMCE 6 API unchanged. Its own version, `42.0.0`, is reported through `minorVersion`; `majorVersion` stays `'6'`, because that field states the API level your code branches on and Editor42 implements TinyMCE 6 exactly. For the complete list of renamed identifiers and the reasoning behind the versioning scheme, see [Technical Details & Compatibility](https://editor42.com/docs/about-this-fork/technical-specs). --- # About this fork > Why Editor42 forked TinyMCE 6.8.6, how anyone can audit its changes, its technical details and the team that maintains it. Source: https://editor42.com/docs/about-this-fork Editor42 is a fork of TinyMCE 6.8.6, the last release of TinyMCE under the MIT license. The open-source TinyMCE 6 line has reached its end of life, and TinyMCE 7 and later are GPL or commercial. Editor42 keeps the editor on a permissive license and brings it back to a secure baseline: its first release closed the six publicly documented CVEs that were still open in TinyMCE 6.8.6. It stays the editor you know. The API, the configuration and the plugins are TinyMCE 6's; what changes are the brand-bearing names inside the editor, renamed by a preprocessor, so the delta of each release can be read and checked line by line. Editor42 is built and maintained by EdSDK, a team that has worked with embeddable rich text editors since 2008 and runs Editor42 in its own products. The pages of this section explain why the fork exists, how to audit it, what it renamed and who stands behind it: - [Motivation and goals](https://editor42.com/docs/about-this-fork/motivation): Why the fork exists, who it is for, and what guides each release. - [Auditing Editor42](https://editor42.com/docs/about-this-fork/auditing): The complete delta of each release, and a test for every fix. - [Technical specs](https://editor42.com/docs/about-this-fork/technical-specs): Every renamed identifier, the compatibility shims and the versioning. - [Who we are](https://editor42.com/docs/about-this-fork/who-we-are): EdSDK, the team that builds and maintains Editor42, and how to reach it. --- # Editor42: Motivation & Goals > Why Editor42 exists, who it is for, and the principles guiding every release — a security-maintained, MIT-licensed fork of TinyMCE 6.8.6. Source: https://editor42.com/docs/about-this-fork/motivation Section: About this fork > Motivation and goals **Editor42 is an open-source, MIT-licensed rich text editor — a security-maintained fork of TinyMCE 6.8.6, built for teams who need a permissively-licensed, self-hosted WYSIWYG editor they can keep shipping with.** This page explains why the project exists, who it is for, and the principles that will guide every release. ## The short version If you have spent years building on the open-source TinyMCE WYSIWYG editor, you already know how good it is — and you may also know that the open-source TinyMCE 6 line has reached end of life, while version 7 and later moved to a GPL-or-commercial license. For a large class of products, neither outcome works. A permissive MIT license is a hard requirement, an unmaintained editor carrying known vulnerabilities is a non-starter, and a copyleft or paid license simply does not fit the way the software ships. Editor42 exists to resolve exactly that tension. It is the same familiar, battle-tested editor you already trust — an MIT-licensed alternative to the now GPL-or-commercial TinyMCE — kept on a permissive license and brought back to a secure baseline. Nothing more, nothing less. ## Standing on the shoulders of TinyMCE We want to be unambiguous about this: TinyMCE is a genuine gem of open-source software, and the people behind it are excellent engineers who earned every bit of the editor's reputation. A rich text editor that handles real-world content — pasting from Word, complex tables, embedded media, accessibility, and the long tail of browser quirks — is one of the hardest things to build well on the web. TinyMCE is the product of two decades of patient, human-written, pre-AI-era engineering, refined through use by millions of developers and end users. The result is remarkably stable and broadly standards- and browser-compatible. That kind of software cannot simply be reproduced from scratch — and, frankly, it should not be. The open-source community does not need yet another half-finished editor; it needs the proven one to stay available. The release we fork from, TinyMCE 6.8.6, is already a highly capable, fully embeddable editor that satisfies the overwhelming majority of use cases out of the box and extends cleanly through its plugin system when it does not. Our work begins from deep respect for that foundation. We also respect Tiny's decision to change its licensing and business model. That is entirely their right, and it reflects a legitimate need to fund ongoing development. Our point is narrower, and it is not adversarial: those terms — GPL-or-commercial, together with the end of support for the last MIT release — no longer fit everyone. The resulting licensing uncertainty is real, and for many teams it is disqualifying. ## An independent project To be clear, Editor42 is an independent project: we are not affiliated with, endorsed by, or sponsored by Tiny Technologies Inc. or the TinyMCE project, and we use the TinyMCE name only to describe where the code comes from. In practice that also means support and issues are ours to handle — if something needs fixing, you come to us, not them. ## Why a fork, and why now Editor42 did not appear out of nowhere. We have supported TinyMCE in production for our clients for a long time, and the same request kept arriving: *we need to stay on the permissive MIT version, and we need it to be secure.* When the open-source 6.x line stopped receiving security updates, that request became urgent — the code was left in place with a handful of known, publicly documented vulnerabilities and no upstream fixes coming. Rather than keep solving this privately, one client at a time, we decided to turn it into a public, polished, openly maintained solution. Editor42 is that solution: a secure, familiar, permissively-licensed editor that any team can adopt with confidence. As a first step on security, we cherry-picked the available upstream MIT patches for two of those CVEs and wrote our own fixes for the remaining four — the [Security](https://editor42.com/docs/security) page lists every one of them. But Editor42 is an actively maintained project, not a frozen snapshot of someone else's code. We keep a hand on the pulse — watching for newly disclosed vulnerabilities, shipping fixes, and carrying the editor forward release after release. Keeping this baseline secure and dependable over time is a standing commitment, not a one-off. ## What Editor42 is — and what it is not Our goal is deliberately modest, and that is the entire point. Editor42 is not a reinvention, not a rewrite, and not an attempt to "improve" a mature editor by piling on features. It is the editor you already know, made safe to keep using under MIT. Everything follows from one principle: **the code must stay auditable.** We keep changes to the core to an absolute minimum and lean on the existing plugin system as the mechanism for adding functionality — so the editor's well-understood internals stay well-understood. The first release is deliberately small, with changes confined to three areas: rebranding, decoupling from hosted cloud services, and closing security vulnerabilities. The guiding rule does not change after that — anything we take on stays minimal, corrective, and easy to review — so that whatever the version, you can read exactly what we changed and why, without wading through noise. To respect the TinyMCE trademark, we renamed the project to Editor42 and replaced the TinyMCE-branded identifiers throughout the code — for example, the global `window.tinymce` becomes `window.editor42`, and the `tox-tinymce` container class becomes `editor42-t-editor42`. For migration convenience we keep a few compatibility aliases in place, and they can be disabled entirely if you do not want them. The complete, exhaustive list of changes lives in our companion article on [technical details and compatibility](https://editor42.com/docs/about-this-fork/technical-specs), for the readers who need that depth. ## Built to be audited Auditability is not a slogan for us; it shapes how the repository is structured. The brand renaming alone, applied across the entire codebase, would produce an enormous diff that buries the changes that actually matter. So we keep the meaningful, technical work — security fixes, cloud decoupling, and anything we change thereafter — in the `main` branch, on top of a minimal rename, where you can follow each change and compare it against the original. The full brand-string cleanup is then preprocessed from the latest `main` commit into the `editor42` release branch, so that branch diffs cleanly against `main` and you can verify for yourself that the difference consists of nothing but brand strings. Trust, in other words, is something we want you to be able to check rather than take on faith — and that holds for this release and every release after it. ## Documentation we actually maintain We are developers ourselves, so we know that an editor is only as good as its documentation — and that for a component you embed in your own product, the API reference is the part that matters most. So we host the full documentation right here, and we did not stop at republishing what already existed: we went back and updated the parts that had drifted behind the code, closing gaps that had accumulated over time. If you are integrating Editor42, the reference should describe the editor you are actually running — not the one it used to be. ## Where to go next If you want the full technical breakdown — every renamed namespace, every compatibility shim, the security fixes, and the compatibility guarantees — read our [**Technical Details & Compatibility**](https://editor42.com/docs/about-this-fork/technical-specs) article. If you want to see how all of this can be checked rather than taken on trust, read [**Auditing Editor42**](https://editor42.com/docs/about-this-fork/auditing). If you simply want a secure, MIT-licensed rich text editor that behaves exactly like the TinyMCE 6 you already rely on, you are in the right place. --- # Auditing Editor42 > How Editor42 is built to be inspected — the complete delta for each release, a test for every fix, and how to confirm the rebrand changes nothing else. Source: https://editor42.com/docs/about-this-fork/auditing Section: About this fork > Auditing Editor42 **The whole promise of Editor42 is that it is the same proven, battle-tested code as TinyMCE 6.8.6 — the open-source WYSIWYG editor millions already rely on — kept on an MIT license and patched for security. A promise like that is only worth something if it can be checked. So we built the project to be open to inspection, and this page lays out what changed, why, and where anyone could look to confirm it.** We illustrate it with our first release, 42.0.0. ## Verifiable by design We are not asking you to take our word for any of this — and, realistically, we are not asking you to spend your weekend reading diffs either. The point is quieter than that, and we think stronger: everything that matters is small, public, and legible enough that *anyone* can check it. The value of Editor42 is not that you personally audit it; it is that the possibility is always there, for you and for everyone else looking at the same code. Changes that try to hide something tend not to survive that kind of daylight for long — and that is exactly the assurance an open, minimal fork is meant to give you. That only works if the changes stay few and easy to follow. Keeping them that way is the whole design. ## What changed in the first release (42.0.0) ![Commit graph of editor42com/editor42: from the fork of TinyMCE 6.8.6 through the rebrand, cloud detachment, seven security fixes, and the 42.0.0 release](https://editor42.com/img/commit-tree.svg) *The complete `main`-branch history for 42.0.0 — every commit from the fork to the release.* Editor42's source lives in `editor42com/editor42`, and the `main` branch begins from the TinyMCE 6.8.6 source tree — so its commit history *is* the complete delta, with nothing hidden behind a squashed import. For 42.0.0 the substantive history is short enough to take in at a glance, and the commit graph alongside lays it out in full. It opens with four housekeeping commits: the first three rebrand the editor, and the fourth decouples it from the upstream hosted cloud and paid services. After those come the security commits — a DOMPurify dependency upgrade, followed by [six individual CVE fixes](https://editor42.com/docs/security), two cherry-picked from upstream's MIT-licensed patches and four written by us — each in its own commit, so it can be read on its own and traced back to its origin. A single closing commit then sets the version from 6.8.6 to 42.0.0 and updates the changelog. That is the entire substantive history: a rebrand, a cloud detachment, seven security fixes, and a version bump. The whole of it can be read line by line, or seen at a glance by diffing `main` against the TinyMCE 6.8.6 baseline it was forked from. The editor's logic is otherwise identical to the version already running in production for millions of people — and the short history is what lets anyone confirm that for themselves. ## Every fix comes with tests Security fixes are easy to claim and harder to trust on faith, so each one is covered by automated tests. Those tests live in the same public source tree; they can be read next to the fix and run against the code, so the question "does this patch actually do what it says, without breaking anything around it?" has an answer you can see rather than assume. They sit on top of TinyMCE's existing, mature test suite — the same battery of tests that has guarded this editor's behavior for years. ## Confirming the rebrand changed nothing else Alongside `main`, the repository has an `editor42` branch that carries the full brand rename — the `tox-tinymce` container classes, the `window.tinymce` global, and so on — produced by a preprocessor whose rules are spelled out in our [**Technical Details & Compatibility**](https://editor42.com/docs/about-this-fork/technical-specs) article. Comparing `editor42` against `main` produces a large diff by line count, but every changed line is either a brand string or one of a handful of compatibility shim lines at the very end. The same holds at the level of the shipped files: the build repository `editor42com/editor42-dist` publishes an `editor42.js` / `editor42.min.js` build from each branch — TinyMCE-named internals from `main`, the full rename from `editor42` — and the two readable builds differ only in those same brand strings and trailing shims. Plenty of surface churn, no change in behavior — visible right down to the file your browser actually loads. Here is what that divergence actually looks like. Below are representative spots from the shipped minified bundles: every ~~red~~ token is a string that the `main` build ships — the same string TinyMCE's own `tinymce.min.js` carries — and the **green** token beside it is exactly what the `editor42` build puts there instead. The code on either side of each swap is identical, character for character. ...e.hasAttribute("~~data-mce-bogus~~**data-editor42-bogus**"),Zo=e=>Vo(e)&&"TABLE"===e.tagName,... ...return GA(o),o},oR=(e,t)=>e.setData("text/html",t),rR="~~x-tinymce/html~~**x-editor42/html**",sR=N(rR),... ...title:t}),mn(r,"~~tox-edit-area~~**editor42-t-edit-area**\_\_iframe"),r})(e.id,n,Ol(e),o).dom;... ...o.select("\*\[~~data-mce-fragment~~**data-editor42-fragment**\]"),(e=>{if(C(n\[e.nodeName.toLowerCase()\])... ...default:"~~mce-item-table~~**editor42-m-item-table**"}),t("visual_anchor_class",{processor:"string",... ...WT.addClass(t,"~~mce-content-body~~**editor42-m-content-body**"),e.contentDocument=n=document,... ...default:"~~mceNonEditable~~**editor42NonEditable**"}),t("editable_class",{processor:"string",... ...o=\`content${e.editorManager.suffix}.css\`;return q(t,(t=>(e=>~~tinymce~~**editor42**.Resource.has(... Diff sample of the `main` and `editor42` builds of `editor42.min.js` ## The same, release after release The first release is the only one that carries those opening rebrand-and-detachment commits. After 42.0.0, each release adds just the new fixes — with their tests — on top of the one before it, and ends with the same kind of commit that bumps the version and updates the changelog. So the history stays short and the picture stays the same: a small, readable set of changes between any version and the last, open to anyone who cares to look. ## Where to go next For the exact rename rules, the compatibility shims, and the full compatibility guarantees, see our [**Technical Details & Compatibility**](https://editor42.com/docs/about-this-fork/technical-specs) article. If you want the reasoning behind the project — why an MIT-licensed fork exists at all — start with [**Motivation & Goals**](https://editor42.com/docs/about-this-fork/motivation). The full list of fixed vulnerabilities, release by release, lives on the [**Security**](https://editor42.com/docs/security) page. --- # Technical Details & Compatibility > How Editor42 renames TinyMCE's identifiers: the rules in short, then every renamed class, global, hook, command, attribute and MIME type, and the versioning. Source: https://editor42.com/docs/about-this-fork/technical-specs Section: About this fork > Technical specs Editor42 releases are built from the `editor42` branch of the repository, where TinyMCE-branded identifiers are renamed to their Editor42 equivalents by a preprocessor. This page describes that rename **in short** first — a handful of rules that let you predict any name — and then gives the **complete reference** for every namespace, along with the compatibility shims that keep old names working. ## Versioning Editor42's own version is **42.0.0**, and the standard version fields report it like this: | Editor | `majorVersion` | `minorVersion` | |---|---|---| | TinyMCE 6.8.6 | `'6'` | `'8.6'` | | Editor42 42.0.0 | `'6'` | `'42.0.0'` | ### Why `majorVersion` stays `'6'` Because `majorVersion` is the **API version**, not the editor's own release number. It has always answered one question — *which TinyMCE API am I talking to?* — and integrations branch on it to decide whether `editor.options` exists, how a plugin registers itself, which skin class names to expect. It is a compatibility contract, not a label. Putting `42` there instead would have silently broken third-party plugins, and any other code that branches on the version. So if you need to tell the editors apart, check the global instead: ```js if (window.editor42) { /* Editor42 (either branch) */ } ``` ## How the rebrand works (in short) The rename is a mechanical, predictable substitution applied to the `main` source to produce the `editor42` branch. At a glance: | Category | TinyMCE | Editor42 | |---|---|---| | Global object | `window.tinymce` | `window.editor42` | | UI / skin CSS classes | `tox-*` | `editor42-t-*` | | Content CSS classes | `mce-*` | `editor42-m-*` | | DOM attributes | `data-mce-*` | `data-editor42-*` | | Commands | `mce*` | `editor42*` | | Internal ids / markers | `mce_*`, `mce:*` | `editor42_*`, `editor42:*` | | MIME type | `x-tinymce/html` | `x-editor42/html` | | Skin folders | `skins/ui/tinymce-5` | `skins/ui/editor42-5` | The two CSS namespaces get a one-letter tag — **t** for the UI toolkit, **m** for content markup. The rename reaches even the bare `tox` wrapper class — it becomes `editor42-t` — and lowercase ids such as `mcepastebin` (now `editor42pastebin`). The rename is exhaustive: no `tox`, `mce`, `data-mce-`, or `data-ephox-` brand token survives in the shipped build. The only old names that linger are the deliberate compatibility aliases (`window.tinymce` / `window.tinyMCE`, covered below) and non-brand skin names like `oxide` that never carried a brand string. The complete reference below covers every case. ## Complete rename reference Original names are shown as they appear in TinyMCE 6.8.6 (and on the `main` branch); the replacement is what ships on the `editor42` branch and in the [editor42-dist](https://github.com/editor42com/editor42-dist) build. ### Global API and compatibility shims | Original (TinyMCE) | Editor42 | Compatibility | |---|---|---| | `window.tinymce`, `window.tinyMCE` | `window.editor42` | `window.tinymce` and `window.tinyMCE` are kept as deprecated aliases | | `window.tinyMCEPreInit` | `window.editor42PreInit` | renamed only — the editor reads `window.editor42PreInit` (or `window.editor42`); the old name is ignored | `window.editor42` is **always** defined. Unless you opt out, Editor42 also sets `window.tinymce` and `window.tinyMCE` to the same object (only when they are not already defined), so existing integrations keep working untouched. To suppress those aliases — for example, to confirm your code no longer depends on them — set the flag before the script loads: ```html ``` ### Editor UI CSS classes (the `tox` namespace) These classes style the editor *chrome* — toolbars, menus, dialogs, buttons. Every `tox` token is renamed: the `tox-` prefix becomes `editor42-t-`, and the bare `tox` wrapper class becomes `editor42-t`. | Original (TinyMCE) | Editor42 | |---|---| | `tox` (wrapper on every UI element) | `editor42-t` | | `tox-tinymce` | `editor42-t-editor42` | | `tox-tinymce-aux` | `editor42-t-editor42-aux` | | `tox-tinymce-inline` | `editor42-t-editor42-inline` | | `tox-*` (all other UI classes, e.g. `tox-toolbar`, `tox-menu`, `tox-dialog`, `tox-tbtn`) | `editor42-t-*` (e.g. `editor42-t-toolbar`, `editor42-t-menu`, `editor42-t-dialog`, `editor42-t-tbtn`) | So the editor's root element, previously `class="tox tox-tinymce"`, now reads `class="editor42-t editor42-t-editor42"`. If you have custom CSS targeting the editor UI, this is the namespace to update — note in particular that a bare `.tox` selector no longer matches anything; use `.editor42-t`. ### Editable-content CSS classes (the `mce` namespace) These classes appear inside the editable area and on content the editor generates. | Original (TinyMCE) | Editor42 | |---|---| | `mce-*` (e.g. `mce-item-table`, `mce-content-body`, `mce-visual-caret`, `mce-pastebin`) | `editor42-m-*` (e.g. `editor42-m-item-table`, `editor42-m-content-body`, `editor42-m-visual-caret`, `editor42-m-pastebin`) | ### DOM data attributes | Original (TinyMCE) | Editor42 | |---|---| | `data-mce-*` (e.g. `data-mce-href`, `data-mce-type`, `data-mce-bogus`, `data-mce-selected`) | `data-editor42-*` (e.g. `data-editor42-href`, `data-editor42-type`, `data-editor42-bogus`, `data-editor42-selected`) | | `data-ephox-*` (e.g. `data-ephox-embed-iri` in media embeds) | `data-editor42-*` (e.g. `data-editor42-embed-iri`) | ### Editor commands Commands passed to `editor.execCommand(...)`. Every `mce`-prefixed command — core and plugin — is renamed; command names are matched case-insensitively. | Original (TinyMCE) | Editor42 | |---|---| | `mceInsertContent`, `mceLink`, `mceInsertLink`, `mceToggleFormat`, `mceFocus`, … | `editor42InsertContent`, `editor42Link`, `editor42InsertLink`, `editor42ToggleFormat`, `editor42Focus`, … | ### Internal markers and ids Identifiers the editor generates while editing. You normally do not reference these directly, but they show up if you inspect the DOM or serialized content. | Original (TinyMCE) | Editor42 | |---|---| | `mce_*` (auto-generated ids, e.g. `mce_marker`, `mce_textpattern`, `mce_host`) | `editor42_*` (e.g. `editor42_marker`, `editor42_textpattern`, `editor42_host`) | | `_mce_caret` | `_editor42_caret` | | `mce:protected` | `editor42:protected` | | `mcepastebin` (paste-bin element id) | `editor42pastebin` | | `mceclip` (pasted-image id prefix: `mceclip0`, `mceclip1`, …) | `editor42clip` (`editor42clip0`, `editor42clip1`, …) | ### Option defaults that embed class names A few configuration options default to class names that follow the rename. If you set these options explicitly you control the value; the table shows only the **defaults**. | Option | Default in TinyMCE | Default in Editor42 | |---|---|---| | `noneditable_class` | `mceNonEditable` | `editor42NonEditable` | | `editable_class` | `mceEditable` | `editor42Editable` | ### MIME type | Original (TinyMCE) | Editor42 | |---|---| | `x-tinymce/html` | `x-editor42/html` | ### Skin directories Editor42 ships the same skins as TinyMCE 6, at the same paths — the **default skin path is unchanged**, so the editor still loads `oxide` (UI) and `default` (content) exactly where it always did, and an integration that doesn't opt into another skin needs no changes. The only renamed skins are the ones suffixed `-5`: these are TinyMCE 5 *nostalgia* skins that recreate the TinyMCE 5 look, so their `tinymce` brand string becomes `editor42` like everywhere else. | Original (TinyMCE) | Editor42 | |---|---| | `skins/ui/oxide` (default UI skin) | unchanged | | `skins/ui/oxide-dark` | unchanged | | `skins/ui/tinymce-5` | `skins/ui/editor42-5` | | `skins/ui/tinymce-5-dark` | `skins/ui/editor42-5-dark` | | `skins/content/default` (default content skin) | unchanged | | `skins/content/dark` | unchanged | | `skins/content/document` | unchanged | | `skins/content/writer` | unchanged | | `skins/content/tinymce-5` | `skins/content/editor42-5` | | `skins/content/tinymce-5-dark` | `skins/content/editor42-5-dark` | ### Identifiers intentionally left unchanged The rename is surgical: a couple of identifiers are left exactly as they were because they carry no brand string — so behavior that depends on them is unaffected. | Identifier | Why it stays | |---|---| | `oxide`, `oxide-dark` (skin names) | Not brand-bearing | The `editor42` branch on [Editor42 GitHub](https://github.com/editor42com/editor42) ships the rebranded source. The `main` branch contains the full source with all functional changes but without these identifier replacements. The [editor42-dist](https://github.com/editor42com/editor42-dist) repository provides pre-built distribution files with the same structure. ## The `main` branch: a faithful TinyMCE baseline The `main` branch carries the complete Editor42 source with every functional and security fix applied — and **nothing else touched**. None of the rebranding above reaches it: classes, variables, hooks, MIME types, commands, and DOM attributes all keep their original TinyMCE names. There are no breaking changes of any kind. Apart from the fixes themselves, `main` is API-for-API and behavior-for-behavior the same TinyMCE 6.8.6 it descends from. That fidelity makes `main` the branch to reach for in the unlikely event that the `editor42` build ever behaves unexpectedly. Both builds expose **both** globals — `window.tinymce` / `window.tinyMCE` and `window.editor42` — as aliases of the same editor, so your integration runs unchanged whichever build it loads. Swap one build for the other, leave the rest of your code as-is, and compare: if the behavior differs, the cause sits in the rebranding layer; if it doesn't, it lives in the editor logic both builds share. ## See also - [**Motivation & Goals**](https://editor42.com/docs/about-this-fork/motivation) — why an MIT-licensed, security-maintained fork exists. - [**Auditing Editor42**](https://editor42.com/docs/about-this-fork/auditing) — how to confirm the rebrand changes nothing but brand strings. - [**Security**](https://editor42.com/docs/security) — every fixed CVE and how to report a vulnerability. --- # Who we are > The team behind Editor42: EdSDK, who have worked with embeddable rich text editors since 2008, run Editor42 in their own products and keep it MIT-licensed. Source: https://editor42.com/docs/about-this-fork/who-we-are Section: About this fork > Who we are **Editor42 is built and maintained by EdSDK, a development team that has worked with embeddable rich text editors since 2008.** This is familiar ground for us. Rich text editing is the work we do; the editor we forked is one we have shipped in our own products for years; and Editor42 is the version of it we wanted for ourselves, made public so anyone can use it on the same terms. ## Decades of editor work Since 2008 we have built integrations, plugins, and tooling around the two editors most teams reach for: TinyMCE and CKEditor. It is detailed, demanding work, and staying with it this long has taught us how these editors behave inside real products and what it takes to keep them dependable. It is also where our own developer products, such as N1ED and Flmngr, come from: tools for teams who needed those editors to do more than they do out of the box. Editor42 grew straight out of that experience. When the open-source TinyMCE 6 line reached end of life and later versions moved to a GPL-or-commercial license, the teams we work with hit a concrete problem — and so did we. We already knew the editor inside and out, which put us in a good position to keep it alive properly rather than leave it carrying known vulnerabilities. ## We run on it ourselves The strongest thing we can say about Editor42's quality is that we depend on it too. This is not a project we maintain at arm's length for other people to use — it is the editor we run inside our own products. If a release breaks something, or a fix introduces a regression, we are the first to feel it, in software we are responsible for and ship to our own users. That alignment is the point: our reason to keep Editor42 solid is built into our own work, so it holds steady release after release. ## Open to everyone Editor42 began as something we built for the teams we work with: they needed a permissively-licensed, secure editor and could not wait for one to materialize. Rather than solve that quietly, one client at a time, we turned it into a public project that anyone can adopt on exactly the same footing. What started as an answer for our own customers is now simply available to everyone — free, open, and maintained in the open. ## MIT, and it stays that way The whole reason Editor42 exists is the MIT license, so putting that in question would defeat the point. Editor42 is MIT-licensed, and it will stay MIT-licensed — we have no plans, now or down the road, to relicense it, gate it behind a commercial tier, or move features behind a paywall. We are a commercial company and we are upfront about that, but Editor42 itself is a free, open-source project and is meant to remain one, release after release. ## Get in touch Using Editor42 in your product, weighing it up for a project, or want to talk to us about licensing or working together? Email **[hello@editor42.com](mailto:hello@editor42.com)** — we read everything that comes in. For anything security-related, write to [infosec@editor42.com](mailto:infosec@editor42.com) instead (see the [Security](https://editor42.com/docs/security) page), and for ordinary bugs the [GitHub issue tracker](https://github.com/editor42com/editor42/issues) is the fastest route. ## Where to go next - [**Motivation & Goals**](https://editor42.com/docs/about-this-fork/motivation) — why an MIT-licensed, security-maintained fork exists, and who it is for. - [**Auditing Editor42**](https://editor42.com/docs/about-this-fork/auditing) — how the promises on this page can be checked rather than taken on trust. --- # Security > Editor42 security policy — every CVE and security bug fixed in each release, and how to privately report a vulnerability to the Editor42 team. Source: https://editor42.com/docs/security **Security is the reason Editor42 exists.** The open-source TinyMCE 6 line reached end of life with known, publicly documented vulnerabilities left in place and no upstream fixes coming. Editor42's founding commitment is to keep that editor — under its permissive MIT license — on a secure baseline. This page is the canonical record of that work: every vulnerability fixed in each Editor42 release, and how to reach us privately when you find something new. Every security fix ships in its own commit with regression tests, is listed in the [changelog](https://editor42.com/docs/changelog), and is added to the table below. How those commits can be read and verified against the TinyMCE source is described in [Auditing Editor42](https://editor42.com/docs/about-this-fork/auditing). ## Fixed vulnerabilities As of the latest release, all known CVEs and security-related bugs are fixed: **there are no publicly known vulnerabilities affecting Editor42 that remain unfixed**. We keep watch on newly disclosed vulnerabilities and ship fixes release after release. ### Fixed in Editor42 42.0.0 The first release closes the six publicly documented CVEs that were left open in the last MIT-licensed TinyMCE, plus a security upgrade of the bundled DOMPurify sanitizer. Two of the CVE fixes are cherry-picked from upstream's MIT-licensed patches; the other four are original fixes written by the Editor42 team. Each fix is its own commit in [`editor42com/editor42`](https://github.com/editor42com/editor42), so it can be read and verified on its own: | Advisory | Security fix | Commit | |---|---|---| | — | Upgraded DOMPurify from 3.1.7 to 3.4.7, removed the patch-package workaround. | [`98e985b`](https://github.com/editor42com/editor42/commit/98e985b2ca) | | [CVE-2024-29881](https://nvd.nist.gov/vuln/detail/CVE-2024-29881) | Default `convert_unsafe_embeds` to `true`. Cherry-picked from upstream's MIT-licensed patch `70a5a95fce` (2024-02-09). | [`76e272b`](https://github.com/editor42com/editor42/commit/76e272b1be) | | [CVE-2024-29203](https://nvd.nist.gov/vuln/detail/CVE-2024-29203) | Default `sandbox_iframes` to `true`, add exclusions. Cherry-picked from upstream's MIT-licensed patch `94acea35f3` (2024-02-26). | [`6795474`](https://github.com/editor42com/editor42/commit/6795474ca6) | | [CVE-2026-47762](https://nvd.nist.gov/vuln/detail/CVE-2026-47762) | Fixed stored XSS via `mce:protected` comments. Original fix by the Editor42 team. | [`4e77fb1`](https://github.com/editor42com/editor42/commit/4e77fb17b6) | | [CVE-2026-47759](https://nvd.nist.gov/vuln/detail/CVE-2026-47759) | Fixed stored XSS via `data-mce-`prefixed attributes on input. Original fix by the Editor42 team. | [`dc6c7b2`](https://github.com/editor42com/editor42/commit/dc6c7b2e2a) | | [CVE-2026-47761](https://nvd.nist.gov/vuln/detail/CVE-2026-47761) | Fixed XSS via `data-mce-object` injection in the media plugin. Original fix by the Editor42 team. | [`4892c95`](https://github.com/editor42com/editor42/commit/4892c95260) | | [CVE-2026-47760](https://nvd.nist.gov/vuln/detail/CVE-2026-47760) | Fixed XSS via namespace scope confusion in nested SVG content. Original fix by the Editor42 team. | [`c38d405`](https://github.com/editor42com/editor42/commit/c38d405672) | The advisories and fixes are described in upstream TinyMCE terms (`data-mce-…`, `mce:protected`); in the rebranded `editor42` build the same internals carry the `editor42` names — see [Technical Details & Compatibility](https://editor42.com/docs/about-this-fork/technical-specs). Both the `editor42` and `main` builds contain every fix. ## Reporting a vulnerability If you believe you have found a security issue in Editor42 — in any build or branch of the editor, in this website, or in our documentation examples — please report it to us privately: > **Contact** > > Email **[infosec@editor42.com](mailto:infosec@editor42.com)**. Please do not open a public GitHub issue or disclose the problem publicly before we have had a chance to fix it. A useful report ideally includes: - the Editor42 version and build (`editor42` or `main`) you tested; - a minimal reproduction — the editor configuration plus the content or steps that trigger the issue; - what an attacker gains (the impact as you understand it); - how you would like to be credited, if at all. What you can expect from us: - we read every report and reply as quickly as we can; - if the issue is confirmed, we work on a fix — shipped as its own commit with regression tests, listed in the [changelog](https://editor42.com/docs/changelog) and on this page; - credit for the find, unless you prefer to stay anonymous. We ask that you give us a reasonable amount of time to investigate and release a fix before any public disclosure. We do not currently run a paid bug-bounty program. This contact is also published in machine-readable form at [editor42.com/.well-known/security.txt](https://editor42.com/.well-known/security.txt) (RFC 9116). For ordinary, non-security bugs, please use the public [GitHub issue tracker](https://github.com/editor42com/editor42/issues) instead. For general, non-security questions — licensing, using Editor42 in your product, or anything else — email [hello@editor42.com](mailto:hello@editor42.com). Please keep [infosec@editor42.com](mailto:infosec@editor42.com) for security reports only, so the two don't get mixed up. --- # License > Editor42's MIT license, and the legal notices of an independent project derived from TinyMCE's MIT-licensed code. Source: https://editor42.com/docs/license Editor42 is free software under the **MIT License**, the permissive license TinyMCE used up to version 6. You can use it in commercial, proprietary and open-source products, change it and ship it inside your own software, free of charge and with no copyleft obligations. What the license asks in return is short: keep its copyright and permission notice with every copy or substantial portion of Editor42, and take the software as it is, without a warranty. The notice names two copyright holders, Tiny Technologies, Inc. for the original TinyMCE code and the Editor42 contributors, because Editor42 is built from TinyMCE 6.8.6, the last MIT-licensed release. It contains no GPL-licensed code. Editor42 is an independent project, not affiliated with, endorsed by or sponsored by Tiny Technologies, Inc., whose registered trademark TinyMCE is. It will stay MIT-licensed: there is no commercial tier and no plan to relicense it. - [MIT License](https://editor42.com/docs/license/mit-license): The license text, and what it lets you do with Editor42. - [Legal Notices](https://editor42.com/docs/license/legal): An independent project: the trademarks it names, its attribution, no warranty. --- # MIT License > Editor42 is distributed under the MIT License — free for commercial, proprietary, and open-source use. Source: https://editor42.com/docs/license/mit-license Section: License > MIT License Editor42 is distributed under the **MIT License**. You are free to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of Editor42 in any project — commercial, proprietary, or open-source — with no copyleft restrictions. ## Why MIT? TinyMCE moved from MIT to GPL starting with v7. Editor42 is forked from the last MIT-licensed release (v6), ensuring you can continue using a maintained, secure rich text editor under a permissive license. Editor42 contains no GPL-licensed code. Every line of code in Editor42 originates from the MIT-licensed TinyMCE source or was written independently by Editor42 contributors. For the full rationale behind the fork — why it exists, who it is for, and the principles guiding each release — see [Motivation & Goals](https://editor42.com/docs/about-this-fork/motivation). ## MIT License ```text MIT License Copyright (c) 2022 Ephox Corporation DBA Tiny Technologies, Inc. Copyright (c) 2026 Editor42 contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` --- # API Reference > Editor42 API reference — configuration options, editor methods, events, commands, formatting, and UI components for the open-source rich text editor. Source: https://editor42.com/api Complete reference for configuring and programming Editor42, the free, open-source WYSIWYG HTML editor. - [**Configuration Options**](https://editor42.com/api/configuration) — all options passed to `editor42.init()`, from basic setup to advanced content filtering - [**Editor API**](https://editor42.com/api/editor) — methods, properties, and sub-APIs for programmatic control of editor instances - [**Commands**](https://editor42.com/api/commands) — built-in commands for formatting, structure, and editor actions - [**Events**](https://editor42.com/api/events) — every event the editor fires, with payload types and usage examples - [**Content Formatting**](https://editor42.com/api/formatting) — the Formatter API for applying, removing, toggling, and querying formats - [**UI Components**](https://editor42.com/api/ui-components) — register custom toolbar buttons, menu items, context toolbars, sidebars, and more --- # Editor API > Editor42 Editor API — methods, properties, and sub-APIs for programmatic control of the open-source rich text editor. Source: https://editor42.com/api/editor Every Editor42 instance exposes a rich API for programmatic control. You can access the active editor or look one up by ID: ```js // The currently focused editor const editor = editor42.activeEditor; // By element ID const editor = editor42.get('my-editor'); ``` All examples below assume `editor` holds an Editor42 instance. ## Content Methods ### setContent / getContent ```js // Set HTML content editor.setContent('

Hello, world!

'); // Get HTML content const html = editor.getContent(); // Get plain text const text = editor.getContent({ format: 'text' }); // Get content as AST node tree const tree = editor.getContent({ format: 'tree' }); ``` `setContent` fires `BeforeSetContent` and `SetContent` events. `getContent` fires `BeforeGetContent` and `GetContent` events. ### insertContent ```js // Insert HTML at the current caret position editor.insertContent('Logo'); ``` ### resetContent Resets the editor content, undo history, and dirty state. Pass a string to set new content, or omit it to restore the original content the editor was initialized with. ```js // Reset to initial content editor.resetContent(); // Reset with new content editor.resetContent('

Fresh start

'); ``` ### load / save ```js // Load content from the original textarea/element editor.load(); // Save content back to the original textarea/element editor.save(); ``` `save` fires a `SaveContent` event. ## Command System Execute built-in or custom commands to apply formatting and trigger editor actions. ```js // Apply bold editor.execCommand('Bold'); // Insert horizontal rule editor.execCommand('InsertHorizontalRule'); // Check if bold is active at the caret const isBold = editor.queryCommandState('Bold'); // Get current font name const font = editor.queryCommandValue('FontName'); ``` ### Custom commands Register your own commands with `addCommand`, and optionally provide state and value handlers: ```js editor.addCommand('myCustomAction', (ui, value) => { console.log('Custom action fired with value:', value); }); editor.addQueryStateHandler('myCustomAction', () => { return editor.dom.getParent(editor.selection.getNode(), '.custom') !== null; }); editor.addQueryValueHandler('myCustomAction', () => { return editor.dom.getAttrib(editor.selection.getNode(), 'data-custom'); }); // Execute the custom command editor.execCommand('myCustomAction', false, 'hello'); ``` ## State & Dirty Tracking The dirty flag tracks whether content has changed since the last save or initialization. ```js // Check if content has been modified if (editor.isDirty()) { console.log('Unsaved changes'); } // Manually mark as dirty or clean editor.setDirty(true); editor.setDirty(false); ``` Setting dirty from `false` to `true` fires a `dirty` event. ## DOM Access Access the editor's internal DOM elements: ```js // Outer container (includes toolbar, iframe, status bar) const container = editor.getContainer(); // Content area container (holds the iframe or inline editable) const contentArea = editor.getContentAreaContainer(); // Original textarea/div that was replaced const original = editor.getElement(); // Iframe internals const win = editor.getWin(); const doc = editor.getDoc(); const body = editor.getBody(); ``` ## Event Handling Editor42 uses an observable event system. Bindable on any editor instance. ```js // Listen for content changes editor.on('change', (e) => { console.log('Content changed'); }); // One-time listener editor.once('init', () => { console.log('Editor initialized'); }); // Remove a specific listener const handler = (e) => { /* ... */ }; editor.on('NodeChange', handler); editor.off('NodeChange', handler); // Dispatch a custom event editor.dispatch('myCustomEvent', { data: 42 }); // Check if an event has listeners if (editor.hasEventListeners('change')) { // ... } ``` ## Keyboard Shortcuts Register custom keyboard shortcuts using pattern strings. Available modifiers: `ctrl`, `alt`, `shift`, `meta`, `access` (maps to Ctrl on Windows/Linux, Ctrl+Option on macOS). ```js // Bind Ctrl+Alt+O to a command editor.addShortcut('ctrl+alt+o', 'Open dialog', 'myDialogCommand'); // Bind to a callback function editor.addShortcut('meta+shift+x', 'Custom action', () => { console.log('Shortcut triggered'); }); ``` ## Editor Properties | Property | Type | Description | |---|---|---| | `id` | `string` | Editor instance ID. | | `plugins` | `Record` | Map of loaded plugin instances. | | `documentBaseURI` | `URI` | URI object for the document base URL. | | `baseURI` | `URI` | URI object for the API location. | | `contentCSS` | `string[]` | CSS files loaded into the iframe. | | `contentStyles` | `string[]` | CSS style strings added to the iframe head. | | `ui` | `EditorUi` | Editor UI components (includes `ui.registry`). | | `mode` | `EditorMode` | Editor mode API. | | `options` | `EditorOptions` | Editor options API. | | `editorUpload` | `EditorUpload` | Editor upload API. | | `dom` | `DOMUtils` | DOM utility instance. | | `selection` | `EditorSelection` | Selection API instance. | | `formatter` | `Formatter` | Formatter API instance. | | `undoManager` | `UndoManager` | Undo/redo manager. | | `windowManager` | `WindowManager` | Window/dialog manager. | | `notificationManager` | `NotificationManager` | Notification manager. | | `parser` | `DomParser` | DOM parser instance. | | `serializer` | `DomSerializer` | DOM serializer instance. | | `schema` | `Schema` | Schema instance. | | `shortcuts` | `Shortcuts` | Shortcuts manager. | | `annotator` | `Annotator` | Annotator API. | | `inline` | `boolean` | True if editor is in inline mode. | | `hidden` | `boolean` | True if editor is hidden. | | `initialized` | `boolean` | True if editor has been initialized. | | `readonly` | `boolean` | True if editor is in readonly mode. | | `hasVisual` | `boolean` | Current visual aids state. | ## Editor Methods ### Initialization & Lifecycle | Method | Signature | Description | |---|---|---| | `render` | `() => void` | Renders the editor / adds it to the page. | | `remove` | `() => void` | Removes the editor from the DOM and the `editor42` collection. | | `destroy` | `(automatic?: boolean) => void` | Destroys the editor instance, removing all events and references. Called automatically on page unload. | | `focus` | `(skipFocus?: boolean) => void` | Focuses the editor. When `skipFocus` is true, sets as active editor without DOM focus. | | `hasFocus` | `() => boolean` | Returns true if the editor has real keyboard focus. | | `show` | `() => void` | Shows the editor and hides the replaced textarea/div. | | `hide` | `() => void` | Hides the editor and shows the replaced textarea/div. | | `isHidden` | `() => boolean` | Returns true if the editor is hidden. | ### Content | Method | Signature | Description | |---|---|---| | `setContent` | `(content: string, args?: object) => string` | Sets content. Also accepts AstNode for tree format. Fires BeforeSetContent/SetContent events. | | `getContent` | `(args?: object) => string` | Gets content. Use `{ format: 'text' }` for plain text, `{ format: 'tree' }` for AST node. Fires BeforeGetContent/GetContent events. | | `insertContent` | `(content: string, args?: object) => void` | Inserts HTML content at caret position. | | `resetContent` | `(initialContent?: string) => void` | Resets content, undo history, and dirty state. If no content specified, resets to initial start content. | | `load` | `(args?: object) => string` | Loads content from the original textarea/element. | | `save` | `(args?: object) => string` | Saves content back to the original textarea/element. Fires SaveContent event. | ### Commands | Method | Signature | Description | |---|---|---| | `execCommand` | `(cmd: string, ui?: boolean, value?: any, args?: object) => boolean` | Executes a registered command. | | `queryCommandState` | `(cmd: string) => boolean` | Returns command-specific state (e.g., whether Bold is active). | | `queryCommandValue` | `(cmd: string) => string` | Returns command-specific value (e.g., current FontName). | | `queryCommandSupported` | `(cmd: string) => boolean` | Returns true if the command is supported. | | `addCommand` | `(name: string, callback: (ui: boolean, value: any) => boolean \| void, scope?: object) => void` | Registers a custom command. | | `addQueryStateHandler` | `(name: string, callback: () => boolean, scope?: object) => void` | Registers a custom query state handler. | | `addQueryValueHandler` | `(name: string, callback: () => string, scope?: object) => void` | Registers a custom query value handler. | ### Dirty State | Method | Signature | Description | |---|---|---| | `isDirty` | `() => boolean` | Returns true if content has been modified since last save or initialization. | | `setDirty` | `(state: boolean) => void` | Explicitly sets dirty state. Fires `dirty` event when changing from clean to dirty. | ### DOM Access | Method | Signature | Description | |---|---|---| | `getContainer` | `() => HTMLElement` | Returns the editor's container element (includes all UI, iframe, etc.). | | `getContentAreaContainer` | `() => HTMLElement` | Returns the content area container (holds iframe or editable element). | | `getElement` | `() => HTMLElement` | Returns the original textarea/div element that was replaced. | | `getWin` | `() => Window` | Returns the iframe's window object. | | `getDoc` | `() => Document` | Returns the iframe's document object. | | `getBody` | `() => HTMLElement` | Returns the root editable element (iframe's body). | ### Editable Root | Method | Signature | Description | |---|---|---| | `setEditableRoot` | `(state: boolean) => void` | Changes the editable state of the editor's root element. | | `hasEditableRoot` | `() => boolean` | Returns the current editable state of the root element. | ### Events | Method | Signature | Description | |---|---|---| | `on` | `(name: string, callback: Function) => void` | Binds an event listener. | | `off` | `(name?: string, callback?: Function) => void` | Unbinds event listener(s). | | `once` | `(name: string, callback: Function) => void` | Binds a one-time event listener. | | `fire` | `(name: string, args?: object) => object` | Fires/dispatches an event (legacy name). | | `dispatch` | `(name: string, args?: object) => object` | Fires/dispatches an event. | | `hasEventListeners` | `(name: string) => boolean` | Returns true if the event has listeners. | ### Miscellaneous | Method | Signature | Description | |---|---|---| | `nodeChanged` | `(args?: object) => void` | Dispatches NodeChange event to all observers. Call when you need to update UI states. | | `translate` | `(text: string) => string` | Translates a string using the language pack. | | `hasPlugin` | `(name: string, loaded?: boolean) => boolean` | Checks if a plugin is configured (and optionally loaded). | | `convertURL` | `(url: string, name: string, elm?: string \| Element) => string` | URL converter function, called when elements with URLs are added. | | `addVisual` | `(elm?: HTMLElement) => void` | Adds visual aids for tables, anchors, etc. | | `addShortcut` | `(pattern: string, desc: string, cmdFunc: string \| Function, scope?: object) => void` | Adds a keyboard shortcut. | | `setProgressState` | `(state: boolean, time?: number) => void` | Shows/hides a progress throbber. | | `uploadImages` | `() => Promise` | Uploads all data URI/blob URI images to the server. | | `getParam` | `(name: string, defaultVal?: any, type?: string) => any` | Returns a configuration parameter by name. Deprecated: use `editor.options.get()` instead. | ## UndoManager API Accessible via `editor.undoManager`. Manages undo/redo history for the editor. | Property/Method | Signature | Description | |---|---|---| | `data` | `UndoLevel[]` | Array of undo levels. | | `typing` | `boolean` | Whether the user is currently typing. | | `add` | `(level?: Partial, event?: EditorEvent) => UndoLevel \| null` | Adds an undo level. | | `dispatchChange` | `() => void` | Dispatches a change event. | | `beforeChange` | `() => void` | Stores a snapshot before changes. | | `undo` | `() => UndoLevel \| undefined` | Undoes the last change. | | `redo` | `() => UndoLevel \| undefined` | Redoes the last undone change. | | `clear` | `() => void` | Clears all undo levels. | | `reset` | `() => void` | Resets the undo manager. | | `hasUndo` | `() => boolean` | Returns true if there are undo levels. | | `hasRedo` | `() => boolean` | Returns true if there are redo levels. | | `transact` | `(callback: () => void) => UndoLevel \| null` | Creates a single undo level from multiple changes. | | `ignore` | `(callback: () => void) => void` | Executes changes without creating an undo level. | | `extra` | `(callback1: () => void, callback2: () => void) => UndoLevel \| null` | Creates an extra undo level by first applying callback1, storing it, then applying callback2. | Use `transact` to batch multiple DOM changes into a single undoable action: ```js editor.undoManager.transact(() => { editor.insertContent('

Step 1

'); editor.insertContent('

Step 2

'); }); // A single Ctrl+Z will undo both insertions ``` Use `ignore` when you need to make changes that should not appear in the undo history: ```js editor.undoManager.ignore(() => { editor.dom.addClass(editor.getBody(), 'processing'); }); ``` ## Editor Mode API Accessible via `editor.mode`. Controls whether the editor is editable or read-only. ```js // Switch to readonly mode editor.mode.set('readonly'); // Switch back to design (editable) mode editor.mode.set('design'); // Get the current mode const currentMode = editor.mode.get(); // 'design' or 'readonly' ``` --- # Commands > All built-in commands for the Editor42 WYSIWYG editor — execute, query state, and query value for formatting, lists, tables, and more. Source: https://editor42.com/api/commands Editor42 includes a command system for programmatically controlling the editor. Commands cover formatting, clipboard operations, content manipulation, undo/redo, and more. There are three types of command calls: - **`execCommand(name, showUI?, value?)`** — executes a command - **`queryCommandState(name)`** — returns `true` if a toggle command is currently active - **`queryCommandValue(name)`** — returns the current value for a command ```js // Execute a command editor42.activeEditor.execCommand('Bold'); // Execute a command with a value editor42.activeEditor.execCommand('ForeColor', false, '#ff0000'); // Query whether bold is active at the caret position const isBold = editor42.activeEditor.queryCommandState('Bold'); // Query the current font name at the caret position const font = editor42.activeEditor.queryCommandValue('FontName'); ``` ## Exec commands ### Alignment | Command | Description | Value | |---|---|---| | `JustifyLeft` | Aligns content to the left | — | | `JustifyCenter` | Aligns content to the center | — | | `JustifyRight` | Aligns content to the right | — | | `JustifyFull` | Justifies content (full width) | — | | `JustifyNone` | Removes alignment | — | ### Clipboard | Command | Description | Value | |---|---|---| | `Cut` | Cuts selected content to clipboard | — | | `Copy` | Copies selected content to clipboard | — | | `Paste` | Pastes clipboard content | — | ### Content | Command | Description | Value | |---|---|---| | `editor42Cleanup` | Cleans up the editor content (re-serializes) | — | | `insertImage` | Inserts an image element | URL string | | `insertHorizontalRule` | Inserts a horizontal rule (`
`) | — | | `insertText` | Inserts plain text at caret position | text string | | `insertHTML` | Inserts HTML at caret position | HTML string | | `editor42InsertContent` | Inserts content at caret position | HTML string | | `editor42SetContent` | Sets the entire editor content | HTML string | | `editor42ReplaceContent` | Replaces content (`{$selection}` placeholder for current selection text) | HTML string | | `editor42NewDocument` | Resets editor to new document (empty content or configured `new_document_content`) | — | ### Formatting | Command | Description | Value | |---|---|---| | `Bold` | Toggles bold formatting | — | | `Italic` | Toggles italic formatting | — | | `Underline` | Toggles underline formatting | — | | `Strikethrough` | Toggles strikethrough formatting | — | | `Superscript` | Toggles superscript formatting | — | | `Subscript` | Toggles subscript formatting | — | | `ForeColor` | Sets text foreground color | color string | | `HiliteColor` | Sets text highlight/background color | color string | | `BackColor` | Sets text background color (alias for `HiliteColor`) | color string | | `FontName` | Sets font family | font name string | | `FontSize` | Sets font size | font size string | | `LineHeight` | Sets line height | line height string | | `Lang` | Sets language | `{ code: string, customCode?: string }` | | `RemoveFormat` | Removes formatting from selection | — | | `editor42BlockQuote` | Toggles blockquote | — | | `FormatBlock` | Sets block format | block tag name (e.g. `p`, `h1`) | | `editor42ToggleFormat` | Toggles a named format | format name string | ### History | Command | Description | Value | |---|---|---| | `editor42AddUndoLevel` | Adds an undo level | — | | `editor42EndUndoLevel` | Same as `editor42AddUndoLevel` | — | | `Undo` | Undoes the last action | — | | `Redo` | Redoes the last undone action | — | ### Indentation | Command | Description | Value | |---|---|---| | `Indent` | Indents content | — | | `Outdent` | Outdents content | — | ### Links | Command | Description | Value | |---|---|---| | `unlink` | Removes link from selection | — | | `editor42InsertLink` | Inserts or updates a link | URL string or `{ href: string, ... }` | | `createLink` | Same as `editor42InsertLink` | URL string or `{ href: string, ... }` | ### Lists | Command | Description | Value | |---|---|---| | `InsertUnorderedList` | Toggles unordered list | — | | `InsertOrderedList` | Toggles ordered list | — | ### Block insertion | Command | Description | Value | |---|---|---| | `InsertNewBlockBefore` | Inserts a new block before current block | — | | `InsertNewBlockAfter` | Inserts a new block after current block | — | ### Newline | Command | Description | Value | |---|---|---| | `insertParagraph` | Inserts a new paragraph (Enter key behavior) | — | | `editor42InsertNewLine` | Inserts a new line | — | | `InsertLineBreak` | Inserts a line break (`
`) | — | ### Selection | Command | Description | Value | |---|---|---| | `editor42SelectNodeDepth` | Selects parent node at specified depth | depth number | | `editor42SelectNode` | Selects a specific DOM node | DOM node | | `selectAll` | Selects all content in the editor | — | ### General | Command | Description | Value | |---|---|---| | `editor42RemoveNode` | Removes a node from the DOM (preserving children) | optional DOM node | | `editor42Print` | Opens browser print dialog | — | | `editor42Focus` | Focuses the editor | optional boolean (`true` = skip DOM focus) | | `editor42ToggleVisualAid` | Toggles visual aids (table borders, anchors, etc.) | — | ## Query state commands These commands can be used with `queryCommandState()` to check whether a format or state is currently active. Returns `true` when active. | Command | Returns true when | |---|---| | `JustifyLeft` | Content is left-aligned | | `JustifyCenter` | Content is center-aligned | | `JustifyRight` | Content is right-aligned | | `JustifyFull` | Content is justified | | `Bold` | Bold format is active | | `Italic` | Italic format is active | | `Underline` | Underline format is active | | `Strikethrough` | Strikethrough format is active | | `Superscript` | Superscript format is active | | `Subscript` | Subscript format is active | | `editor42BlockQuote` | Blockquote format is active | | `Outdent` | Outdent is possible | ## Query value commands These commands can be used with `queryCommandValue()` to retrieve the current value of a format at the caret position. | Command | Returns | |---|---| | `FontName` | Current font name | | `FontSize` | Current font size | | `LineHeight` | Current line height | ## Usage examples ### Toggling formatting ```js // Toggle bold on the current selection editor42.activeEditor.execCommand('Bold'); // Toggle italic editor42.activeEditor.execCommand('Italic'); ``` ### Setting text color ```js editor42.activeEditor.execCommand('ForeColor', false, '#e03e2d'); editor42.activeEditor.execCommand('HiliteColor', false, '#fbeeb8'); ``` ### Inserting content ```js // Insert HTML at the caret editor42.activeEditor.execCommand('editor42InsertContent', false, 'Hello'); // Replace the entire editor content editor42.activeEditor.execCommand('editor42SetContent', false, '

New content

'); ``` ### Working with links ```js // Insert a link editor42.activeEditor.execCommand('editor42InsertLink', false, 'https://example.com'); // Insert a link with attributes editor42.activeEditor.execCommand('editor42InsertLink', false, { href: 'https://example.com', target: '_blank', title: 'Example' }); // Remove a link editor42.activeEditor.execCommand('unlink'); ``` ### Checking format state ```js if (editor42.activeEditor.queryCommandState('Bold')) { console.log('Bold is active'); } const currentFont = editor42.activeEditor.queryCommandValue('FontName'); console.log('Current font:', currentFont); ``` --- # Events > All events fired by Editor42 — lifecycle, content, selection, formatting, undo/redo, and UI events with payload types and usage examples. Source: https://editor42.com/api/events Editor42 fires events throughout the editor lifecycle, letting you react to user actions, content changes, UI updates, and more. Use `editor.on()` to subscribe and `editor.off()` to unsubscribe. ```js editor42.init({ selector: '#myeditor', setup: (editor) => { editor.on('init', () => { console.log('Editor is ready'); }); editor.on('change', (e) => { console.log('Content changed', e.level); }); } }); ``` Every event callback receives an event object. Custom editor events include a `preventDefault()` method that some events check to cancel default behavior. ## Lifecycle | Event | Payload | Description | |---|---|---| | `init` | `{}` | Editor initialization completes. | | `remove` | `{}` | Editor is removed from the page. | | `detach` | `{}` | Editor is detached. | | `PreInit` | `{}` | Before editor initialization. | | `PostRender` | `{}` | After editor renders. | | `ScriptsLoaded` | `{}` | All scripts are loaded. | | `SkinLoaded` | `{}` | Editor skin is loaded. | | `SkinLoadError` | `{ message: string }` | Skin load failure. | | `PluginLoadError` | `{ message: string }` | Plugin load failure. | | `ModelLoadError` | `{ message: string }` | Model load failure. | | `IconsLoadError` | `{ message: string }` | Icon pack load failure. | | `ThemeLoadError` | `{ message: string }` | Theme load failure. | | `LanguageLoadError` | `{ message: string }` | Language pack load failure. | ## Focus | Event | Payload | Description | |---|---|---| | `focus` | `{ blurredEditor: Editor \| null }` | Editor receives DOM focus. | | `blur` | `{ focusedEditor: Editor \| null }` | Editor loses DOM focus. | | `activate` | `{ relatedTarget: Editor \| null }` | Editor gains focus in a multi-editor setup. | | `deactivate` | `{ relatedTarget: Editor }` | Editor loses focus in a multi-editor setup. | ## Content | Event | Payload | Description | |---|---|---| | `BeforeGetContent` | `{ selection?: boolean }` | Before content is retrieved. | | `GetContent` | `{ content: string; selection?: boolean }` | Content is retrieved. | | `BeforeSetContent` | `{ content: string; selection?: boolean }` | Before content is set. | | `SetContent` | `{ content: string }` | After content is set. `content` is deprecated. | | `SaveContent` | `{ content: string; save: boolean }` | Content is saved. | | `RawSaveContent` | `{ content: string; save: boolean }` | Raw save content event. | | `LoadContent` | `{ load: boolean; element: HTMLElement }` | Content is loaded into the editor. | | `NewBlock` | `{ newBlock: Element }` | A new block element is created (e.g., pressing Enter). | ## Selection & Node | Event | Payload | Description | |---|---|---| | `NodeChange` | `{ element: Element; parents: Node[]; selectionChange?: boolean; initial?: boolean }` | Cursor moves or DOM changes. | | `SelectionChange` | `{}` | Selection changes. | | `GetSelectionRange` | `{ range: Range }` | Getting selection range. | | `SetSelectionRange` | `{ range: Range; forward: boolean \| undefined }` | Selection range is set. | | `AfterSetSelectionRange` | `{ range: Range; forward: boolean \| undefined }` | After selection range is set. | | `ObjectSelected` | `{ target: Node; targetClone?: Node }` | An object (image, table, etc.) is selected. | | `BeforeObjectSelected` | `{ target: Node; targetClone?: Node }` | Before an object is selected. | ## Commands | Event | Payload | Description | |---|---|---| | `BeforeExecCommand` | `{ command: string; ui: boolean; value?: any }` | Before a command executes. | | `ExecCommand` | `{ command: string; ui: boolean; value?: any }` | After a command executes. | ## Formatting | Event | Payload | Description | |---|---|---| | `FormatApply` | `{ format: string; vars?: FormatVars; node?: Node \| RangeLikeObject \| null }` | A format is applied. | | `FormatRemove` | `{ format: string; vars?: FormatVars; node?: Node \| RangeLikeObject \| null }` | A format is removed. | | `PreviewFormats` | `{}` | Before format previews. | | `AfterPreviewFormats` | `{}` | After format previews. | ## Undo/Redo | Event | Payload | Description | |---|---|---| | `BeforeAddUndo` | `{ level: UndoLevel; lastLevel: UndoLevel \| undefined; originalEvent: Event \| undefined }` | Before an undo level is added. | | `AddUndo` | `{ level: UndoLevel; lastLevel: UndoLevel \| undefined; originalEvent: Event \| undefined }` | Undo level is added. | | `Undo` | `{ level: UndoLevel }` | Undo is performed. | | `Redo` | `{ level: UndoLevel }` | Redo is performed. | | `ClearUndos` | `{}` | Undo history is cleared. | | `TypingUndo` | `{}` | Typing undo level. | | `change` | `{ level: UndoLevel; lastLevel: UndoLevel \| undefined }` | Content changes. | ## UI & Resize | Event | Payload | Description | |---|---|---| | `ScrollIntoView` | `{ elm: HTMLElement; alignToTop: boolean \| undefined }` | Scrolling element into view. | | `AfterScrollIntoView` | `{ elm: HTMLElement; alignToTop: boolean \| undefined }` | After scroll into view. | | `ObjectResizeStart` | `{ target: HTMLElement; width: number; height: number; origin: string }` | Object resize starts. | | `ObjectResized` | `{ target: HTMLElement; width: number; height: number; origin: string }` | Object is resized. | | `ShowCaret` | `{ target: Node; direction: number; before: boolean }` | Caret is shown. | | `SwitchMode` | `{ mode: string }` | Editor mode changes (e.g., `design` or `readonly`). | | `ProgressState` | `{ state: boolean; time?: number }` | Progress state changes. | | `AfterProgressState` | `{ state: boolean }` | After progress state. | | `PlaceholderToggle` | `{ state: boolean }` | Placeholder visibility changes. | | `ScrollWindow` | native `Event` | Window scroll. | | `ResizeWindow` | `UIEvent` | Window resize. | | `resize` | `UIEvent` | Editor resize. | | `scroll` | `UIEvent` | Editor scroll. | ## Window & Dialog | Event | Payload | Description | |---|---|---| | `OpenWindow` | `{ dialog: InstanceApi }` | A dialog is opened. | | `CloseWindow` | `{ dialog: InstanceApi }` | A dialog is closed. | | `BeforeOpenNotification` | `{ notification: NotificationSpec }` | Before a notification opens. | | `OpenNotification` | `{ notification: NotificationApi }` | A notification opens. | ## Input & Touch | Event | Payload | Description | |---|---|---| | `input` | `InputEvent` | Input occurs. | | `beforeinput` | `InputEvent` | Before input occurs. | | `tap` | `TouchEvent` | Touch tap. | | `longpress` | `TouchEvent` | Long press. | | `longpresscancel` | `{}` | Long press is cancelled. | ## Paste | Event | Payload | Description | |---|---|---| | `PastePlainTextToggle` | `{ state: boolean }` | Paste-as-text mode toggles. | | `PastePreProcess` | `{ content: string; readonly internal: boolean }` | Before paste content is processed. | | `PastePostProcess` | `{ node: HTMLElement; readonly internal: boolean }` | After paste content is processed. | ## Autocomplete | Event | Payload | Description | |---|---|---| | `AutocompleterStart` | `AutocompleterEventArgs` | Autocomplete starts. | | `AutocompleterUpdate` | `AutocompleterEventArgs` | Autocomplete updates. | | `AutocompleterEnd` | `{}` | Autocomplete ends. | ## Table These events are provided by the [Table plugin](https://editor42.com/plugins/table). | Event | Payload | Description | |---|---|---| | `TableModified` | `{ table: HTMLTableElement; structure: boolean; style: boolean }` | A table is modified. | | `NewRow` | `{ node: HTMLTableRowElement }` | A new table row is created. | | `NewCell` | `{ node: HTMLTableCellElement }` | A new table cell is created. | ## DOM | Event | Payload | Description | |---|---|---| | `SetAttrib` | `SetAttribEvent` | An attribute is set on an element. | | `PreProcess` | `{ node: Element }` (extends ParserArgs) | During pre-processing. | | `PostProcess` | `{ content: string }` (extends ParserArgs) | During post-processing. | ## Visibility | Event | Payload | Description | |---|---|---| | `show` | `{}` | Editor is shown. | | `hide` | `{}` | Editor is hidden. | | `dirty` | `{}` | Editor becomes dirty (content modified since last save). | ## EditorManager Events These events are fired on the global `editor42` object rather than on individual editor instances. Use `editor42.on()` to subscribe. | Event | Payload | Description | |---|---|---| | `AddEditor` | `{ editor: Editor }` | An editor instance is added. | | `RemoveEditor` | `{ editor: Editor }` | An editor instance is removed. | | `BeforeUnload` | `{ returnValue: any }` | Before page unload. | ```js editor42.on('AddEditor', (e) => { console.log('New editor added:', e.editor.id); }); ``` ## Examples ### Reacting to content changes ```js editor42.init({ selector: '#myeditor', setup: (editor) => { editor.on('change', (e) => { // Auto-save or update a preview const content = editor.getContent(); fetch('/api/drafts', { method: 'POST', body: JSON.stringify({ content }), headers: { 'Content-Type': 'application/json' } }); }); } }); ``` ### Intercepting paste ```js editor42.init({ selector: '#myeditor', setup: (editor) => { editor.on('PastePreProcess', (e) => { // Strip all images from pasted content e.content = e.content.replace(/]*>/gi, ''); }); } }); ``` ### Tracking format changes ```js editor42.init({ selector: '#myeditor', setup: (editor) => { editor.on('FormatApply', (e) => { console.log('Format applied:', e.format); }); editor.on('FormatRemove', (e) => { console.log('Format removed:', e.format); }); } }); ``` ### Responding to node selection ```js editor42.init({ selector: '#myeditor', setup: (editor) => { editor.on('NodeChange', (e) => { // Update external UI based on the current node const isInTable = e.parents.some( (node) => node.nodeName === 'TABLE' ); document.getElementById('table-tools').hidden = !isInTable; }); } }); ``` ### Handling load errors ```js editor42.init({ selector: '#myeditor', setup: (editor) => { const errorEvents = [ 'SkinLoadError', 'PluginLoadError', 'ThemeLoadError', 'LanguageLoadError', 'IconsLoadError', 'ModelLoadError' ]; errorEvents.forEach((event) => { editor.on(event, (e) => { console.error(`${event}: ${e.message}`); }); }); } }); ``` --- # Content Formatting > Editor42 Formatter API — apply, remove, toggle, and query formats programmatically in the open-source rich text editor. Source: https://editor42.com/api/formatting The Formatter is Editor42's engine for applying, removing, and querying rich-text formats. It replaces the browser's inconsistent `document.execCommand` with a reliable, extensible API that works identically across all browsers. Every editor instance exposes the Formatter via `editor.formatter`. Use it to register custom formats, apply them to selections or nodes, check whether a format is active, and react to format changes in real time. ```js editor42.init({ selector: '#my-editor', setup: (editor) => { editor.on('init', () => { // Register a custom format editor.formatter.register('highlight', { inline: 'span', styles: { 'background-color': '#ff0' } }); // Apply it to the current selection editor.formatter.apply('highlight'); }); } }); ``` ## Registering Custom Formats Use `register` to add new formats and `unregister` to remove them. Formats can target inline elements, block elements, or match existing elements via CSS selectors. ```js // Register a single format editor.formatter.register('customCode', { inline: 'code', styles: { 'font-family': 'monospace', 'background-color': '#f4f4f4' } }); // Register multiple formats at once editor.formatter.register({ note: { block: 'p', classes: 'note' }, warning: { block: 'div', classes: 'warning', wrapper: true } }); // Check if a format exists if (editor.formatter.has('customCode')) { console.log('customCode format is registered'); } // Retrieve a registered format const fmt = editor.formatter.get('customCode'); // Remove a format from the registry editor.formatter.unregister('customCode'); ``` ## Applying and Removing Formats Once registered, formats can be applied to the current selection, toggled on and off, or explicitly removed. ```js // Apply bold to the current selection editor.formatter.apply('bold'); // Apply a format with variables (e.g. a color) editor.formatter.apply('forecolor', { value: '#e03e2d' }); // Apply a format to a specific node editor.formatter.apply('bold', {}, someNode); // Remove a format from the current selection editor.formatter.remove('bold'); // Remove with the "similar" flag — removes formats // that are similar but not an exact variable match editor.formatter.remove('forecolor', { value: '#e03e2d' }, null, true); // Toggle a format on or off depending on current state editor.formatter.toggle('bold'); editor.formatter.toggle('italic'); ``` ## Querying Formats The Formatter provides several methods for checking whether formats are active on the current selection or on specific nodes. ```js // Check if bold is active on the current selection const isBold = editor.formatter.match('bold'); // Check if a specific color is active const isRed = editor.formatter.match('forecolor', { value: '#e03e2d' }); // Find all active formats from a list const active = editor.formatter.matchAll(['bold', 'italic', 'underline']); // e.g. ['bold', 'italic'] // Find the closest matching format from a set const closest = editor.formatter.closest(['h1', 'h2', 'h3', 'p']); // e.g. 'h2' // Check a specific node const fmt = editor.formatter.matchNode(someNode, 'bold'); if (fmt) { console.log('Node matches bold format'); } // Check if a format can be applied to the current selection if (editor.formatter.canApply('bold')) { console.log('Bold can be applied here'); } ``` ## Observing Format Changes Use `formatChanged` to run a callback whenever the current selection enters or leaves a formatted region. The `names` parameter accepts a comma-separated list of format names. ```js // React when bold or italic state changes const watcher = editor.formatter.formatChanged('bold,italic', (active, args) => { console.log(`Format "${args.format}" is now ${active ? 'on' : 'off'}`); }); // Stop observing watcher.unbind(); ``` ## API Reference | Method | Signature | Returns | Description | |---|---|---|---| | `get` | `get(name?: string)` | `Array \| Object` | Returns the format by name, or all registered formats if no name is specified. | | `has` | `has(name: string)` | `boolean` | Returns whether a format is registered for the given name. | | `register` | `register(name: string \| object, format?: object \| array)` | — | Registers a format by name. Pass an object as the first argument to register multiple formats at once. | | `unregister` | `unregister(name: string)` | — | Unregisters a format by name. | | `apply` | `apply(name: string, vars?: FormatVars, node?: Node \| RangeLikeObject \| null)` | — | Applies the named format to the current selection or specified node. | | `remove` | `remove(name: string, vars?: FormatVars, node?: Node \| Range, similar?: boolean)` | — | Removes the named format from the current selection or specified node. | | `toggle` | `toggle(name: string, vars?: FormatVars, node?: Node)` | — | Toggles the named format on or off. | | `match` | `match(name: string, vars?: FormatVars, node?: Node, similar?: boolean)` | `boolean` | Returns whether the current selection or specified node matches the named format. | | `closest` | `closest(names: string[])` | `string \| null` | Returns the closest matching format name from the given array, or null. | | `matchAll` | `matchAll(names: string[], vars?: FormatVars)` | `string[]` | Returns the subset of format names that match the current selection. | | `matchNode` | `matchNode(node: Node \| null, name: string, vars?: FormatVars, similar?: boolean)` | `Format \| undefined` | Returns the format object if the node matches the named format, or undefined. | | `canApply` | `canApply(name: string)` | `boolean` | Returns whether the named format can be applied to the current selection. | | `formatChanged` | `formatChanged(names: string, callback: FormatChangeCallback, similar?: boolean, vars?: FormatVars)` | `{ unbind: () => void }` | Calls the callback when the selection enters or leaves the specified formats. Returns an object with an `unbind` method. | | `getCssText` | `getCssText(format: string \| ApplyFormat)` | `string` | Returns a preview CSS text string for the format. Useful for rendering format previews in UI elements. | ## Format Specification A format is a plain object describing how an element should be created, matched, or removed. There are three primary format types — **inline**, **block**, and **selector** — determined by which top-level property you set. | Property | Type | Description | |---|---|---| | `inline` | `string` | Inline element to produce (e.g. `span`, `b`, `i`, `code`). | | `block` | `string` | Block element to produce (e.g. `h1`, `p`, `div`, `blockquote`). | | `selector` | `string` | CSS selector to match existing elements instead of creating new ones. | | `styles` | `object` | CSS styles to apply as key/value pairs (e.g. `{ 'color': '#f00' }`). | | `attributes` | `object` | HTML attributes to set as key/value pairs (e.g. `{ 'title': 'Note' }`). | | `classes` | `string \| string[]` | CSS class names to add to the element. | | `wrapper` | `boolean` | Whether the format wraps content in a new container element. | | `remove` | `string` | Controls removal behavior: `none`, `empty`, or `all`. | | `exact` | `boolean` | Require an exact match of styles/classes/attributes for removal. | ### Examples ```js // Inline format — wraps selection in a styled editor.formatter.register('highlight', { inline: 'span', styles: { 'background-color': '#ff0' } }); // Block format — converts paragraph to

editor.formatter.register('heading2', { block: 'h2' }); // Selector format — applies a class to an existing

editor.formatter.register('intro', { selector: 'p', classes: 'intro' }); // Format with attributes and exact matching editor.formatter.register('langSpan', { inline: 'span', attributes: { 'lang': '%value' }, exact: true }); editor.formatter.apply('langSpan', { value: 'fr' }); ``` --- # UI Components > Editor42 UI Components API — register custom toolbar buttons, menu items, context menus, sidebars, and dialogs for the WYSIWYG editor. Source: https://editor42.com/api/ui-components The UI Registry API lets you register custom toolbar buttons, menu items, context menus, autocompleters, sidebars, and other UI components. All methods are available on `editor.ui.registry` inside the `setup` callback. ```js editor42.init({ selector: 'textarea', setup: (editor) => { editor.ui.registry.addButton('mybutton', { text: 'My Button', onAction: () => editor.insertContent('Hello!') }); }, toolbar: 'undo redo | mybutton' }); ``` ## Toolbar Buttons ### Basic Button Registers a toolbar button that executes a command when clicked. ```js editor.ui.registry.addButton(name, spec) ``` | Property | Type | Description | |---|---|---| | `text` | string? | Button label text. | | `icon` | string? | Icon name (registered or built-in). | | `tooltip` | string? | Tooltip shown on hover. | | `enabled` | boolean? | Initial enabled state. Defaults to `true`. | | `onSetup` | function? | Called when the button is rendered. Return a teardown function. | | `onAction` | function | Called when the button is clicked. | ```js editor.ui.registry.addButton('insertdate', { icon: 'insert-time', tooltip: 'Insert date', onAction: () => { editor.insertContent(new Date().toDateString()); } }); ``` ### Toggle Button Registers a toggle button whose state can be switched on/off. Useful for format buttons like bold or italic that reflect the current selection state. ```js editor.ui.registry.addToggleButton(name, spec) ``` | Property | Type | Description | |---|---|---| | `text` | string? | Button label text. | | `icon` | string? | Icon name. | | `tooltip` | string? | Tooltip shown on hover. | | `enabled` | boolean? | Initial enabled state. | | `active` | boolean? | Initial toggle state. Defaults to `false`. | | `onSetup` | function? | Called when the button is rendered. Use `api.setActive(state)` to update the toggle. | | `onAction` | function | Called when the button is clicked. Receives `api` with `isActive()` and `setActive()`. | ```js editor.ui.registry.addToggleButton('customformat', { icon: 'highlight-bg-color', tooltip: 'Toggle highlight', onAction: (api) => { editor.execCommand('editor42ToggleFormat', false, 'hilitecolor'); }, onSetup: (api) => { const changed = editor.formatter.formatChanged('hilitecolor', (state) => { api.setActive(state); }); return changed; } }); ``` ### Menu Button Registers a toolbar button that opens a dropdown menu when clicked. ```js editor.ui.registry.addMenuButton(name, spec) ``` | Property | Type | Description | |---|---|---| | `text` | string? | Button label text. | | `icon` | string? | Icon name. | | `tooltip` | string? | Tooltip shown on hover. | | `fetch` | function | `(callback) => void` — call `callback` with an array of menu items. | | `onSetup` | function? | Called when the button is rendered. | ```js editor.ui.registry.addMenuButton('myinsert', { text: 'Insert', fetch: (callback) => { const items = [ { type: 'menuitem', text: 'Horizontal rule', onAction: () => editor.insertContent('


') }, { type: 'menuitem', text: 'Page break', onAction: () => editor.insertContent('') } ]; callback(items); } }); ``` ### Split Button Registers a split button — the main area executes a default action, and the arrow opens a dropdown menu. Used by the advlist plugin for list styles. ```js editor.ui.registry.addSplitButton(name, spec) ``` | Property | Type | Description | |---|---|---| | `text` | string? | Button label text. | | `icon` | string? | Icon name. | | `tooltip` | string? | Tooltip shown on hover. | | `onAction` | function | Called when the main button area is clicked. | | `onItemAction` | function | Called when a dropdown item is selected. Receives the item value. | | `fetch` | function | `(callback) => void` — call `callback` with an array of choice items. | | `onSetup` | function? | Called when the button is rendered. | ```js editor.ui.registry.addSplitButton('mycolors', { text: 'Color', onAction: () => { editor.execCommand('ForeColor', false, '#000000'); }, onItemAction: (_api, value) => { editor.execCommand('ForeColor', false, value); }, fetch: (callback) => { callback([ { type: 'choiceitem', text: 'Red', value: '#FF0000' }, { type: 'choiceitem', text: 'Green', value: '#00FF00' }, { type: 'choiceitem', text: 'Blue', value: '#0000FF' } ]); } }); ``` ### Group Toolbar Button Registers a button that opens a floating toolbar containing other buttons when clicked. Only available when `toolbar_mode` is set to `floating`. ```js editor.ui.registry.addGroupToolbarButton(name, spec) ``` | Property | Type | Description | |---|---|---| | `text` | string? | Button label text. | | `icon` | string? | Icon name. | | `tooltip` | string? | Tooltip shown on hover. | | `items` | string | Space-separated list of toolbar button names. | | `onSetup` | function? | Called when the button is rendered. | ```js editor.ui.registry.addGroupToolbarButton('formatting', { icon: 'more-drawer', tooltip: 'Formatting', items: 'bold italic underline | forecolor backcolor' }); ``` ## Menu Items ### Basic Menu Item Registers a menu item that executes a command when clicked. ```js editor.ui.registry.addMenuItem(name, spec) ``` | Property | Type | Description | |---|---|---| | `text` | string? | Menu item label. | | `icon` | string? | Icon name. | | `shortcut` | string? | Keyboard shortcut hint displayed beside the label. | | `enabled` | boolean? | Initial enabled state. | | `onSetup` | function? | Called when the item is rendered. | | `onAction` | function | Called when the item is clicked. | ```js editor.ui.registry.addMenuItem('inserthr', { text: 'Horizontal rule', icon: 'horizontal-rule', onAction: () => editor.insertContent('
') }); ``` ### Nested Menu Item Registers a menu item that reveals a submenu on hover or click. ```js editor.ui.registry.addNestedMenuItem(name, spec) ``` | Property | Type | Description | |---|---|---| | `text` | string? | Menu item label. | | `icon` | string? | Icon name. | | `getSubmenuItems` | function | Returns a string of registered item names or an array of `MenuItemSpec` objects. | | `onSetup` | function? | Called when the item is rendered. | ```js editor.ui.registry.addNestedMenuItem('mysubmenu', { text: 'Insert template', getSubmenuItems: () => [ { type: 'menuitem', text: 'Header', onAction: () => editor.insertContent('

Header

') }, { type: 'menuitem', text: 'Footer', onAction: () => editor.insertContent('
Footer
') } ] }); ``` ### Toggle Menu Item Registers a menu item with a checkmark that toggles state on click. Useful for boolean settings like "Paste as text". ```js editor.ui.registry.addToggleMenuItem(name, spec) ``` | Property | Type | Description | |---|---|---| | `text` | string? | Menu item label. | | `icon` | string? | Icon name. | | `active` | boolean? | Initial toggle state. | | `onSetup` | function? | Called when the item is rendered. Use `api.setActive(state)` to update the checkmark. | | `onAction` | function | Called when the item is clicked. | ```js editor.ui.registry.addToggleMenuItem('darkmode', { text: 'Dark mode', onAction: (api) => { const newState = !api.isActive(); api.setActive(newState); editor.getBody().classList.toggle('dark', newState); } }); ``` ## Context UI ### Context Menu Registers a context menu section that appears on right-click when a content condition is met. Add the registered name to the `contextmenu` option. ```js editor.ui.registry.addContextMenu(name, spec) ``` | Property | Type | Description | |---|---|---| | `update` | function | \`(element) => string | ```js editor.ui.registry.addContextMenu('mycontext', { update: (element) => { return element.nodeName === 'IMG' ? 'link image' : ''; } }); ``` ```js editor42.init({ selector: 'textarea', contextmenu: 'mycontext' }); ``` ### Context Toolbar Registers a floating toolbar that appears when a content predicate matches. For example, the quickbars plugin uses this to show a toolbar when the cursor is on an image. ```js editor.ui.registry.addContextToolbar(name, spec) ``` | Property | Type | Description | |---|---|---| | `predicate` | function | `(node) => boolean` — return `true` to show the toolbar. | | `items` | string | Space-separated list of toolbar button names. | | `position` | string? | Positioning: `selection`, `node`, or `line`. | | `scope` | string? | `node` (default) or `editor`. | ```js editor.ui.registry.addContextToolbar('imagetools', { predicate: (node) => node.nodeName === 'IMG', items: 'alignleft aligncenter alignright', position: 'node' }); ``` ### Context Form Registers a contextual form with an input field that appears when a content predicate matches. Used by the link plugin for inline URL editing when `link_context_toolbar: true`. ```js editor.ui.registry.addContextForm(name, spec) ``` | Property | Type | Description | |---|---|---| | `predicate` | function | `(node) => boolean` — return `true` to show the form. | | `initValue` | function | Returns the initial value for the input field. | | `commands` | ContextFormButtonSpec[] | Action buttons displayed beside the input. | | `position` | string? | Positioning: `selection`, `node`, or `line`. | | `scope` | string? | `node` (default) or `editor`. | ```js editor.ui.registry.addContextForm('quicklink', { predicate: (node) => node.nodeName === 'A', initValue: () => { const node = editor.selection.getNode(); return node.nodeName === 'A' ? node.href : ''; }, commands: [ { type: 'contextformbutton', icon: 'checkmark', tooltip: 'Apply', primary: true, onAction: (formApi) => { const value = formApi.getValue(); editor.execCommand('editor42InsertLink', false, { href: value }); formApi.hide(); } }, { type: 'contextformbutton', icon: 'remove', tooltip: 'Remove', onAction: (formApi) => { editor.execCommand('Unlink'); formApi.hide(); } } ] }); ``` ## Autocompleters Registers an autocompleter triggered by a character pattern. When the user types the trigger string followed by text, a dropdown appears with matching options. Used by the emoticons plugin (triggered by `:`) and the charmap plugin. ```js editor.ui.registry.addAutocompleter(name, spec) ``` | Property | Type | Description | |---|---|---| | `trigger` | string | Character(s) that activate the autocompleter (e.g., `:`, `/`). | | `minChars` | number? | Minimum characters after the trigger before fetching. Defaults to `1`. | | `fetch` | function | `(pattern, maxResults, fetchOptions) => Promise` — returns a promise resolving to an array of autocomplete items. | | `onAction` | function | `(autocompleterApi, range, value) => void` — called when an item is selected. | | `columns` | number/string? | Number of columns for grid layout. Use `auto` or `1` for a list. | ```js editor.ui.registry.addAutocompleter('mentions', { trigger: '@', minChars: 1, fetch: (pattern) => { const users = [ { text: 'Alice', value: 'alice' }, { text: 'Bob', value: 'bob' }, { text: 'Carol', value: 'carol' } ]; const filtered = users.filter((u) => u.text.toLowerCase().includes(pattern.toLowerCase())); return Promise.resolve( filtered.map((u) => ({ type: 'autocompleteitem', value: u.value, text: u.text })) ); }, onAction: (api, rng, value) => { editor.selection.setRng(rng); editor.insertContent(`@${value} `); api.hide(); } }); ``` ## Icons Registers a custom SVG icon that can be referenced by name in any UI component. ```js editor.ui.registry.addIcon(name, svgData) ``` | Property | Type | Description | |---|---|---| | `name` | string | Unique icon name to reference in buttons and menu items. | | `svgData` | string | SVG markup string. | ```js editor.ui.registry.addIcon('custom-star', ''); editor.ui.registry.addButton('star', { icon: 'custom-star', tooltip: 'Insert star', onAction: () => editor.insertContent('★') }); ``` ## Sidebars and Views ### Sidebar Registers a sidebar panel attached to the right side of the editor. A toggle toolbar button is created automatically. The sidebar can also be controlled via the `ToggleSidebar` command. ```js editor.ui.registry.addSidebar(name, spec) ``` | Property | Type | Description | |---|---|---| | `tooltip` | string? | Tooltip for the auto-generated toolbar toggle button. | | `icon` | string? | Icon for the toggle button. | | `onSetup` | function? | Called when the sidebar is first rendered. Receives `api`. | | `onShow` | function? | Called each time the sidebar becomes visible. Receives `api` with `element()`. | | `onHide` | function? | Called each time the sidebar is hidden. | ```js editor.ui.registry.addSidebar('comments', { tooltip: 'Comments', icon: 'comment', onShow: (api) => { const el = api.element(); el.innerHTML = '
No comments yet.
'; }, onHide: () => {} }); ``` Toggle the sidebar programmatically: ```js editor.execCommand('ToggleSidebar', false, 'comments'); ``` ### View Registers a view that replaces the editor content area when toggled on. Useful for alternate editing modes like source code views. Controlled via the `ToggleView` command. ```js editor.ui.registry.addView(name, spec) ``` | Property | Type | Description | |---|---|---| | `buttons` | ViewButtonSpec[] | Action buttons shown in the view header. | | `onShow` | function | `(api) => void` — called when the view becomes visible. Use `api.getContainer()` to access the view DOM. | | `onHide` | function | `(api) => void` — called when the view is hidden. | ```js editor.ui.registry.addView('codeview', { buttons: [ { type: 'button', text: 'Back to editor', buttonType: 'primary', onAction: () => editor.execCommand('ToggleView', false, 'codeview') } ], onShow: (api) => { const container = api.getContainer(); const textarea = document.createElement('textarea'); textarea.style.width = '100%'; textarea.style.height = '100%'; textarea.value = editor.getContent(); container.appendChild(textarea); }, onHide: (api) => { const textarea = api.getContainer().querySelector('textarea'); if (textarea) { editor.setContent(textarea.value); } } }); ``` Toggle the view programmatically: ```js editor.execCommand('ToggleView', false, 'codeview'); ``` ## Built-in Toolbar Buttons These buttons are registered by default and can be used in the `toolbar` option without additional setup. ### Format toggle buttons | Button | Description | |---|---| | `bold` | Toggles bold formatting. | | `italic` | Toggles italic formatting. | | `underline` | Toggles underline formatting. | | `strikethrough` | Toggles strikethrough formatting. | | `subscript` | Toggles subscript formatting. | | `superscript` | Toggles superscript formatting. | | `h1` | Toggles heading level 1. | | `h2` | Toggles heading level 2. | | `h3` | Toggles heading level 3. | | `h4` | Toggles heading level 4. | | `h5` | Toggles heading level 5. | | `h6` | Toggles heading level 6. | | `blockquote` | Toggles blockquote formatting. | ### Command buttons | Button | Description | |---|---| | `copy` | Copies the selection to the clipboard. | | `cut` | Cuts the selection to the clipboard. | | `paste` | Pastes from the clipboard. | | `selectall` | Selects all content. | | `newdocument` | Clears the editor content. | | `print` | Opens the browser print dialog. | | `removeformat` | Removes formatting from the selection. | | `remove` | Deletes the selected content. | | `hr` | Inserts a horizontal rule. | | `help` | Opens the help dialog. | ### Other core buttons | Button | Description | |---|---| | `undo` | Undoes the last action. | | `redo` | Redoes the last undone action. | | `outdent` | Decreases indentation. | | `indent` | Increases indentation. | | `alignleft` | Aligns content to the left. | | `aligncenter` | Centers content. | | `alignright` | Aligns content to the right. | | `alignjustify` | Justifies content. | | `alignnone` | Removes alignment. | | `pastetext` | Toggles paste-as-plain-text mode. | | `visualaid` | Toggles visual aids for invisible elements. | ### Bespoke controls | Button | Type | Description | |---|---|---| | `fontfamily` | Nested menu | Font family selector. | | `fontsize` | Nested menu | Font size selector. | | `blocks` | Nested menu | Block format selector (paragraph, headings, etc.). | | `align` | Nested menu | Text alignment selector. | | `styles` | Nested menu | Custom styles selector. | | `forecolor` | Split button | Text color picker. | | `hilitecolor` | Split button | Highlight color picker. | | `backcolor` | Split button | Background color picker. | ## Built-in Menu Items These items are registered by default and can be used in the `menu` option. | Menu Item | Description | |---|---| | `newdocument` | Clears the editor content. | | `undo` | Undoes the last action. | | `redo` | Redoes the last undone action. | | `copy` | Copies the selection. | | `cut` | Cuts the selection. | | `paste` | Pastes from the clipboard. | | `selectall` | Selects all content. | | `print` | Opens the print dialog. | | `bold` | Toggles bold. | | `italic` | Toggles italic. | | `underline` | Toggles underline. | | `strikethrough` | Toggles strikethrough. | | `subscript` | Toggles subscript. | | `superscript` | Toggles superscript. | | `codeformat` | Toggles inline code formatting. | | `removeformat` | Removes formatting. | | `hr` | Inserts a horizontal rule. | | `align` | Text alignment submenu. | | `blocks` | Block format submenu. | | `fontfamily` | Font family submenu. | | `fontsize` | Font size submenu. | | `styles` | Custom styles submenu. | | `pastetext` | Toggles paste-as-plain-text. | | `visualaid` | Toggles visual aids. | --- # Configuration Options > All configuration options for Editor42, the free open-source WYSIWYG HTML editor — integration, appearance, toolbar, content filtering, and more. Source: https://editor42.com/api/configuration Editor42 accepts a wide range of options in the `editor42.init()` call. These control everything from basic setup and sizing to content filtering, formatting, and advanced behavior. ```js editor42.init({ selector: '#myeditor', plugins: 'lists link image table code', toolbar: 'undo redo | blocks | bold italic | link image | bullist numlist', height: 500 }); ``` ## Option categories - [**Integration and Setup**](https://editor42.com/api/configuration/integration) — selector, plugins, language, callbacks, and other initialization settings - [**Editor Size**](https://editor42.com/api/configuration/editor-size) — width, height, min/max constraints, and resize behavior - [**Appearance**](https://editor42.com/api/configuration/appearance) — skins, icons, themes, content CSS, placeholder, and visual aids - [**Toolbar**](https://editor42.com/api/configuration/toolbar) — toolbar layout, overflow mode, sticky behavior, and grouping - [**Menus**](https://editor42.com/api/configuration/menu) — menubar, context menus, and custom menu structures - [**Content Behavior**](https://editor42.com/api/configuration/content-behavior) — Enter key handling, text patterns, root blocks, and drag-and-drop - [**Content Filtering**](https://editor42.com/api/configuration/content-filtering) — valid elements, schema enforcement, entity encoding, and security - [**URL Handling**](https://editor42.com/api/configuration/url-handling) — relative URLs, base URL, and custom URL converters - [**Formatting**](https://editor42.com/api/configuration/formatting) — custom formats, font families, colors, indentation, and style dropdowns - [**Copy and Paste**](https://editor42.com/api/configuration/paste) — paste preprocessing, plain text mode, and WebKit style handling - [**Image Upload**](https://editor42.com/api/configuration/image-upload) — upload endpoints, handlers, file pickers, and allowed file types - [**Status Bar**](https://editor42.com/api/configuration/statusbar) — status bar visibility, element path, and branding - [**Other Options**](https://editor42.com/api/configuration/misc) — iframe settings, undo levels, spellcheck, directionality, and more --- # Integration and Setup > Editor42 integration and setup options — selector, plugins, language, callbacks, and other initialization settings. Source: https://editor42.com/api/configuration/integration Section: Configuration Options > 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 | Option | Type | Default | Description | |---|---|---|---| | `selector` | string | — | CSS selector matching the element(s) to replace with an editor instance. | | `target` | HTMLElement | — | Direct DOM element reference to convert into an editor. Use instead of `selector` when you already have a reference. | | `inline` | boolean | `false` | Enable inline editing mode. The editor appears inside the target element itself rather than in an iframe. | | `base_url` | string | — | Base URL for loading Editor42 resource files (skins, themes, plugins). | | `suffix` | string | — | Suffix appended to script filenames, e.g. `.min` for minified builds. | | `cache_suffix` | string | — | Query string appended to resource URLs for cache busting, e.g. `?v=1.0`. | | `setup` | function | — | 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_callback` | function | — | Callback invoked after the editor has fully initialized. Receives the editor instance. | | `plugins` | string[] | `[]` | List of plugins to load. Each entry is a plugin alias name — see the [available plugins](https://editor42.com/plugins). | | `external_plugins` | object | — | Map of plugin names to their script URLs, for loading plugins hosted outside the Editor42 package. | | `model` | string | `dom` | Content model the editor uses internally. | | `referrer_policy` | string | `''` | Referrer policy applied to resource requests made by the editor. | | `language` | string | `en` | Language code for the editor UI. | | `language_url` | string | `''` | URL to a custom language pack file. | | `language_load` | boolean | `true` | Whether the editor should load its language pack automatically. | | `readonly` | boolean | `false` | Start the editor in read-only mode. Content is displayed but not editable. | | `editable_root` | boolean | `true` | Whether the root element of the editor body is editable. Set to `false` to make only specific child elements editable. | | `auto_focus` | string/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. | | `id` | string | — | Explicit id for the editor instance. If omitted, the id of the target element is used. | | `api_key` | string | — | API key field. Not used in Editor42. | | `deprecation_warnings` | boolean | `true` | Log deprecation warnings to the browser console when deprecated options are used. | ## Example ```js 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); } }); ``` --- # Editor Size > Editor42 size options — the editor's width and height, the limits it can be resized to, and whether its resize handle works vertically or in both directions. Source: https://editor42.com/api/configuration/editor-size Section: Configuration Options > Editor Size These options control the dimensions of the editor and whether the user can resize it. ## Options | Option | Type | Default | Description | |---|---|---|---| | `width` | string/number | element width | Width of the editor. Accepts a number (pixels) or a CSS string such as `100%`. | | `height` | string/number | max(element height, 400) | Height of the editor. Accepts a number (pixels) or a CSS string. | | `min_width` | number | — | Minimum width in pixels. Prevents the user from resizing below this value. | | `max_width` | number | — | Maximum width in pixels. Prevents the user from resizing above this value. | | `min_height` | number | `100` | Minimum height in pixels. | | `max_height` | number | — | Maximum height in pixels. | | `resize` | boolean/string | `true` | Controls the resize handle. `true` for vertical resizing only, `both` for vertical and horizontal, `false` to disable. | > **Note** > > For automatic height adjustment based on content, see the [Autoresize plugin](https://editor42.com/plugins/autoresize). ## Example ```js editor42.init({ selector: 'textarea', width: '100%', height: 600, min_height: 300, max_height: 900, resize: 'both' }); ``` --- # Appearance > Editor42 appearance options — the skin, icon pack and theme, the CSS loaded into the content, placeholder text, and the visual aids for hidden elements. Source: https://editor42.com/api/configuration/appearance Section: Configuration Options > Appearance These options control the visual presentation of the editor, including its skin, icon set, theme, content styling, and visual aids. ## Options | Option | Type | Default | Description | |---|---|---|---| | `skin` | string/false | `oxide` | Name of the skin to load. Set to `false` to skip skin loading entirely. | | `skin_url` | string | — | URL to a directory containing custom skin files. Overrides the default skin path. | | `icons` | string | `''` | Name of the icon pack to use. | | `icons_url` | string | `''` | URL to a custom icon pack JS file. | | `theme` | string/false/function | `silver` | Theme to use. Set to `false` for a headless editor or provide a function for a fully custom theme. | | `theme_url` | string | — | URL to a custom theme JS file. | | `branding` | boolean | `true` | Show Editor42 branding in the status bar. | | `promotion` | boolean | `false` | Show an "Upgrade" promotion link in the editor UI. Off by default — Editor42 has no premium tier. | | `content_css` | string[]/string/false | `['default']` | CSS files loaded into the editor content iframe. Use skin names like `default` or `dark`, or provide custom URLs. Set to `false` to load no content CSS. | | `content_style` | string | — | Inline CSS injected directly into the editor content. Applied after `content_css`. | | `content_css_cors` | boolean | `false` | Enable CORS headers when loading content CSS files. | | `font_css` | string[]/string | `[]` | Additional CSS files for loading custom web fonts inside the editor content. | | `body_class` | string | `''` | CSS class applied to the `` element inside the editor iframe. | | `body_id` | string | `editor42` | ID applied to the `` element inside the editor iframe. | | `placeholder` | string | — | Placeholder text displayed when the editor is empty. | | `highlight_on_focus` | boolean | `false` | Visually highlight the editor border when it receives focus. | | `visual` | boolean | `true` | Enable visual aids that show invisible elements like table borders and anchors. | | `visual_table_class` | string | `editor42-m-item-table` | CSS class applied to tables when visual aids are active. | | `visual_anchor_class` | string | `editor42-m-item-anchor` | CSS class applied to anchors when visual aids are active. | ## Example ```js editor42.init({ selector: 'textarea', skin: 'oxide-dark', content_css: 'dark', icons: 'material', placeholder: 'Start typing here...', content_style: 'body { font-family: Arial, sans-serif; font-size: 14px; }', highlight_on_focus: true }); ``` --- # Toolbar > Editor42 toolbar options — the buttons and their groups, what happens when they do not fit, a toolbar that sticks while scrolling, and a fixed container. Source: https://editor42.com/api/configuration/toolbar Section: Configuration Options > Toolbar These options control how the editor toolbar is laid out, how it handles overflow, and where it is positioned. ## Options | Option | Type | Default | Description | |---|---|---|---| | `toolbar` | boolean/string/string[] | `undo redo \| blocks \| bold italic \| alignleft aligncenter alignright \| indent outdent \| bullist numlist \| code \| table help` | Toolbar button layout. Pass a string of space-separated button names with `\|` as group separators, an array of strings for multiple rows, or `false` to hide the toolbar. | | `toolbar_mode` | string | `floating` (mobile: `scrolling`) | How the toolbar handles overflow when buttons do not fit. Options: `floating` (overflow menu), `sliding` (slide-out drawer), `scrolling` (horizontal scroll), `wrap` (wrap to next line). | | `toolbar_groups` | object | `{}` | Named groups of toolbar buttons that collapse into a single group button. Each key is the group name and the value is an object with an `items` array. | | `toolbar_location` | string | `auto` | Where the toolbar is placed. `auto` uses the default position, `top` forces it above the content, `bottom` places it below. | | `toolbar_persist` | boolean | `false` | Keep the toolbar of an inline editor visible even when the editor loses focus. | | `toolbar_sticky` | boolean | same as `inline` | Make the toolbar stick to the top of the viewport when scrolling past the editor. Enabled by default for inline editors. | | `toolbar_sticky_offset` | number | `0` | Offset in pixels from the top of the viewport when the toolbar is in sticky mode. Useful when the page has a fixed header. | | `fixed_toolbar_container` | string | `''` | CSS selector for an element that should contain the toolbar, detaching it from the editor frame. Only works with inline editors. | | `fixed_toolbar_container_target` | HTMLElement | — | Direct DOM element reference for the fixed toolbar container. Use instead of `fixed_toolbar_container` when you already have a reference. | | `ui_mode` | string | `combined` | Controls how the editor UI is structured. | ## Example ```js editor42.init({ selector: 'textarea', toolbar: 'undo redo | blocks | bold italic underline | alignleft aligncenter alignright | bullist numlist | link image', toolbar_mode: 'sliding', toolbar_sticky: true, toolbar_sticky_offset: 64, toolbar_location: 'top' }); ``` --- # Menus > Editor42 menu options — show, hide or choose the menus of the menubar, define menus of your own, remove menu items, and set up the right-click context menu. Source: https://editor42.com/api/configuration/menu Section: Configuration Options > Menus These options control the menubar at the top of the editor and the context menu that appears on right-click. ## Options | Option | Type | Default | Description | |---|---|---|---| | `menubar` | boolean/string | `true` (phones: `false`) | Enable or configure the menubar. `true` shows the default menus, `false` hides it, or pass a space-separated string of menu names to show specific menus. | | `menu` | object | `{}` | Custom menu structure. Each key is a menu name and the value is an object with `title` and `items` properties. | | `removed_menuitems` | string | `''` | Space-separated list of menu item names to remove from all menus. | | `contextmenu` | string/string[]/false | `link linkchecker image editimage table spellchecker configurepermanentpen` | Context menu sections shown on right-click. Pass `false` to use the browser's native context menu. | | `contextmenu_avoid_overlap` | string | `''` | CSS selector for elements that the context menu should not overlap. The menu repositions itself to avoid covering matched elements. | | `contextmenu_never_use_native` | boolean | `false` | Always show the Editor42 context menu, even when the editor would normally fall back to the browser's native menu. | ## Example ```js editor42.init({ selector: 'textarea', menubar: 'file edit view insert format table', menu: { custom: { title: 'My Menu', items: 'bold italic | removeformat' } }, removed_menuitems: 'newdocument print', contextmenu: 'link image table' }); ``` --- # Content Behavior > Editor42 content behavior options — Enter key handling, text patterns, root blocks, and drag-and-drop. Source: https://editor42.com/api/configuration/content-behavior Section: Configuration Options > Content Behavior These options control how the editor handles content creation, Enter key behavior, text patterns, and drag-and-drop operations. ## Options | Option | Type | Default | Description | |---|---|---|---| | `forced_root_block` | string | `p` | Block element used to wrap text nodes at the root level. | | `forced_root_block_attrs` | object | `{}` | HTML attributes applied to the forced root block element. | | `newline_behavior` | string | `default` | What happens when the user presses Enter. `block` inserts a new block, `linebreak` inserts a `
`, `invert` swaps the behavior of Enter and Shift+Enter, `default` uses the standard behavior. | | `br_in_pre` | boolean | `true` | Insert a `
` instead of splitting into a new `
` block when Enter is pressed inside a `
` element. |
| `br_newline_selector` | string | `.editor42-m-toc h2,figcaption,caption` | CSS selector for elements where Enter inserts a `
` instead of creating a new block. | | `no_newline_selector` | string | `''` | CSS selector for elements where the Enter key is suppressed entirely. | | `keep_styles` | boolean | `true` | Carry text formatting (bold, italic, etc.) into the new paragraph when pressing Enter. | | `end_container_on_empty_block` | boolean/string | `blockquote` | End a containing block when the user presses Enter twice on an empty line. Set to a tag name or `true` for all blocks. | | `text_patterns` | object[]/false | see below | Markdown-like text patterns that trigger automatic formatting. Set to `false` to disable. | | `text_patterns_lookup` | function | — | Callback that dynamically provides additional text patterns based on context. | | `block_unsupported_drop` | boolean | `true` | Block drag-and-drop of content types that the editor does not support. | | `table_tab_navigation` | boolean | `true` | Allow the Tab key to navigate between table cells. | | `newdocument_content` | string | `''` | HTML content inserted when the "New Document" command is executed. | ### Default text patterns The built-in text patterns include: - `*text*` — italic - `**text**` — bold - `#` — heading 1 (up to `######` for heading 6) - `*` or `-` — unordered list - `1.` — ordered list ## Example ```js editor42.init({ selector: 'textarea', forced_root_block: 'div', newline_behavior: 'linebreak', keep_styles: true, text_patterns: [ { start: '*', end: '*', format: 'italic' }, { start: '**', end: '**', format: 'bold' }, { start: '# ', cmd: 'editor42InsertContent', value: '

$1

' } ] }); ``` --- # Content Filtering > Editor42 content filtering options — valid elements, schema validation, entity encoding, and security settings. Source: https://editor42.com/api/configuration/content-filtering Section: Configuration Options > Content Filtering These options control which HTML elements, attributes, and styles are allowed in editor content, how entities are encoded, and various security-related settings. ## Schema and validation | Option | Type | Default | Description | |---|---|---|---| | `schema` | string | `html5` | HTML schema used to validate content. | | `verify_html` | boolean | `true` | Validate HTML against the schema on input and output. | | `valid_elements` | string | — | Rules defining which elements and attributes are valid. Replaces the default set entirely. Uses a compact rule syntax. | | `extended_valid_elements` | string | — | Additional valid element rules added on top of the defaults. Same syntax as `valid_elements`. | | `invalid_elements` | string | — | Comma-separated list of element names to strip from content. | | `valid_children` | string | — | Rules for which elements are allowed as children of other elements. | | `custom_elements` | string | — | Comma-separated custom element names to add to the schema so they are not stripped. | ## Attributes and styles | Option | Type | Default | Description | |---|---|---|---| | `valid_classes` | string/object | — | Restrict which CSS classes are allowed. Pass a string for a global rule or an object keyed by element name. | | `valid_styles` | string/object | — | Restrict which inline styles are allowed. Same format as `valid_classes`. | | `invalid_styles` | string/object | — | Inline styles to strip from content. Same format as `valid_classes`. | ## Cleanup and formatting | Option | Type | Default | Description | |---|---|---|---| | `fix_list_elements` | boolean | `false` | Automatically fix improperly nested list elements. | | `remove_trailing_brs` | boolean | `true` | Remove trailing `
` tags that browsers insert at the end of blocks. | | `pad_empty_with_br` | boolean | `false` | Pad empty block elements with `
` instead of ` `. | | `preserve_cdata` | boolean | `false` | Preserve CDATA sections in content instead of converting them to comments. | | `element_format` | string | `html` | Output format for void elements. `html` produces `
`, `xhtml` produces `
`. | ## Entity encoding | Option | Type | Default | Description | |---|---|---|---| | `entity_encoding` | string | `named` | How entities are encoded in the output. `named` uses HTML entity names, `numeric` uses numeric codes, `raw` outputs raw characters. | | `entities` | string | — | Custom entity definition string, as semicolon-separated name/value pairs. | | `encoding` | string | — | Output encoding. Set to `xml` to produce XML-compatible output. | ## Content protection | Option | Type | Default | Description | |---|---|---|---| | `protect` | RegExp[] | — | Array of regular expressions matching content that should be protected from the parser and filtering. | | `convert_fonts_to_spans` | boolean | `true` | Convert deprecated `` elements to `` elements with inline styles. Deprecated option. | | `inline_styles` | boolean | `true` | Use inline styles instead of HTML attributes for formatting. Deprecated option. | ## Security | Option | Type | Default | Description | |---|---|---|---| | `xss_sanitization` | boolean | `true` | Enable XSS sanitization of content. | | `allow_conditional_comments` | boolean | `false` | Allow HTML conditional comments in content. | | `allow_html_data_urls` | boolean | `false` | Allow `data:` URLs in HTML attributes. | | `allow_svg_data_urls` | boolean | — | Allow `data:` URLs specifically for SVG content. | | `allow_unsafe_link_target` | boolean | `false` | Allow `target="_blank"` on links without automatically adding `rel="noopener"`. | | `allow_script_urls` | boolean | `false` | Allow `javascript:` URLs in href and src attributes. | | `allow_html_in_named_anchor` | boolean | `false` | Allow HTML content inside named anchor elements. | | `sandbox_iframes` | boolean | `true` | Add a `sandbox` attribute to all `