You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2015/07/29 23:10:02 UTC

[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 <je...@gmail.com>
Authored: Fri Jun 19 15:57:01 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
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();