[TikiWiki-commits] [Git][tikiwiki/tiki][master] [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 <69b29f4a794bb_3b18a2f495994@gitlab-sidekiq-low-urgency-cpu-bound-v2-c5dc4c6c9-gf9xb.mail>

Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
b3b65ac3 by Steven ngesera at 2026-03-12T10:56:16+00: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;
@@ -157,6 +163,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,
                 [
@@ -164,7 +178,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/b3b65ac3bd9766d2a1a49e753f2b6e1b9e1c090b

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/b3b65ac3bd9766d2a1a49e753f2b6e1b9e1c090b
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.