What is a WYSIWYG HTML editor? A complete guide for developers
A WYSIWYG HTML editor is an interface component that lets users create and format content much as they would in a word processor, without typing HTML tags by hand. The user sees headings, lists, links, tables and images while working, and the application stores the result as HTML. In CMS and SaaS…
This post is also available in: Polski
A WYSIWYG HTML editor is an interface component that lets users create and format content much as they would in a word processor, without typing HTML tags by hand. The user sees headings, lists, links, tables and images while working, and the application stores the result as HTML. In CMS and SaaS systems, however, convenient formatting is only half the story. Just as important is control over the code that reaches the server and is later displayed to other users.
TL;DR – the five key points
- WYSIWYG stands for What You See Is What You Get: the user edits content visually and the system produces the matching HTML structure.
- A rich text editor fits CMSs, admin panels, SaaS applications, forms and publishing systems.
- HTML sent from the browser is untrusted input. Even if the editor cleans the content, the server must verify it independently.
- When choosing a component, assess HTML quality, integration, accessibility, image handling, the licensing model and maintenance.
- VEditor is an example of a self-hosted editor that combines JavaScript editing with a PHP HTML sanitizer built on a shared model of allowed content.
How does a WYSIWYG HTML editor work?
WYSIWYG stands for What You See Is What You Get. Instead of typing <h2>, <strong> or <ul> by hand, the editor selects text and picks the right function on the toolbar. The editor manages the document structure, and the application can retrieve the result as HTML.
For example, an editor creates a heading, a paragraph and a list. The saved content may contain these tags:
<h2>Our services</h2>
<p>We offer <strong>technical inspections</strong> of equipment.</p>
<ul>
<li>Diagnostics</li>
<li>Maintenance</li>
</ul>
This is an example of a general, semantic HTML structure, not a promise that every editor will produce byte-for-byte identical markup. Different products may store alignment, colours or extra styles differently.
WYSIWYG vs a plain textarea
A plain <textarea> element stores text but offers no visual formatting. The user can type HTML tags by hand, but that requires technical knowledge and a separate preview. A WYSIWYG editor lets users create complex content without any of that.
WYSIWYG vs a Markdown editor
Markdown relies on a lightweight text syntax, e.g. ## Heading and **bold**. It is convenient for technical writers but does not always meet the needs of editors who work with tables, images, captions and richer formatting. Some WYSIWYG editors recognise Markdown shortcuts as you type, so the two ways of working can complement each other.
Where are rich text editors used?
Most often wherever users prepare content for publication or presentation themselves:
- CMSs and websites: articles, category descriptions, information pages and news.
- SaaS applications: notes, task descriptions, messages and internal documentation.
- Admin panels: product descriptions, message bodies and form fields.
- Multilingual systems: editing content in different languages, taking writing direction and typography rules into account.
- Business applications: offer descriptions, instructions and knowledge bases.
Each of these cases may need a different feature set. A simple form needs a few buttons, while a newsroom may need tables, images, a table of contents and advanced handling of content pasted from Word.
Which features should you check before choosing an editor?
Structure and quality of the generated HTML
A good editor should let users create a correct structure: headings, paragraphs, lists, links, tables and image captions. Check that repeated edits do not introduce redundant elements or stray inline styles. The quality of the output HTML affects how easy the content is to maintain, its accessibility and the consistency of its appearance.
Pasting from Word, Google Docs and Excel
Copying from office documents can bring in unnecessary classes, styles and unusual list structures. Test a real document with a numbered list, a table and some emphasis. Check what is kept and what is removed.
Images and files
Find out whether the editor supports dragging images in, pasting from the clipboard, alternative text, captions and responsive attributes. File storage is a separate matter: the editor itself does not have to provide storage or a file manager, but it should let you connect your existing infrastructure.
Accessibility and keyboard use
Check toolbar navigation, focus visibility, control labels and the behaviour of dialogs. Also look for features that help authors create accessible content, such as image alt text, table headers and heading order checks. A feature list on its own does not confirm WCAG conformance.
Integration, updates and licensing
Assess the installation method, server requirements, dependencies, source code availability and integration with your framework. Compare the payment model too: a perpetual licence and a subscription are billed differently, but the total cost also depends on updates, implementation and maintenance.
Why is HTML security critical?
HTML submitted by the browser cannot be considered safe just because it came from a WYSIWYG editor. A user or attacker can bypass the interface and send their own HTTP request straight to the server. If the application stores and displays unverified HTML, it may expose readers to XSS (cross-site scripting) attacks.
That is why you need two distinct stages:
- Tidying content in the browser — helps the editor work on a predictable document.
- Sanitisation on the server — checks untrusted HTML before it is stored or used further, against the allowed tags, attributes and values.
One example risk is a dangerous address in a link, e.g. the javascript: scheme instead of https:. A proper sanitizer should check not only element names, but also attribute values, URLs and allowed styles.
Why does a shared HTML model matter?
In many systems the editor generates one set of tags while the server-side cleaning library knows another. As a result, even a correctly prepared document may change its appearance or lose some formatting once saved. A shared content model reduces this mismatch: what the editor considers allowed should be understood in the same way by the server.
This does not replace security testing of the whole application, but it makes it easier to reason about what HTML can be stored.
How to add a WYSIWYG editor to an application: a practical outline
The process below does not depend on the framework:
- Define the content scope. Decide whether users need only bold and links, or also tables, images and embedded media.
- Choose a component and configure the interface. Limit the toolbar to the functions each field really needs.
- Connect image uploads. Set rules for authorisation, file validation, storage and URL generation.
- Secure the save endpoint. Check the user's permissions and sanitise the HTML on the server.
- Store the content and display it in a controlled context. Do not treat an arbitrary HTML string as safe everywhere in the application.
- Test real scenarios. Paste content from Word, add a table and an image, check keyboard use and send disallowed HTML to the endpoint, bypassing the editor.
A minimum test list before go-live
| Area | What to check |
|---|---|
| Editing | Headings, lists, links, undo and redo |
| Pasting | Word, Google Docs, tables from Excel |
| Media | Upload, upload errors, alternative text |
| Security | Disallowed tags, event attributes, suspicious URLs |
| Accessibility | Keyboard navigation, labels and focus |
| Integration | Saving, reopening, content consistency after sanitisation |
Where does VEditor fit this approach?
VEditor is a self-hosted WYSIWYG HTML editor for web applications and CMSs. It uses native JavaScript modules and PHP 8.1+, with no npm or Composer dependencies required by the editor engine itself. The code is delivered as source, and the licence is verified locally.
A key feature of VEditor is the shared model of allowed content on the JavaScript side and in the PHP HtmlSanitizer class. According to the product documentation, valid content produced by the editor passes through the sanitizer byte-for-byte unchanged, while elements outside the model are removed on the server. This is useful where an administrator wants both to preserve the editor's formatting and to limit the risk of untrusted HTML.
VEditor offers, among other things, tables, images with alternative text, pasting from Word and Google Docs, Markdown shortcuts, a source view and a content accessibility check. It has integrations for Laravel, Symfony, Yii2, PHP, React and Vue. Optional AI editing works with the customer's own API key; text is sent to the chosen AI provider only after the user triggers the feature, and the customer pays the provider directly for model usage.
Try the editor demo yourself and read the documentation. VEditor is not a real-time collaborative editing solution and offers neither comments nor track changes — if you need those, consider another component or additional tools.
Summary: how to choose the right editor for your project
A WYSIWYG editor is more than a row of buttons above a text field. In practice it is part of a process in which content is created in the browser, passes through the server and reaches the reader. Base your decision on three questions: can the editor prepare content comfortably, can the application store it safely, and will the team be able to maintain the solution for years?
Before you buy, run a short test with real documents, in your target framework and with your own saving rules. Only then will a comparison of features, licences and costs be meaningful.
FAQ
1. Does a WYSIWYG editor have to use an external CDN?
No. It can run entirely from files served by your own server. This gives you more control over the version and how assets are delivered, but makes the application owner responsible for updating them.
2. Can HTML from the editor be stored directly in a MySQL database?
Yes, HTML can be stored in a text column, but it must be properly validated and sanitised before saving. The column type alone does not protect against XSS. You also need to distinguish safely displaying HTML content from inserting it into attributes or JavaScript code.
3. Is a WYSIWYG editor suitable for a multilingual application?
Yes, as long as it supports the required languages, writing direction and typographic behaviour. Keep the editor's interface language separate from the language of the content and from the CMS translation mechanism.
4. Does an HTML sanitizer replace CSRF protection and permission checks?
No. The sanitizer is responsible for the allowed HTML structure, while CSRF protection, authentication and authorisation protect other stages of the process. A secure application needs all of these mechanisms at once.
5. Does every WYSIWYG editor have AI features?
No. AI is an optional extension in some products. Before enabling it, check where content is sent, who holds the API key, how costs are controlled and whether the editor approves the result before publication.