Skip to content
Free · MIT · v1.11.0

A free WYSIWYG HTML editor with a file manager

WDS Editor turns any textarea into a rich text editor with image upload, a built-in file manager, tables and clean HTML output. No paid add-ons, no API key, no tracking.

npm install wds-editor
  • Free file managerBrowse, upload, paste and drop images. Server code for ASP.NET Core, PHP, Node.js and Python.
  • Image editorCrop, rotate, resize and convert to WebP before upload.
  • Accessibility checkAlt text, headings, links and contrast with quick fixes.
  • Clean, safe HTMLWord paste cleanup and a strict schema for every load.
  • React, Vue and AngularOfficial components with two-way binding.

Live demo

The demo file manager reads a static files.json. Uploaded and edited images stay in your browser (an upload function returns a local preview URL) and delete is switched off. AI answers are simulated in your browser (no AI is called), and the @ people and # tags come from a fixed list. Nothing you type leaves your browser; autosave keeps a draft in this browser only.

Everything a CMS editor needs

All features are in the free build. Nothing is sold as a premium plugin.

Inline editing

Edit page sections in place with the page's own styles. The toolbar floats above the text while you write.

Version history

Versions are saved while you write. Compare any of them with the current text, word by word, and restore it.

Word, PDF and HTML export

Download the text as a real Word file made in the browser, print it or save it as PDF. No server and no paid plugin.

Basic, standard, advanced

Pick a toolbar for the job: short for comments, standard for blog posts, everything for full pages.

AI writing assistant

Improve, fix, shorten, translate, summarize or continue text. The answer streams into a panel and nothing changes until you choose. Works with your own AI endpoint; ready Claude examples included.

Mentions and tags

Type @ to mention people and # for tags, from a list or your API. Saved as data attributes your server can read.

Character and word limits

maxLength and maxWords stop typing and cut pastes at the limit, with a live counter that turns amber, then red.

Snippet library

Insert ready callouts, cards, pricing tables, FAQ and testimonials for Bootstrap 5, Bootstrap 6 or Tailwind. The text stays editable; a block toolbar edits, moves or deletes them.

Free file manager

Folders, new folder and rename, search, grid and list views, drag and drop upload, alt text, width and alignment. Ready server code for ASP.NET Core, PHP, Node.js and Python.

Image editor

Crop with fixed ratios, rotate, flip, resize and convert to WebP in the browser. Large uploads are scaled down automatically.

Accessibility check

Finds missing alt text, skipped headings, vague links, tables without headers and low contrast, with one-click fixes.

Custom buttons

Add your own toolbar buttons and "/" menu entries with a few lines of code.

Images and captions

Resize with a corner handle, align left, center or right, and add a caption as figure and figcaption.

Tables

Size picker, header rows and columns, insert and delete rows, merge and split cells, Tab to the next cell.

Fonts and spacing

Font, font size and line spacing lists you can change, subscript and superscript, and a special characters picker.

Checklists

To-do lists with real checkboxes; type [ ] to start one. The HTML reads well on any site and in Markdown.

Clean paste

Word, Google Docs and Excel noise is removed and Word lists become real lists. Paste-as-text inserts plain paragraphs only.

Safe HTML

A strict schema drops scripts, event handlers and javascript: links from pasted and loaded HTML.

Themes and colors

Light, dark and auto themes and a small text color and highlight palette.

Your site's styles

Show the content with your Bootstrap, Tailwind or own CSS, scoped to the editor so the admin page is not affected.

Video embeds

YouTube (privacy-enhanced player) and Vimeo from a link or embed code, with responsive output.

Find and replace

Ctrl+F opens a find and replace bar with match case and replace all in one undo step.

"/" block menu

Type / on an empty line to insert headings, lists, tables, code, images or videos.

Selection toolbar

Bold, italic, link and colors appear right above the selected text.

Code blocks

Language picker and syntax colors while editing; the HTML stays ready for Prism or highlight.js.

Markdown

Paste Markdown and it is formatted; getMarkdown() and setMarkdown() for import and export.

Emoji picker

Search, eight categories and recently used emoji, inserted as plain text.

Templates

Ready content blocks with a live preview, from inline HTML or a URL loaded on demand.

Shortcodes

WordPress-style [gallery id="3"] codes shown as chips that cannot be broken; the HTML keeps plain text.

Autosave

Drafts are kept in the browser and can be restored after a crash or a closed tab.

React, Vue and Angular

Official components with two-way binding: value and onChange, v-model, ngModel and reactive forms.

11 languages

English and Turkish built in, nine more as small files, and right-to-left support for Arabic.

Install

Add two files from the jsDelivr CDN and call WDSEditor.init. When the target is a <textarea>, the editor keeps it in sync, so a normal form post keeps working.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/wds-editor@1/dist/wds-editor.min.css">
<script src="https://cdn.jsdelivr.net/npm/wds-editor@1/dist/wds-editor.min.js"></script>

<form method="post">
  <textarea id="content" name="content"><p>Hello world</p></textarea>
  <button>Save</button>
</form>

<script>
  WDSEditor.init({ selector: '#content' });
</script>

Or install the package from npm (ES module and TypeScript types included):

npm install wds-editor
import { WDSEditor } from 'wds-editor';
import 'wds-editor/style.css';

const editor = WDSEditor.init({ selector: '#content' });

Step-by-step guides with form, image upload and HTML cleaning in your stack:

AI writing assistant

With ai the toolbar, the selection toolbar and the / menu get an AI button. It works on the selected text, or on the paragraph with the cursor: Improve writing, Fix spelling and grammar, Make shorter or longer, Simplify, a professional or friendly tone, Summarize, Translate, Continue writing and Ask AI… for your own instruction. The answer streams into a panel; nothing reaches the document until the writer presses Replace or Insert below, they can ask for changes first (“shorter”, “more formal”), and one undo brings the original back.

WDSEditor.init({
  selector: '#content',
  ai: {
    url: '/ai',                                   // your endpoint, see the server examples
    headers: { 'X-CSRF-Token': token },           // optional
    // Optional: your own menu, built-in actions plus your own prompts
    actions: ['improve', 'fix', 'shorten', '|', 'translate', 'summarize', '|',
              { label: 'Write a meta description', prompt: 'Write an SEO meta description of at most 155 characters.' }],
    languages: ['English', 'Deutsch', 'Türkçe']   // targets of "Translate"
  }
});

Bring your own server. The editor never talks to an AI provider and never sees an API key: it posts the action and the text as Markdown to your endpoint, and your server adds the instructions, calls the model you choose and streams Markdown back. Visitors can only pick an action, so they cannot change your prompts, and you decide who may use it and how often.

POST /ai   { "action": "improve", "text": "Markdown of the selection", "locale": "en" }
           // translate adds "language": "Deutsch"; custom adds "prompt": "the user's instruction"

200 text/event-stream
data: {"text":"Hello "}
data: {"text":"**world**"}
data: [DONE]                                     // or one JSON { "text": "..." }, or text/plain

4xx/5xx    { "error": "Too many requests" }      // shown in the panel

The server examples include a ready endpoint for ASP.NET Core (WdsAi.cs), Node.js (wds-ai.mjs), Python (wds_ai.py) and PHP (ai.php). They use Claude through Anthropic’s official SDK, check the request, keep the prompts for every action in one list you can edit, stream the answer and stop the model when the writer presses Stop:

// npm install @anthropic-ai/sdk  ·  ANTHROPIC_API_KEY on the server only
import { createAiHandler } from './wds-ai.mjs';      // from examples/node
app.use(createAiHandler({ path: '/ai', authorize: (req) => !!req.session?.user }));
// No endpoint? Pass a function: return a string, a Promise or an async iterable (streaming)
ai: {
  request: async ({ action, text, prompt, language }, signal) => {
    const res = await fetch('/my/api', { method: 'POST', body: JSON.stringify({ action, text }), signal });
    return (await res.json()).text;
  }
}

Every request costs you money, so allow only signed-in users and add a rate limit before going live. The live demo above simulates the answers in your browser; no text is sent anywhere.

Mentions, tags and character limits

With mentions, typing @ after a space suggests people and # suggests tags. A source can be a list, a URL that answers ?q= with JSON, or a function. Items can have an avatar and a description; arrow keys and Enter pick one. Mentions are saved as links or spans with data-mention and data-id, so your server can notify people or file the post under its tags without parsing text.

maxLength and maxWords set a limit, for example for comments, product summaries or meta descriptions. Typing stops at the limit, pasted text is cut to fit, the counter shows 120 / 160 and turns amber near the limit and red at it, and the limit event fires. Content that is already over the limit can still be shortened.

WDSEditor.init({
  selector: '#content',
  mentions: [
    // @ people from your API: GET /api/users?q=ay  ->  [{ id, label, avatar?, description? }]
    { source: '/api/users', url: '/users/{id}' },
    // # tags from a list; allowNew lets writers create a tag that is not in the list
    { trigger: '#', source: [{ id: 'news', label: 'news' }, { id: 'release', label: 'release' }], allowNew: true }
  ],
  maxLength: 2000,      // characters (line breaks not counted)
  maxWords: 300
});

// Saved HTML: <a class="mention" data-mention="@" data-id="42" href="/users/42">@Ayşe Demir</a>
editor.getMentions();   // [{ trigger: '@', id: '42', label: 'Ayşe Demir', href: '/users/42' }]

Inline editing and version history

With inline: true the editor works on an element of the page instead of a textarea: a section, an article or a card. There is no frame and the content keeps the page's own CSS, so writers see the real page. The toolbar floats above the element while it has focus and sticks to the top of the window in long sections. Try it, the card below is editable:

Click the text to edit it

Fresh bread every morning

Our bakery opens at 7:00. Sourdough, rye and seeded loaves come out of the oven before the first coffee is poured.

Order before noon and pick it up the same afternoon.

<article id="about" class="post">
  <h2>About us</h2>
  <p>This text is edited right on the page, with the page's own styles.</p>
</article>

<script>
  const editor = WDSEditor.init({ selector: '#about', inline: true, preset: 'standard' });

  // Save when the writer is done, for example from your own button
  saveButton.addEventListener('click', () =>
    fetch('/api/pages/about', { method: 'PUT', body: editor.getHTML() }));
</script>

With versions the editor keeps snapshots in the browser: every few minutes while writing, when the form is sent, before a version is restored and when the writer presses Save version. The version history button lists them; pick one to see what is different from the current text, word by word, and restore it in one undo step. The demo editor above has it: change some text and open the clock button.

WDSEditor.init({
  selector: '#content',
  versions: {
    key: 'post-42',   // one key per document
    max: 30,          // versions kept (oldest dropped first)
    interval: 5       // minutes between automatic versions while writing
  }
});

editor.on('versionRestore', (e, version) => console.log('Restored', version.time));

Versions stay on the writer's device (localStorage) and are never sent anywhere. To keep a server-side history, save getVersions() or getHTML() with your own request.

Word, PDF and HTML export

The export button in the standard and advanced toolbars offers three formats. Everything happens in the browser: no server, no upload and no paid plugin.

  • Word document (.docx): a real Word file with headings, bold and italic, colors and highlights, fonts and sizes, links, nested and numbered lists, checklists, quotes, code, tables with merged cells and header rows, images with captions and right-to-left text. WebP and SVG images are converted to PNG, and videos become links. It is a standard .docx file that opens in Microsoft Word.
  • PDF or print: the browser's print dialog with only the content and a clean page layout. Save as PDF keeps the text selectable and the links clickable. With contentCss the printed page uses your site's CSS.
  • HTML file: the content as a complete page with a small stylesheet, ready to open or send.

The file is named after the first heading, or after export.title. Try it in the live demo: press the download arrow next to the clock button.

const editor = WDSEditor.init({
  selector: '#content',
  export: {
    title: 'Quarterly report',   // file name and document title (default: the first heading)
    pageSize: 'a4'               // or 'letter'
  }
});

// Your own buttons instead of the toolbar menu
wordButton.addEventListener('click', () => editor.downloadDocx());
pdfButton.addEventListener('click', () => editor.print());

// Send the Word file to your server
const blob = await editor.exportDocx();
await fetch('/api/reports/42/docx', { method: 'PUT', body: blob });

Images are fetched and embedded in the Word file. Images from another site need CORS headers there (and connect-src in your Content-Security-Policy); images that cannot be read keep their alt text and the writer sees how many were left out. To fetch them another way, for example through your own server, pass export.loadImage: (src) => Promise<{ data: Uint8Array, type: 'png' | 'jpeg' | 'gif' } | null>. The npm build loads the Word writer only when it is used (about 9 KB gzip).

Snippet library: ready blocks for Bootstrap and Tailwind

With snippets the toolbar and the / menu get a block library: callouts, cards, buttons, features, pricing tables, testimonials, calls to action, FAQ, stats, team and media blocks from WebDevSnippets editor blocks. Each block is written with your framework's classes only, without custom CSS or JavaScript, so it looks right on your site and every word stays editable in the editor. Pick the framework your site uses; if contentCss is not set, the content area loads that framework's CSS so the blocks look like the published page.

// Blocks for your site's framework: 'bootstrap5' (default), 'bootstrap6' or 'tailwind'
WDSEditor.init({ selector: '#content', snippets: { framework: 'bootstrap5' } });

// Your site's CSS is used when contentCss is set; otherwise the framework CSS is loaded
WDSEditor.init({ selector: '#content', contentCss: '/css/site.css', snippets: { framework: 'tailwind' } });

// Your own block list: { blocks: [{ id, title, group, html, thumb }] }
WDSEditor.init({ selector: '#content', snippets: { url: '/cms/blocks.json', loadCss: false } });

Click into a block and a small block toolbar appears above it: Edit block HTML opens the block's source (Ctrl+Enter saves), the arrows move the block up or down, and the bin deletes it. Since 1.7 the editor keeps class attributes on paragraphs, headings, lists, tables, images, links and classed div, section, article, header, footer and aside blocks. Content pasted from other sites or Word still loses its classes, so foreign styles do not leak in.

Fonts, spacing, special characters and checklists

The toolbar has dropdowns for the font, the font size and the line spacing. The first entry of each list removes the value, so the text follows your site's typography again. Set your own lists with fontFamilies, fontSizes and lineHeights; values that are not in the list (from pasted content) are still shown. Fonts are written as <span style="font-family: …"> and line spacing as line-height on the paragraph.

  • Subscript and superscript (<sub>, <sup>) for H2O or m2: Ctrl+, and Ctrl+..
  • Special characters: dashes and quotes, currency (€ £ ₺ ₹), math (± × ≤ ∞), arrows, accented letters, Greek and symbols (© ™ ✓), with search and recently used.
  • Checklists: the checklist button, the "/" menu or typing [ ] (or [x]) and a space. Click a checkbox to tick it. The saved list carries inline styles, so it reads well on a site without extra CSS; Markdown export writes - [x].
WDSEditor.init({
  selector: '#content',
  // Your own lists for the font, size and line spacing dropdowns (optional)
  fontFamilies: ['Inter, sans-serif', { label: 'Serif', value: 'Georgia, serif' }],
  fontSizes: ['14px', '16px', '20px', '28px'],
  lineHeights: ['1', '1.5', '2'],
  toolbar: 'blocks fontFamily fontSize | bold italic subscript superscript | taskList charmap | lineHeight'
});

// A checklist in the saved HTML (inline styles, readable on any site):
// <ul class="wds-checklist" data-type="taskList" style="list-style: none; padding-left: 0">
//   <li data-checked="true" style="display: flex; gap: 0.5em; align-items: baseline">
//     <input type="checkbox" disabled checked style="margin: 0"><div style="flex: 1; min-width: 0"><p>Done</p></div>
//   </li>
// </ul>

Fonts, sizes and line heights from pasted Word or Google Docs content are removed, so pasted text takes your site's typography; content copied from another WDS Editor keeps them.

Markdown, code blocks and the "/" menu

Type / at the start of a paragraph to insert a block, and select text for a small formatting toolbar. Code blocks have a language picker and syntax colors while editing; the saved HTML is <pre><code class="language-php">, ready for Prism or highlight.js on your site. Pasted Markdown is formatted, and getMarkdown() / setMarkdown() convert the content both ways.

WDSEditor.init({
  selector: '#content',
  codeLanguages: ['html', 'css', 'javascript', 'php'],   // code block picker
  bubbleToolbar: 'bold italic link',                    // toolbar above selected text (or false)
  slashMenu: true,                                      // "/" opens the block menu
  markdownPaste: true                                   // pasted Markdown is formatted
});

editor.getMarkdown();                 // GitHub-flavored Markdown
editor.setMarkdown('# Title\n\nSome **bold** text');

React, Vue and Angular

Official components keep the HTML in sync both ways, switch read-only mode with disabled and take every editor option through options. Server rendering (Next.js, Nuxt, Angular SSR) outputs an empty element and the editor starts in the browser. Add wds-editor/style.css once.

React 17+ (wds-editor-react)

// npm install wds-editor wds-editor-react
import { WdsEditor } from 'wds-editor-react';
import 'wds-editor/style.css';

const [html, setHtml] = useState('<p>Hello</p>');
<WdsEditor value={html} onChange={setHtml} options={{ height: 400 }} />

Vue 3.3+ (wds-editor-vue)

<!-- npm install wds-editor wds-editor-vue -->
<script setup>
import { ref } from 'vue';
import { WdsEditor } from 'wds-editor-vue';
import 'wds-editor/style.css';
const html = ref('<p>Hello</p>');
</script>

<template>
  <WdsEditor v-model="html" :options="{ height: 400 }" />
</template>

Angular 17+ (wds-editor-angular)

// npm install wds-editor wds-editor-angular
import { WdsEditorComponent } from 'wds-editor-angular';

@Component({
  standalone: true,
  imports: [WdsEditorComponent, FormsModule],
  template: `<wds-editor [(ngModel)]="html" [options]="{ height: 400 }"></wds-editor>`
})
export class PostFormComponent { html = '<p>Hello</p>'; }

The Angular component also works with reactive forms ([formControl]), and without zone.js.

Languages

English and Turkish are built in. German, French, Spanish, Portuguese, Italian, Russian, Chinese, Japanese and Arabic are separate files of about 4 KB, so you only load the language you use. Load the file next to the editor and pick the language:

<script src="https://cdn.jsdelivr.net/npm/wds-editor@1/dist/wds-editor.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/wds-editor@1/dist/lang/de.js"></script>
<script>
  WDSEditor.init({ selector: '#content', language: 'de' });
</script>

With npm, import the language and register it:

import { WDSEditor } from 'wds-editor';
import de from 'wds-editor/lang/de';

WDSEditor.addLanguage('de', de);
WDSEditor.init({ selector: '#content', language: 'de' });

Codes: de fr es pt it ru zh ja ar. Region codes such as de-AT fall back to the language, and unknown languages to English. Arabic switches the toolbar, menus, lists and arrow keys to right-to-left; the HTML source view stays left-to-right.

Presets: basic, standard or advanced

One editor, three sizes. Pick a preset for the place where it is used, and the toolbar shows only what that place needs. Buttons that need an option, such as the file manager, templates, the snippet library or the AI assistant, appear only when that option is set.

PresetForToolbar
"basic"Comments, forum posts, reviews, short descriptionsBold, italic, underline, strikethrough, link, emoji, lists, quote, clear formatting. No / menu.
"standard"Blog posts, CMS pages, product descriptions, newslettersAdds headings, colors, images, files, video, tables, checklists, alignment, accessibility check, Word and PDF export and HTML source.
"advanced"Full page editing and admin panels (the default)Everything: fonts and sizes, sub- and superscript, special characters, indent, line spacing, paste as text, full screen.
// Comment box: short toolbar, no "/" menu
WDSEditor.init({ selector: '#comment', preset: 'basic', maxLength: 1000 });

// Blog post or CMS page
WDSEditor.init({ selector: '#post', preset: 'standard', fileManager: { listUrl: '/files' } });

// Start from a preset and add your own items
WDSEditor.init({
  selector: '#product',
  toolbar: [...WDSEditor.presets.basic, '|', 'image', 'table']
});

The toolbar, bubbleToolbar and slashMenu options still win over the preset, and keyboard shortcuts and Markdown typing keep working with every preset. Try them in the live demo with the toolbar select.

Lite build

For comment boxes, forums and other pages where every kilobyte counts, load wds-editor.lite.min.js instead of wds-editor.min.js. It is about 130 KB gzip instead of 190 KB, with the same API, CSS, language files and options.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/wds-editor@1/dist/wds-editor.min.css">
<script src="https://cdn.jsdelivr.net/npm/wds-editor@1/dist/wds-editor.lite.min.js"></script>

<script>
  WDSEditor.init({ selector: '#comment', preset: 'basic' });
  console.log(WDSEditor.lite); // true
</script>

Lite build keeps

  • Text formatting, headings, lists and checklists
  • Quotes and code blocks
  • Links, images and the file manager
  • Video, tables, colors, fonts and sizes
  • Alignment, HTML source and full screen
  • The / menu and the selection toolbar
  • Inline mode, presets, autosave and limits
  • All languages and right-to-left

Only in the full build

  • Markdown paste and conversion
  • Code colors, find and replace
  • Emoji and special characters
  • Image editor and accessibility check
  • AI assistant and mentions
  • Snippet library, templates and shortcodes
  • Version history
  • Word, PDF and HTML export

Toolbar buttons of the left-out features are hidden, their options log a warning in the console, and WDSEditor.lite is true. The browser's own Ctrl+F search still works. With npm and a bundler, use the normal package: the Word writer, emoji and special characters are already loaded only when used.

Site styles: Bootstrap, Tailwind or your own CSS

Give the editor the stylesheets of the site where the HTML is published, and the content area looks exactly like the page. Every rule is scoped to the editor content, so your admin panel keeps its own look. Files load with fetch, so use the same origin or a CDN with CORS headers such as jsDelivr.

// Bootstrap: the content looks like your Bootstrap pages
WDSEditor.init({
  selector: '#content',
  contentCss: 'https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css'
});

// Tailwind CSS: your compiled CSS file and the Typography plugin's prose class
WDSEditor.init({ selector: '#content', contentCss: '/css/site.css', contentClass: 'prose' });

Video, find and replace, autosave

The video button embeds YouTube and Vimeo videos from a link or pasted embed code; other iframes are removed. Pages that show the HTML need frame-src https://www.youtube-nocookie.com https://player.vimeo.com in their Content Security Policy. Ctrl+F opens find and replace. With autosave a draft is kept in the browser and offered again when the page is reopened; submitting the form removes it. After saving with fetch, call editor.clearDraft(). Use one key per document; drafts are saved one second after a change (delay), ignored after expires days (default 7) and never leave the user's device.

WDSEditor.init({ selector: '#content', autosave: { key: 'post-42' } });

Emoji, templates and shortcodes

The emoji button opens a picker with search and recently used emoji. With templates a template button inserts ready content blocks after the current paragraph; template HTML goes through the same safe schema. With shortcodes the listed names, such as [gallery id="3"] or [button]…[/button], become chips that are edited with a double click and saved as plain text.

WDSEditor.init({
  selector: '#content',
  templates: [
    { title: 'Product review', description: 'Rating, pros and cons', html: '<h2>Product</h2><p>Rating: 4/5</p>' },
    { title: 'Press release', url: '/templates/press-release.html' }   // loaded when chosen
  ],
  shortcodes: ['gallery', { name: 'button', label: 'Button', insert: '[button url=""]Click me[/button]' }]
});

Image editor and upload processing

Select an image in the file manager and press Edit image, or double-click an image in the content and choose Edit image in its dialog. Users can crop freely or with a fixed ratio (1:1, 4:3, 3:2, 16:9, 3:4, 9:16), rotate, flip, set the width and convert to WebP, JPEG or PNG. Everything happens in the browser with a canvas; the result is uploaded as a new file, so the original stays untouched. The crop area works with the mouse, touch and the arrow keys (Shift + arrows resize it).

The images option also processes every upload, including pasted and dropped images: photos larger than maxWidth or maxHeight are scaled down, and format: 'webp' converts them, which often makes them several times smaller. GIF (animations) and SVG are uploaded as they are. The image editor needs uploadUrl or an upload function; images from another site can only be edited when that site sends CORS headers.

WDSEditor.init({
  selector: '#content',
  fileManager: { listUrl: '/files/list', uploadUrl: '/files/upload' },
  images: {
    edit: true,          // "Edit image" in the file manager and the image dialog (default)
    maxWidth: 1600,      // larger uploads are scaled down in the browser
    maxHeight: 1600,
    format: 'webp',      // convert uploads: 'webp', 'jpeg', 'png' or 'keep' (default)
    quality: 0.85        // WebP and JPEG quality, 0.1 – 1
  }
});

editor.openImageEditor();   // edit the selected image

Accessibility check

The accessibility button checks the content against common WCAG 2.2 rules and lists every problem with a Show button that selects it:

  • Images without alternative text and videos without a title: type the text right in the list.
  • Empty headings and skipped heading levels (an H4 after an H2): one click changes the level.
  • Vague link texts such as "click here", "read more" or "devamını oku", in all 11 editor languages.
  • Tables without a header row: one click makes the first row a header.
  • Low text contrast: colored text below 4.5:1 (3:1 for large headings), measured against the highlight color when there is one.

Run the check from your own code too, for example before publishing:

const issues = editor.checkAccessibility();
// [{ rule: 'image-alt', pos: 12, to: 13, excerpt: 'team.jpg' },
//  { rule: 'heading-order', excerpt: 'Pricing', data: { level: '4', previous: '2', expected: '3' } }, …]

if (issues.length) editor.openAccessibilityCheck();   // the same panel as the toolbar button

The editor's own interface also follows the rules: every button has a name, dialogs are modal and keyboard friendly, and menus work with the arrow keys. Automated checks catch common problems only; also test the published page.

Custom toolbar buttons and "/" menu entries

Add your own buttons for things your CMS needs: a signature, a product box, an AI helper or a link to your media library. With the default toolbar they appear in their own group before the HTML source button; with your own toolbar, put their names where you want them. isActive and isEnabled run after every change.

const editor = WDSEditor.init({
  selector: '#content',
  buttons: {
    signature: {
      label: 'Insert signature',                    // tooltip and screen reader name
      icon: '<svg viewBox="0 0 24 24">…</svg>',     // or leave it out for a text button
      onClick: (editor) => editor.insertHTML('<p>— The editorial team</p>'),
      isActive: (editor) => false,                  // optional, shows the button as pressed
      isEnabled: (editor) => !editor.isReadOnly()   // optional
    }
  },
  slashItems: [
    { label: 'Call to action', keywords: 'cta button', run: (editor) => editor.insertBlocks('<p><a href="/signup">Sign up free</a></p>') }
  ]
});

// Later, for example from a plugin:
editor.addButton('wordGoal', { label: 'Goal', onClick: () => alert(editor.getText().split(/\s+/).length + ' words') });
editor.addSlashItem({ label: 'Note', icon: '<b>N</b>', run: (e) => e.insertBlocks('<blockquote><p>Note: </p></blockquote>') });

// With your own toolbar, list the names where the buttons go:
WDSEditor.init({ selector: '#content', toolbar: 'bold italic link | signature', buttons: { signature: { … } } });

The icon is inserted as HTML, so only pass markup you control. Without an icon the button shows its label as text.

Tables, images, colors and paste

  • Tables: the table button shows a size picker; inside a table it opens the row and column menu (insert, delete, header row or column, merge and split cells, delete table). Drag across cells to select them. Tab moves to the next cell and adds a row in the last one.
  • Images: click to select, drag the corner handle to resize, double-click for alt text, width, alignment and caption (<figure> with <figcaption>). Alignment is written as inline styles, so it works on any site.
  • Colors: text color and highlight use a small palette (10 text colors, 6 highlights) so content stays consistent; change it with the colors option. Pasted colors are kept only when they are real colors.
  • Paste: Word, Google Docs and Excel noise is removed automatically, Word's list paragraphs become real (nested) lists and the source document's fonts are dropped. The paste-as-text button (or Ctrl+Shift+V) inserts plain paragraphs only.

File manager

Most editors sell their file manager as a paid add-on. In WDS Editor it is free and needs only one URL that returns a JSON list. Upload, delete, new folder and rename are optional.

Ready server code for list, upload, delete, new folder and rename

WDSEditor.init({
  selector: '#content',
  fileManager: {
    listUrl: '/files/list',        // required: returns the JSON below
    uploadUrl: '/files/upload',    // optional: shows the Upload button
    deleteUrl: '/files/delete',    // optional: shows the Delete button
    folderUrl: '/files/folder',    // optional: shows New folder
    renameUrl: '/files/rename',    // optional: shows Rename
    headers: { 'X-CSRF-TOKEN': token },
    withCredentials: false,
    accept: 'image/*'              // what the image button lists (default image/*)
  }
});

// Your own upload code instead of uploadUrl (S3, Firebase, a signed URL...)
fileManager: {
  listUrl: '/files/list',
  upload: async (file, path, onProgress) => {
    const url = await uploadToStorage(file, path, onProgress);
    return { url, name: file.name };
  }
}

GET listUrl?path=&q=&page= returns:

{
  "path": "/blog",
  "folders": [{ "name": "2026", "path": "/blog/2026" }],
  "files": [
    { "url": "/uploads/blog/team.jpg", "name": "team.jpg", "width": 1200, "height": 800, "size": 184320 }
  ],
  "hasMore": false
}
  • Only url and name are required for each file; a static files.json works too.
  • POST uploadUrl (multipart: file, path) returns { "file": { ... } }. Or pass an upload(file, path, onProgress) function that resolves with { url, name } to upload with your own code.
  • POST deleteUrl (JSON: { "url": "..." }) returns { "ok": true }.
  • POST folderUrl (JSON: { "path": "/2026", "name": "Summer" }) returns { "folder": { "name": "summer", "path": "/2026/summer" } } and shows a New folder button.
  • POST renameUrl (JSON: { "url": "...", "name": "beach" }) returns { "file": { ... } } with the new url and shows Rename. The server must keep the file's extension, so a photo cannot be renamed to .php or .html. Pages that already link to the old address need to be updated.
  • Optional file fields: size, type, width, height, thumb and modified. A plain array of files works too.
  • Echo "q" when your server searches; otherwise the editor filters the loaded list by name. hasMore: true shows a "Load more" button that requests the next page.
  • Errors: any 4xx or 5xx status, optionally with { "error": "Message" }, which is shown to the user.

Server examples: ASP.NET Core, PHP, Node.js and Python

Ready, tested code for the endpoints (list, upload, delete, new folder and rename; the tabs show the first three, GitHub has all five). Every example keeps paths inside the upload folder (no ..), allows only listed extensions (no SVG, which can carry scripts), limits uploads to 10 MB, turns names like Yaz Kampanyası.JPG into yaz-kampanyasi.jpg and never overwrites a file. Edited images from the image editor use the same upload endpoint. Point the editor at your endpoints:

WDSEditor.init({
  selector: '#content',
  fileManager: {
    listUrl: '/files/list',
    uploadUrl: '/files/upload',
    deleteUrl: '/files/delete',
    folderUrl: '/files/folder',
    renameUrl: '/files/rename',
    headers: { 'X-CSRF-TOKEN': csrfToken }   // when you use cookie login
  }
});

Minimal API for .NET 8 or newer. Protect the group with RequireAuthorization() and, with cookie login, send the antiforgery token in fileManager.headers.

// Program.cs (.NET 8+). Files go to wwwroot/uploads and are served by UseStaticFiles.
var files = app.MapGroup("/files").RequireAuthorization();

files.MapPost("/upload", async (HttpRequest request) =>
{
    var form = await request.ReadFormAsync();
    var file = form.Files.GetFile("file");
    if (file is null || file.Length == 0) return Error(400, "No file");
    if (file.Length > MaxSize) return Error(413, "File is too large");
    var ext = Path.GetExtension(file.FileName);
    if (!allowed.ContainsKey(ext)) return Error(415, "This file type is not allowed");
    if (!TryResolve(form["path"], out var dir, out var virtualPath)) return Error(400, "Invalid path");
    Directory.CreateDirectory(dir);

    // "Yaz Kampanyası.JPG" -> "yaz-kampanyasi.jpg", never overwrites: "-1", "-2"...
    var name = FreeName(dir, SafeName(file.FileName, ext.ToLowerInvariant()));
    await using (var stream = new FileStream(Path.Combine(dir, name), FileMode.CreateNew))
        await file.CopyToAsync(stream);
    return Results.Json(new { file = Describe(new FileInfo(Path.Combine(dir, name)), virtualPath) });
});

// GET /files/list and POST /files/delete, TryResolve, SafeName and FreeName: see the full example
Full example on GitHub

No server code yet? A static files.json is enough to browse and insert files. Add your own authentication before going live, and sanitize the posted HTML on the server as well.

Options

OptionDefaultDescription
selector–CSS selector or element; a textarea is recommended.
height / minHeightauto / 240Fixed height, or the minimum height of an auto-growing editor.
contenttextarea valueInitial HTML.
placeholder–Text shown while the editor is empty.
languagebrowser"en", "tr", a loaded language file such as "de", or your own messages.
dir"auto""auto" turns right-to-left on for Arabic; "ltr" or "rtl" forces a direction.
theme"light""light", "dark" or "auto".
preset"advanced""basic", "standard" or "advanced": toolbar, selection toolbar and / menu by use. See Presets.
toolbarpresetA preset name, a string like "bold italic | link image", an array (start from WDSEditor.presets.basic), or false.
contentCss–Stylesheet URL(s) of your site; the content looks like the published page.
contentClass–Classes for the content element, e.g. "prose" for Tailwind Typography.
contentStyle–Extra CSS for the content area.
autosavefalsetrue or { key, delay, expires }: keeps a draft in localStorage.
codeLanguages19 languagesLanguages of the code block picker, e.g. ['javascript', 'php'].
codeHighlighttrueSyntax colors in code blocks while editing.
markdownPastetruePasted Markdown text becomes formatted content.
slashMenutrue/ opens the block menu.
bubbleToolbarbold … highlightItems of the toolbar above selected text, or false.
templates–[{ title, description, html }] or { title, url }: shows the template button.
ai–{ url, request, headers, actions, languages, maxLength }: shows the AI assistant; needs url or request.
mentions–{ trigger, source, url, className, minChars, limit, allowNew } or a list of them: @ mentions and # tags.
inlinefalseEdit a page element in place with a floating toolbar. See Inline editing.
versions–true or { key, max, interval }: version history with compare and restore.
export–{ title, pageSize, loadImage }: file name and title, "a4" or "letter" paper, your own image loader. See Export.
maxLength / maxWords–Character and word limits; typing and pasting stop there.
snippets–true or { framework, url, loadCss }: shows the snippet library; framework is "bootstrap5", "bootstrap6" or "tailwind".
shortcodes–Names or { name, label, insert }: shows codes as chips and the shortcode button.
fileManager–listUrl, uploadUrl or upload, deleteUrl, folderUrl, renameUrl, headers, accept.
imagesedit on{ edit, maxWidth, maxHeight, format, quality }: image editor and upload processing.
buttons–{ name: { label, icon, onClick, isActive, isEnabled } }: your own toolbar buttons.
slashItems–[{ label, icon, keywords, run }]: your own "/" menu entries.
fontFamilies9 fontsFont stacks or { value, label } for the font dropdown.
fontSizes12px – 48pxCSS sizes ("18px", "1.25rem") or { value, label }.
lineHeights1 – 2Line spacing values ("1.5") or { value, label }.
colorsbuilt-in{ text: [...], highlight: [...] } with hex colors.
wordCounttrueShows the word and character counter.
readOnlyfalseStarts in read-only mode.
onChange–(html, editor) => void

Toolbar items

undo redo blocks fontFamily fontSize bold italic underline strike subscript superscript code textColor highlight link image file video emoji charmap table template snippets shortcode blockquote bulletList orderedList taskList outdent indent alignLeft alignCenter alignRight alignJustify lineHeight hr clear pasteText a11y ai versions export print find source fullscreen

find is not in the default toolbar, but Ctrl+F opens it anyway. print is a single print button for your own toolbar; the default toolbar has it in the export menu. file, template, snippets, shortcode, ai and versions only appear when their option is set. Use | for a separator.

API

const editor = WDSEditor.init({ selector: '#content' });

editor.getHTML();                  // clean HTML ("" when empty)
editor.setHTML('<p>Hi</p>');
editor.insertHTML('<strong>at cursor</strong>');
editor.getMarkdown();              // GitHub-flavored Markdown
editor.setMarkdown('# Title');     // and insertMarkdown(md)
editor.getText();
editor.isEmpty();

editor.insertImage({ src: '/img/a.jpg', alt: 'A', width: 400, align: 'center' });
editor.insertImage({ src: '/img/b.jpg', alt: 'B', caption: true });   // <figure>
editor.insertVideo('https://youtu.be/…', { title: 'Demo', width: 640 });
editor.insertBlocks('<h2>Title</h2><p>Text</p>');
editor.insertShortcode('[gallery id="3"]');

editor.openFileManager('image');   // or 'file'
editor.openImageEditor();          // crop, rotate, resize the selected image
editor.checkAccessibility();       // [{ rule, pos, to, excerpt, data }]
editor.openAccessibilityCheck();
editor.addButton('name', { label, icon, onClick, isActive, isEnabled });
editor.addSlashItem({ label, icon, keywords, run });
editor.openFind();
editor.openTemplates();
editor.openSnippets();             // snippet library (snippets option)
editor.openCharacterMap(button);   // special characters under an element
editor.runAi('improve');           // AI panel for the selection (ai option)
editor.runAi('custom', { label: 'Tweet', prompt: 'Rewrite as a tweet' });
editor.getMentions();              // [{ trigger, id, label, href }]
editor.insertMention({ id: 'u1', label: 'Ayşe' });   // insertMention(item, '#') for a tag
editor.getStats();                 // { words, characters }
editor.saveVersion('Before review');   // version history (versions option)
editor.getVersions();              // [{ id, time, html, words, kind, label? }], newest first
editor.restoreVersion(id);         // one undo step brings the previous content back
editor.openVersions();
await editor.downloadDocx();       // Word file named after the first heading
const blob = await editor.exportDocx();   // or the .docx Blob, to upload it yourself
editor.print();                    // print dialog: "Save as PDF"
editor.downloadHtml('page.html');  // complete HTML page; getHtmlDocument() returns it as text
editor.togglePlainPaste(true);
editor.toggleSource();
editor.toggleFullscreen();
editor.setReadOnly(true);
editor.focus();
editor.clearDraft();               // autosave: after saving with fetch
editor.destroy();

editor.on('change', (e) => console.log(e.getHTML()));
editor.on('upload', (e, file) => console.log('uploaded', file.url));
editor.on('fileSelect', (e, file) => console.log('inserted', file.url));
editor.on('limit', (e, stats) => console.log('limit reached', stats));

WDSEditor.initAll('.wds');         // every matching element
WDSEditor.get(element);            // existing instance
WDSEditor.addLanguage('de', de);   // register a language object
WDSEditor.version;

// Also exported for use outside an editor (npm):
import { markdownToHtml, htmlToMarkdown } from 'wds-editor';

Keyboard and Markdown shortcuts

  • Ctrl+B / I / U, Ctrl+K (link), Ctrl+, / . (subscript / superscript), Ctrl+F (find and replace), Ctrl+Z / Y, Tab / Shift+Tab in lists. On macOS use Cmd.
  • Typing # to #### and a space makes a heading, > a quote, - or 1. a list, [ ] a checklist, three backticks a code block and --- a horizontal rule.
  • / opens the block menu; Tab in a code block inserts two spaces.

Security

Pasted and loaded HTML is parsed into a strict schema: scripts, event handlers, unknown tags and javascript: URLs are removed. Always sanitize the HTML on the server as well.

Content Security Policy

The editor needs no inline scripts and no unsafe-eval. Colors and image alignment are written as style attributes, so a strict policy needs style-src 'self' 'unsafe-inline' on the page with the editor (or at least style-src-attr 'unsafe-inline').

How does it compare?

Side-by-side pages with license, price, file manager and feature tables, with sources.

FAQ

Is WDS Editor really free?

Yes. The editor and its file manager are free and open source under the MIT license, also for commercial projects. There is no paid tier and no API key. In return the editor shows a small "Powered by WDS Editor" link in its status bar.

Does the AI assistant need an API key in the browser?

No. The editor only sends the chosen action and the text to your own endpoint; your server keeps the API key and the prompts and calls the AI model. Ready endpoints using Claude for ASP.NET Core, Node.js, Python and PHP are in the examples folder, and the ai.request option lets you call any service you like. Nothing changes in the document until the writer accepts the answer.

Can WDS Editor edit a page section inline?

Yes. With inline: true the editor turns any element, such as an article or a card, into an editing area. The content keeps the page's own styles and the toolbar floats above it while it has focus. Read the HTML with getHTML() and save it with your own request.

Does WDS Editor have version history?

Yes. The versions option saves snapshots in the browser while writing, when the form is sent and on demand. The version history dialog shows the differences with the current text word by word and restores a version in one undo step.

Can WDS Editor export to Word or PDF?

Yes, for free. The export menu downloads a real .docx file made in the browser, with headings, lists, tables, images and links, so no server or paid plugin is needed. PDF goes through the browser's print dialog with a clean page layout, where Save as PDF keeps the text selectable. A complete HTML file is the third option, and exportDocx() returns the Word file as a Blob for your own upload.

Is there a smaller build of WDS Editor?

Yes. wds-editor.lite.min.js is about 130 KB gzip instead of 190 KB. It has the same API, CSS and options and keeps formatting, lists, links, images with the file manager, video, tables, colors and the HTML source view. Markdown, the AI assistant, mentions, the snippet library, templates, version history, Word and PDF export and a few other extras are left out.

Can I make the toolbar smaller?

Yes. Set preset: 'basic' for comment boxes and forum posts, 'standard' for blog posts and CMS pages, or keep the default 'advanced' for full page editing. You can also list exactly the buttons you want with the toolbar option, or start from WDSEditor.presets and add your own.

Can I add @mentions and #tags?

Yes. The mentions option suggests people after @ and tags after #, from a list, your API or a function. They are saved with data-mention and data-id attributes, and getMentions() lists them, so your server can send notifications or file the post under its tags.

Do the snippet library blocks need extra CSS or JavaScript?

No. Every block uses only the classes of Bootstrap 5, Bootstrap 6 or Tailwind CSS, so it works on any page that already loads that framework. For Tailwind, make sure your build includes the classes of the blocks you use (they are listed on each block's page), or load the compiled block CSS from webdevsnippets.com/api/editor/tailwind.css.

Can I remove the "Powered by WDS Editor" link?

No. The link is how the free editor is paid for, so it is always shown. It sits in the editor's status bar only and never appears in the HTML you publish, so your visitors do not see it.

Do I need a special server for the file manager?

No. The file manager reads a simple JSON list. A static files.json works, and there are ready, tested server examples for ASP.NET Core, PHP, Node.js and Python (Flask) that add upload, delete, new folders and rename.

Can I paste from Word or Google Docs?

Yes. Pasted content is cleaned automatically: office styles, fonts, classes and scripts are removed and headings, lists (also Word's nested lists), tables (also from Excel) and links are kept. A paste-as-text button inserts plain paragraphs only.

Is the HTML output safe?

The editor parses all HTML into a strict schema, so scripts, event handlers and javascript: links are dropped. Always sanitize the HTML on the server as well.

Can the editor show my Bootstrap or Tailwind styles?

Yes. Pass your stylesheet with the contentCss option, and for Tailwind also contentClass: 'prose'. The content area then looks like your published page, while the rest of the admin page keeps its own styles.

Does it keep my text if the browser closes?

With the autosave option the editor keeps a draft in the browser's local storage and offers to restore it when the page is opened again. The draft never leaves the device and is removed when the form is submitted.

Does it support shortcodes and templates?

Yes. List your shortcode names with the shortcodes option and codes like [gallery id="3"] are shown as chips that cannot be broken by accident, while the HTML keeps them as plain text for your CMS. The templates option adds a template button with a live preview.

Does it work with React, Vue and Angular?

Yes. The official packages wds-editor-react, wds-editor-vue and wds-editor-angular wrap the editor as a component with two-way binding (value and onChange, v-model, ngModel or reactive forms), a disabled state and all editor options.

Can I write in Markdown?

Yes. Pasted Markdown text is formatted automatically, getMarkdown() and setMarkdown() read and write GitHub-flavored Markdown, and typing # , - or three backticks at the start of a line works as in Markdown. The saved content is still clean HTML.

Can users crop and resize images in the editor?

Yes. The built-in image editor crops (free or fixed ratios such as 16:9), rotates, flips, resizes and converts images to WebP, JPEG or PNG in the browser, then uploads the result. With the images option, large uploads are scaled down and converted automatically before they reach your server.

Does it help with accessibility?

Yes. The accessibility check finds images without alt text, skipped or empty headings, vague link texts like "click here", tables without a header row and text with too little contrast, and fixes most of them with one click. The editor itself works with the keyboard and screen readers.

Can I add my own toolbar buttons?

Yes. The buttons option and editor.addButton() add buttons with your own icon, click handler and active or disabled state, and slashItems adds entries to the "/" menu.

Which languages and themes are included?

English and Turkish are built in. German, French, Spanish, Portuguese, Italian, Russian, Chinese, Japanese and Arabic come as small separate files, and Arabic switches the editor to right-to-left. You can add your own translations with WDSEditor.addLanguage. Light, dark and auto themes are built in and follow CSS variables.

License

WDS Editor is released under the MIT license. It is built on ProseMirror (MIT). The editor is free for every project; in return it shows a small “Powered by WDS Editor” link in its status bar. The link appears only in the editor, never in the HTML you publish.