tinymce() form()
A textarea with the TinyMCE 8 rich text editor; without JavaScript it stays a plain textarea.
form()->tinymce($name, $desc = '', $extra = [], $replace = [])Опції
| Опція | Значення |
|---|---|
tinymce | ['config' => [...]]: tinymce.init() options over yf_form2_tinymce::$CONFIG and its defaults (data only). |
tinymce[upload] | true (admin only): image uploads from the editor, as CKEditor has them in the admin. On the user side it adds nothing: images are inserted by URL. |
(textarea options) | Every option of textarea(). |
Приклад
Код
return form(['body' => '<p>Hello <b>world</b></p>'])
->tinymce('body', 'Text', ['rows' => 6, 'tinymce' => ['config' => ['menubar' => false]]]);Примітки
- The editor reads the textarea as HTML, so the value is escaped with
htmlspecialchars()(a stored<stays<). - Clean the posted HTML on the server before you show it to others.
Bootstrap 3 and 5
The editor follows the Bootstrap 5 colour mode (dark skin under data-bs-theme="dark").
Див. також: form/textarea, form/rich_text, demo:form/tinymce, demo:form/ckeditor