]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
TinyMCE: only apply HTML parsing if we actually got into JS and poked the editor...
authorBrion Vibber <brion@pobox.com>
Wed, 11 Aug 2010 21:50:59 +0000 (14:50 -0700)
committerBrion Vibber <brion@pobox.com>
Wed, 11 Aug 2010 21:50:59 +0000 (14:50 -0700)
plugins/TinyMCE/TinyMCEPlugin.php

index d9e1893759ca3e64048ac7d2db615d413156d233..8112b7dbbedf85ccc23461b3b2307fd140679b3f 100644 (file)
@@ -117,9 +117,11 @@ class TinyMCEPlugin extends Plugin
      */
     function onStartSaveNewNoticeWeb($action, $user, &$content, &$options)
     {
-        $html = $this->sanitizeHtml($action->arg('status_textarea'));
-        $options['rendered'] = $html;
-        $content = $this->stripHtml($html);
+        if ($action->arg('richedit')) {
+            $html = $this->sanitizeHtml($content);
+            $options['rendered'] = $html;
+            $content = $this->stripHtml($html);
+        }
         return true;
     }
 
@@ -145,8 +147,11 @@ class TinyMCEPlugin extends Plugin
                 theme_advanced_resizing : true,
                 tabfocus_elements: ":prev,:next"
             });
+            $('#form_notice').append('<input type="hidden" name="richedit" value="1">');
             $('#notice_action-submit').click(function() {
-                tinymce.triggerSave();
+                if (typeof tinymce != "undefined") {
+                    tinymce.triggerSave();
+                }
             });
         });
 END_OF_SCRIPT;