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/08 11:58:43 UTC
[08/21] 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/892d8844
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/892d8844
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/892d8844
Branch: refs/heads/ib/7897
Commit: 892d88443d9ea5f4d1051a0ea264e5f6603d3879
Parents: 390e933
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Jun 19 15:57:01 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Jul 7 10:26:10 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/892d8844/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();