[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [ENH] Add wysiwyg parameter to decouple textarea editing from WYSIWYG editor

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69b8f3529885d_3b18d5f835329@gitlab-sidekiq-low-urgency-cpu-bound-v2-7fb98cc9d4-vts7w.mail>

Victor Emanouilov pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
a1d00c5f by Steven ngesera at 2026-03-17T08:23:07+02:00
[ENH] Add wysiwyg parameter to decouple textarea editing from WYSIWYG editor
---
* [ENH] Add WYSIWYG support to Search Formatter plugins

See merge request tikiwiki/tiki!9740

- - - - -


2 changed files:

- lib/core/Search/Formatter/Builder.php
- lib/core/Search/Formatter/Plugin/SmartyTemplate.php


Changes:

=====================================
lib/core/Search/Formatter/Builder.php
=====================================
@@ -182,6 +182,11 @@ class Search_Formatter_Builder
             $plugin->setEditable($arguments['editable'], 'format' . hash('sha256', $match->getArguments() . $match->getBody()));
         }
 
+        if (isset($arguments['wysiwyg']) && method_exists($plugin, 'setWysiwyg')) {
+            $wysiwygValue = in_array($arguments['wysiwyg'], ['y', 'yes', '1', 1, true], true);
+            $plugin->setWysiwyg($wysiwygValue);
+        }
+
         $this->subFormatters[$arguments['name']] = $plugin;
     }
 


=====================================
lib/core/Search/Formatter/Plugin/SmartyTemplate.php
=====================================
@@ -16,6 +16,7 @@ class Search_Formatter_Plugin_SmartyTemplate implements Search_Formatter_Plugin_
     private string $editable;
     private string $editableId;
     private ?string $context;
+    private $wysiwyg = null;
 
     public function __construct($templateFile, $changeDelimiters = false)
     {
@@ -45,6 +46,11 @@ class Search_Formatter_Plugin_SmartyTemplate implements Search_Formatter_Plugin_
         $this->editableId = $id;
     }
 
+    public function setWysiwyg($wysiwyg)
+    {
+        $this->wysiwyg = $wysiwyg;
+    }
+
     public function setContext(?string $context)
     {
         $this->context = $context;
@@ -145,6 +151,14 @@ class Search_Formatter_Plugin_SmartyTemplate implements Search_Formatter_Plugin_
     private function wrapEditableByContext($content)
     {
         if ($this->context !== 'actions') {
+            // Determine wysiwyg value: explicit setting takes priority,
+            // otherwise default to false for inline, true for block/dialog
+            if ($this->wysiwyg !== null) {
+                $wysiwygValue = $this->wysiwyg;
+            } else {
+                $wysiwygValue = $this->editable === 'inline' ? false : true;
+            }
+
             return new Tiki_Render_Editable(
                 $content,
                 [
@@ -152,7 +166,7 @@ class Search_Formatter_Plugin_SmartyTemplate implements Search_Formatter_Plugin_
                     'field' => [
                         'id' => $this->editableId,
                         'type' => 'form',
-                        'wysiwyg' => $this->editable === 'inline' ? false : true,
+                        'wysiwyg' => $wysiwygValue,
                     ],
                 ],
             );



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/a1d00c5fe988c633d2245eac1947ce5ce56b2052

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/a1d00c5fe988c633d2245eac1947ce5ce56b2052
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.