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' });
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 and delete are optional.
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
}
});
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
urlandnameare required for each file; a staticfiles.jsonworks too. POST uploadUrl(multipart:file,path) returns{ "file": { ... } }.POST deleteUrl(JSON:{ "url": "..." }) returns{ "ok": true }.
Ready server examples are in the repository: Node.js, ASP.NET Core, PHP and static JSON. They keep paths inside the upload folder, allow only listed extensions, limit the size and never overwrite files. Add your own authentication before going live.
Options
| Option | Default | Description |
|---|---|---|
selector | – | CSS selector or element; a textarea is recommended. |
height / minHeight | auto / 240 | Fixed height, or the minimum height of an auto-growing editor. |
placeholder | – | Text shown while the editor is empty. |
language | browser | "en", "tr" or your own messages. |
theme | "light" | "light", "dark" or "auto". |
toolbar | default | A string like "bold italic | link image", an array, or false. |
fileManager | – | listUrl, uploadUrl, deleteUrl, headers, accept. |
colors | built-in | { text: [...], highlight: [...] } with hex colors. |
readOnly | false | Starts in read-only mode. |
onChange | – | (html, editor) => void |
API
editor.getHTML(); // clean HTML ("" when empty)
editor.setHTML('<p>Hi</p>');
editor.insertImage({ src: '/img/a.jpg', alt: 'A', width: 400, align: 'center' });
editor.openFileManager('image');
editor.on('change', (e) => console.log(e.getHTML()));
editor.on('upload', (e, file) => console.log('uploaded', file.url));
The full list of options, toolbar items and methods is in the README on GitHub.
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.
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.
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 the GitHub repository has ready examples for Node.js, ASP.NET Core and PHP that add upload and delete.
Can I paste from Word or Google Docs?
Yes. Pasted content is cleaned automatically: office styles, classes and scripts are removed and headings, lists, tables 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.
Which languages and themes are included?
English and Turkish, plus 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). A small “Powered by WDS Editor” link is shown under the editor; you can turn it off with branding: false.