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/22 14:31:17 UTC
[21/42] 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/b246d8f5
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/b246d8f5
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/b246d8f5
Branch: refs/heads/ib/7897
Commit: b246d8f5d0363de052de39e1109739ac06cb56f7
Parents: 1bbd2c2
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Jul 7 18:47:59 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Wed Jul 22 10:59:52 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/b246d8f5/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...');