From 1c1d2cf1c1f8540e3261a7e57ca60d7e7c2e39e9 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Tue, 10 Oct 2023 16:35:36 +0200 Subject: [PATCH] #12208 Improve widget html editor --- .../include/lib/Dashboard/Widgets/post.php | 7 +++-- pandora_console/include/styles/form.css | 4 +-- .../views/dashboard/configurationWidgets.php | 31 +++++++++---------- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/pandora_console/include/lib/Dashboard/Widgets/post.php b/pandora_console/include/lib/Dashboard/Widgets/post.php index d6274e279d..df20869780 100755 --- a/pandora_console/include/lib/Dashboard/Widgets/post.php +++ b/pandora_console/include/lib/Dashboard/Widgets/post.php @@ -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, ]; diff --git a/pandora_console/include/styles/form.css b/pandora_console/include/styles/form.css index a0e5957358..c212d459f6 100644 --- a/pandora_console/include/styles/form.css +++ b/pandora_console/include/styles/form.css @@ -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%; } diff --git a/pandora_console/views/dashboard/configurationWidgets.php b/pandora_console/views/dashboard/configurationWidgets.php index f985517f4f..68a51edbaa 100644 --- a/pandora_console/views/dashboard/configurationWidgets.php +++ b/pandora_console/views/dashboard/configurationWidgets.php @@ -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 .= ''; echo $output;