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:18 UTC
[37/50] [abbrv] allura git commit: [#7897] ticket:814 Resize editor
container immediately after render
[#7897] ticket:814 Resize editor container immediately after render
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/40781b4c
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/40781b4c
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/40781b4c
Branch: refs/heads/ib/7897
Commit: 40781b4ceecf90466eca342b4f20530aab31abd0
Parents: 0fa5996
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Jul 7 18:47:59 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Jul 14 11:46:02 2015 +0300
----------------------------------------------------------------------
.../allura/lib/widgets/resources/js/sf_markitup.js | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/40781b4c/Allura/allura/lib/widgets/resources/js/sf_markitup.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/sf_markitup.js b/Allura/allura/lib/widgets/resources/js/sf_markitup.js
index f3466bc..91d63ca 100644
--- a/Allura/allura/lib/widgets/resources/js/sf_markitup.js
+++ b/Allura/allura/lib/widgets/resources/js/sf_markitup.js
@@ -51,17 +51,21 @@ $(window).load(function() {
toolbar: toolbar
});
var cm = editor.codemirror;
- cm.on('viewportChange', function(cm, from, to) {
+ cm.on('viewportChange', resize);
+ editor.render();
+ // trigger resize to properly display editor in case of a lot of text in the textarea
+ resize(cm);
+
+ // focus editor by clicking anywhere on it, not only on the first few lines
+ $('.CodeMirror').click(function () { this.CodeMirror.focus(); });
+
+ function resize(cm) {
var toolbar_h = $('.editor-toolbar', $container).outerHeight();
var statusbar_h = $('.editor-statusbar', $container).outerHeight();
var cm_h = cm.getScrollInfo().clientHeight;
var h = toolbar_h + statusbar_h + cm_h;
$container.height(h);
- });
- editor.render();
-
- // focus editor by clicking anywhere on it, not only on the first few lines
- $('.CodeMirror').click(function () { this.CodeMirror.focus(); });
+ }
function show_help(editor) {
$help_contents.html('Loading...');