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

View File

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

View File

@ -28,15 +28,11 @@
// Includes.
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 .= ui_require_javascript_file(
'tiny_mce',
'include/javascript/tiny_mce/',
true
);
$form = [
'action' => '#',
'method' => 'POST',
@ -47,6 +43,18 @@ $form = [
'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(
[
'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;