oziEditor
Version: 2.0.0 — Updated: 2026-05-27
Description
Lightweight visual editor activated over a textarea, focused on simple form integration and natural backend synchronization. The textarea remains the actual submission field — the plugin only creates a visual interface over it, making it more stable in Livewire scenarios and reducing re-render conflicts.
Examples
[1] Base structure
<textarea
name="description"
data-ozi-editor="description">
</textarea>
[2] Full structure — all tools
<textarea
name="description"
data-ozi-editor="description"
data-ozi-editor-tools="bold,italic,underline,ul,ol,code,table,clear,left,center,right"
data-ozi-editor-lang="en"
data-ozi-editor-uicolor="#9AB8F3"
data-ozi-editor-placeholder="Type here..."
data-ozi-editor-height="220px"
data-ozi-editor-required
data-ozi-editor-required-message="Description is required.">
</textarea>
[3] Toolbar button grouping
Use [ ] to group buttons, , to separate items and ; to break the line. Makes the toolbar visually cleaner.
<textarea
name="description"
data-ozi-editor="description"
data-ozi-editor-tools="[bold,italic,underline],[ul,ol],code;table,clear,[left,center,right]"
data-ozi-editor-lang="en"
data-ozi-editor-uicolor="#9AB8F3"
data-ozi-editor-placeholder="Type here..."
data-ozi-editor-height="220px">
</textarea>
[ ]groups buttons visually —bold,italic,underlinestay together.,separates items inside and outside groups.;breaks the toolbar line.
[4] Custom color via uiColor
The color is applied to focus, active border and toolbar buttons.
<!-- Blue -->
<textarea data-ozi-editor="editor1" data-ozi-editor-uicolor="#9AB8F3"></textarea>
<!-- Green -->
<textarea data-ozi-editor="editor2" data-ozi-editor-uicolor="#27ae60"></textarea>
<!-- Orange -->
<textarea data-ozi-editor="editor3" data-ozi-editor-uicolor="#e67e22"></textarea>
[5] Sample output sent to backend
The textarea receives clean, controlled HTML after the user edits:
<p>Normal text</p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<pre><code>const x = 10;</code></pre>
The backend works with the field normally — without needing to know the editor UI.
[6] Usage via JavaScript
// Initialize all editors on the page
OziEditor.init();
// Get value
const html = OziEditor.value('description');
// Set value
OziEditor.value('description', '<p>Initial text</p>');
// Destroy instance
OziEditor.destroy('description');
// Reload instance
OziEditor.reload('description');
// Content loaded via fetch
oziEditorInitFetched($('#destination'));
Features
- Form integration — the
textareais the actual value sent to the backend - Controlled tools — lean and configurable toolbar set
- Customizable color —
uiColorapplies color to focus and active buttons - Light/dark theme — support via CSS variables
- HTML sanitization — removes tags outside the allowed set when pasting
- Validation — required field with custom message
- Livewire compatible — avoids re-render conflicts
- Public API — methods to initialize, read, set and destroy
HTML Attributes
[1] Identification
| Attribute | Required | Description |
|---|---|---|
data-ozi-editor |
✔ | Unique component key |
[2] Visual Configuration
| Attribute | Description |
|---|---|
data-ozi-editor-tools |
Toolbar tools — comma separated |
data-ozi-editor-lang |
Interface language — e.g. en |
data-ozi-editor-uicolor |
Primary color — focus and active buttons — e.g. #9AB8F3 |
data-ozi-editor-placeholder |
Editable area placeholder |
data-ozi-editor-height |
Minimum area height — e.g. 220px |
[3] State and Validation
| Attribute | Description |
|---|---|
data-ozi-editor-disabled |
Disables the editor |
data-ozi-editor-required |
Marks as required |
data-ozi-editor-required-message |
Custom validation message |
[4] Available Tools
| Tool | Description |
|---|---|
bold |
Bold |
italic |
Italic |
underline |
Underline |
ul |
Unordered list |
ol |
Ordered list |
code |
Code block |
table |
Simple table |
clear |
Clear formatting |
left |
Align left |
center |
Center |
right |
Align right |
[5] Allowed HTML
p, br, strong, em, u, ul, ol, li, pre, code,
table, thead, tbody, tr, td, th
How it works
- The plugin finds the
textarea - Creates the visual editor interface over it
- The user edits in visual mode
- HTML content is sanitized
- The final value is synced back to the
textarea - The form submits the
textareavalue normally
Public API
| Method | Description |
|---|---|
OziEditor.init() |
Initializes all editors on the page |
OziEditor.get('key') |
Returns the editor instance |
OziEditor.value('key') |
Gets the current value |
OziEditor.value('key', '<p>html</p>') |
Sets a value |
OziEditor.destroy('key') |
Destroys the instance |
OziEditor.reload('key') |
Reloads the instance |
oziEditorInitFetched($('#destination')) |
Initializes in content loaded via fetch |