diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index f44c30a80..62f035767 100755 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -3627,17 +3627,38 @@ class e107 /** * Set or Retrieve WYSIWYG active status. (replaces constant e_WYSIWYG) - * @param null $val + * @param bool $val if null, return current value, otherwise set value to registry * @return bool|mixed|void */ public static function wysiwyg($val=null) { - + // Check the general wysiwyg setting if (self::getPref('wysiwyg',false) != true) { return false; } + + if (defined('e_CURRENT_PLUGIN') && e_CURRENT_PLUGIN != '') + { + $editor = e107::getPlugPref(e_CURRENT_PLUGIN, 'editor', 'default'); + if ($editor != 'default' && $editor != 'bbcode' && !e107::isInstalled($editor)) + { + $editor = 'default'; + } + switch ($editor) + { + case 'bbcode': + return false; + case 'tinymce4': + return true; + default: + break; + } + + } + + if(is_null($val)) { return self::getRegistry('core/e107/wysiwyg'); diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 201d8be6a..84173e37c 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -2351,9 +2351,16 @@ class e_form // auto-height support $options['class'] = 'tbox bbarea '.($size ? ' '.$size : '').' e-wysiwyg e-autoheight form-control'; $bbbar = ''; - - $help_tagid = $this->name2id($name)."--preview"; + + if (isset($options['id']) && !empty($options['id'])) + { + $help_tagid = $this->name2id($options['id'])."--preview"; + } + else + { + $help_tagid = $this->name2id($name)."--preview"; + } if(e107::wysiwyg(true) === false) // bbarea loaded, so activate wysiwyg (if enabled in preferences) diff --git a/e107_plugins/forum/forum_admin.php b/e107_plugins/forum/forum_admin.php index 102ed1e5a..72af5d081 100644 --- a/e107_plugins/forum/forum_admin.php +++ b/e107_plugins/forum/forum_admin.php @@ -183,6 +183,9 @@ if(!deftrue('OLD_FORUMADMIN')) 'popular' => array('title' => FORLAN_55, 'type'=>'number', 'data' => 'int','help'=>FORLAN_56), 'postspage' => array('title' => FORLAN_57, 'type'=>'number', 'data' => 'int','help'=>FORLAN_58), 'threadspage' => array('title' => FORLAN_186, 'type'=>'number', 'data' => 'int','help'=>FORLAN_187), + + 'editor' => array('title' => 'Post editor', 'type' => 'dropdown', 'data' => 'str', 'readParms' => array(), 'writeParms' => array('optArray' => array(), 'defaultValue' => 'default'), 'help' => 'Which editor should be used to create/edit posts?'), + 'quickreply' => array('title' => 'Quick replay editor', 'type' => 'dropdown', 'data' => 'str', 'readParms' => array(), 'writeParms' => array('optArray' => array(), 'defaultValue' => 'default'), 'help' => '') ); public $forumParents = array(); @@ -225,6 +228,19 @@ if(!deftrue('OLD_FORUMADMIN')) $this->checkOrder(); + + $this->prefs['editor']['writeParms']['optArray']['default'] = 'System editor'; + $this->prefs['editor']['writeParms']['optArray']['bbcode'] = 'BBCode'; + if (e107::isInstalled('tinymce4')) + { + $this->prefs['editor']['writeParms']['optArray']['tinymce4'] = 'TinyMCE'; + } + + $this->prefs['quickreply']['writeParms']['optArray'] = array( + 'default' => 'Textarea', + 'wysiwyg' => 'Editor' + ); + if(e107::isInstalled('poll') == false) { $this->prefs['poll']['writeParms']['post'] = " ".FORLAN_215.""; diff --git a/e107_plugins/forum/js/forum.js b/e107_plugins/forum/js/forum.js index 2a0a26887..c846756a0 100644 --- a/e107_plugins/forum/js/forum.js +++ b/e107_plugins/forum/js/forum.js @@ -27,7 +27,14 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; var action = $this.attr('data-forum-action'); var thread = $this.attr('data-forum-thread'); var post = $this.attr('data-forum-post'); - var text = $('#forum-quickreply-text').val(); + if (typeof tinymce == 'undefined') + { + var text = $('#forum-quickreply-text').val(); + } + else + { + var text = tinymce.get('forum-quickreply-text').getContent(); + } var insert = $this.attr('data-forum-insert'); var token = $this.attr('data-token'); var script = $this.attr("src"); @@ -109,7 +116,14 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; e107.attachBehaviors(); } - $('#forum-quickreply-text').val(''); + if (typeof tinymce == 'undefined') + { + $('#forum-quickreply-text').val(''); + } + else + { + tinymce.get('forum-quickreply-text').setContent(''); + } return; } diff --git a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php index c2fa7559f..3ead6166a 100644 --- a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php @@ -1196,17 +1196,38 @@ $urlParms = array('f' => 'rp', 'id' => $this->var['thread_id'], 'post' => $this->var['thread_id']); $url = e107::url('forum', 'post', null, array('query' => $urlParms));; // ."?f=rp&id=".$thread->threadInfo['thread_id']."&post=".$thread->threadInfo['thread_id']; - return " -
-
- -
-
- - -
+ $qr = e107::getPlugPref('forum', 'quickreply', 'default'); + if ($qr == 'default') + { -
"; + return " +
+
+ +
+
+ + +
+ +
"; + } + else + { + $text = " +
+
" . + e107::getForm()->bbarea('post','','forum', '_common', 'small', array('id' => 'forum-quickreply-text')) . + "
+
+ + +
+ +
"; + + return $text; + } if(E107_DEBUG_LEVEL > 0) { diff --git a/e107_plugins/forum/templates/forum_viewtopic_template.php b/e107_plugins/forum/templates/forum_viewtopic_template.php index 14aadcb4a..ef52ce9f0 100644 --- a/e107_plugins/forum/templates/forum_viewtopic_template.php +++ b/e107_plugins/forum/templates/forum_viewtopic_template.php @@ -402,7 +402,7 @@ $FORUM_VIEWTOPIC_TEMPLATE['end'] = "
-
+
{QUICKREPLY}