You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/07/14 17:03:12 UTC

[31/50] [abbrv] 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/5e6ad0e4
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/5e6ad0e4
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/5e6ad0e4

Branch: refs/heads/ib/7897
Commit: 5e6ad0e40c512e6ffdcddb6fc8eb88dae464d84f
Parents: 0f018b3
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Jun 19 15:57:01 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Jul 14 11:46:01 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/5e6ad0e4/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();