From ee9480670fc9bd9a914a094aa215695a5363211b Mon Sep 17 00:00:00 2001 From: Mzhelskiy Maxim Date: Fri, 9 Mar 2012 15:01:08 +0400 Subject: [PATCH] =?UTF-8?q?fix=20tinyMCE=20=D0=B2=20=D0=BA=D0=BE=D0=BC?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=80=D0=B8=D1=8F=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/lib/internal/template/js/comments.js | 25 +++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/engine/lib/internal/template/js/comments.js b/engine/lib/internal/template/js/comments.js index 98a5bbe0..be5452d3 100644 --- a/engine/lib/internal/template/js/comments.js +++ b/engine/lib/internal/template/js/comments.js @@ -75,18 +75,27 @@ ls.comments = (function ($) { // Показывает/скрывает форму комментирования this.toggleCommentForm = function(idComment, bNoFocus) { - if (this.iCurrentShowFormComment == idComment && idComment == 0) return; - + var reply=$('#reply'); + if(!reply.length){ + return; + } $('#comment_preview_' + this.iCurrentShowFormComment).remove(); + + if (this.iCurrentShowFormComment==idComment && reply.is(':visible')) { + reply.hide(); + return; + } + if (this.options.wysiwyg) { + tinyMCE.execCommand('mceRemoveControl',true,'form_comment_text'); + } + reply.insertAfter('#comment_id_'+idComment).show(); $('#form_comment_text').val(''); - - if (this.iCurrentShowFormComment == idComment) idComment = 0; - - $('#reply').insertAfter('#comment_id_'+idComment); $('#form_comment_reply').val(idComment); this.iCurrentShowFormComment = idComment; - + if (this.options.wysiwyg) { + tinyMCE.execCommand('mceAddControl',true,'form_comment_text'); + } if (!bNoFocus) $('#form_comment_text').focus(); }; @@ -306,8 +315,6 @@ ls.comments = (function ($) { this.checkFolding(); this.toggleCommentForm(this.iCurrentShowFormComment); - if (this.options.wysiwyg) tinyMCE.execCommand('mceAddControl',true,'form_comment_text'); - if (typeof(this.options.wysiwyg)!='number') { this.options.wysiwyg = Boolean(BLOG_USE_TINYMCE && tinyMCE); }