Return-Path: X-Original-To: apmail-allura-commits-archive@www.apache.org Delivered-To: apmail-allura-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 80E2218D14 for ; Wed, 29 Jul 2015 21:10:01 +0000 (UTC) Received: (qmail 91515 invoked by uid 500); 29 Jul 2015 21:10:01 -0000 Delivered-To: apmail-allura-commits-archive@allura.apache.org Received: (qmail 91472 invoked by uid 500); 29 Jul 2015 21:10:01 -0000 Mailing-List: contact commits-help@allura.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@allura.apache.org Delivered-To: mailing list commits@allura.apache.org Received: (qmail 91412 invoked by uid 99); 29 Jul 2015 21:10:01 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Jul 2015 21:10:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3AD73E0006; Wed, 29 Jul 2015 21:10:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: brondsem@apache.org To: commits@allura.apache.org Date: Wed, 29 Jul 2015 21:10:02 -0000 Message-Id: <6c63dccb8d3a4aceb6d2df324c21868e@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [02/41] allura git commit: [#7897] ticket:804 Show text & focus editor on the "Edit" and "Reply" [#7897] ticket:804 Show text & focus editor on the "Edit" and "Reply" Project: http://git-wip-us.apache.org/repos/asf/allura/repo Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/dd8eda6e Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/dd8eda6e Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/dd8eda6e Branch: refs/heads/master Commit: dd8eda6e352f8f832c46a7ab5ace1820d064ac4e Parents: fa17621 Author: Igor Bondarenko Authored: Fri Jun 19 15:57:01 2015 +0300 Committer: Igor Bondarenko Committed: Mon Jul 27 14:23:54 2015 +0300 ---------------------------------------------------------------------- Allura/allura/lib/widgets/discuss.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/allura/blob/dd8eda6e/Allura/allura/lib/widgets/discuss.py ---------------------------------------------------------------------- diff --git a/Allura/allura/lib/widgets/discuss.py b/Allura/allura/lib/widgets/discuss.py index 3fe8f6c..db9342c 100644 --- a/Allura/allura/lib/widgets/discuss.py +++ b/Allura/allura/lib/widgets/discuss.py @@ -347,13 +347,16 @@ class Post(HierWidget): }); }); + function get_cm($elem) { return $('.CodeMirror', $elem)[0].CodeMirror; } + if($('a.edit_post', post)){ $('a.edit_post', post).click(function (ele) { $('.display_post', post).hide(); - $('.edit_post_form', post).show(); - // Calling jQuery's ".focus()" forces browser to reload page - // while using IE11 with sourceforge theme - $('.edit_post_form textarea', post)[0].focus(); + var $edit_post_form = $('.edit_post_form', post); + var cm = get_cm($edit_post_form); + $edit_post_form.show(); + cm.refresh(); + cm.focus(); return false; }); $("a.cancel_edit_post", post).click(function(evt){ @@ -363,10 +366,10 @@ class Post(HierWidget): } if($('.reply_post', post)){ $('.reply_post', post).click(function (ele) { - $('.reply_post_form', post).show(); - // Calling jQuery's ".focus()" forces browser to reload page - // while using IE11 with sourceforge theme - $('.reply_post_form textarea', post)[0].focus(); + var $reply_post_form = $('.reply_post_form', post); + var cm = get_cm($reply_post_form); + $reply_post_form.show(); + cm.focus(); return false; }); $('.reply_post', post).button();