#12208 Improve widget html editor

This commit is contained in:
miguel angel rasteu 2023-10-10 16:35:36 +02:00
parent b2019fad9a
commit 1c1d2cf1c1
3 changed files with 20 additions and 22 deletions

View File

@ -221,9 +221,10 @@ class PostWidget extends Widget
'type' => 'textarea', 'type' => 'textarea',
'value' => $values['text'], 'value' => $values['text'],
'return' => true, 'return' => true,
'rows' => 1, 'rows' => 25,
'columns' => 1, 'columns' => 100,
'size' => 25, 'size' => 25,
'style' => 'display: none;',
], ],
]; ];
@ -296,7 +297,7 @@ class PostWidget extends Widget
public function getSizeModalConfiguration(): array public function getSizeModalConfiguration(): array
{ {
$size = [ $size = [
'width' => 500, 'width' => 1000,
'height' => 500, 'height' => 500,
]; ];

View File

@ -279,8 +279,8 @@ form.modal ul.wizard li {
flex-wrap: nowrap; flex-wrap: nowrap;
} }
form.modal-dashboard ul.wizard li *, form.modal-dashboard ul.wizard li > *,
form.modal ul.wizard li *:not(.tox.tox-tinymce *) { form.modal ul.wizard li > *:not(.tox.tox-tinymce *) {
flex: 1 1 50%; flex: 1 1 50%;
} }

View File

@ -28,15 +28,11 @@
// Includes. // Includes.
require_once $config['homedir'].'/include/class/HTML.class.php'; require_once $config['homedir'].'/include/class/HTML.class.php';
ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/', true);
ui_require_javascript_file('pandora', 'include/javascript/', true);
$output = ''; $output = '';
$output .= ui_require_javascript_file(
'tiny_mce',
'include/javascript/tiny_mce/',
true
);
$form = [ $form = [
'action' => '#', 'action' => '#',
'method' => 'POST', 'method' => 'POST',
@ -47,6 +43,18 @@ $form = [
'extra' => 'novalidate', 'extra' => 'novalidate',
]; ];
$js = 'tinymce.init({
selector: "#textarea_text",
plugins: "preview, searchreplace, table, nonbreaking, link, image",
promotion: false,
branding: false,
setup: function (editor) {
editor.on("change", function () {
tinymce.triggerSave();
})
}
});';
HTML::printForm( HTML::printForm(
[ [
'form' => $form, 'form' => $form,
@ -56,15 +64,4 @@ HTML::printForm(
] ]
); );
$output .= '<script>';
$output .= 'tinymce.init({
selector: "#textarea_text",
setup : function(ed) {
ed.onChange.add(function(e) {
tinyMCE.triggerSave();
console.log($("#textarea_text").val());
});
}
});';
$output .= '</script>';
echo $output; echo $output;