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:18 UTC

[18/41] allura git commit: [#7897] ticket:804 Autoresize editor

[#7897] ticket:804 Autoresize editor


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/5a36a259
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/5a36a259
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/5a36a259

Branch: refs/heads/master
Commit: 5a36a259bfc9350b21ff0e74d2437ca359348d5f
Parents: e68c33d
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Jul 7 11:41:30 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Mon Jul 27 14:23:55 2015 +0300

----------------------------------------------------------------------
 .../allura/lib/widgets/resources/css/markitup_sf.css   |  9 ++++++++-
 Allura/allura/lib/widgets/resources/js/sf_markitup.js  | 13 +++++++++++--
 2 files changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/5a36a259/Allura/allura/lib/widgets/resources/css/markitup_sf.css
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/css/markitup_sf.css b/Allura/allura/lib/widgets/resources/css/markitup_sf.css
index 7ac5814..2c12807 100644
--- a/Allura/allura/lib/widgets/resources/css/markitup_sf.css
+++ b/Allura/allura/lib/widgets/resources/css/markitup_sf.css
@@ -18,6 +18,7 @@
 */
 .markdown_edit {
   height: 200px;
+  min-height: 200px;
   width: 95%;
   font-family: Consolas, "Andale Mono", "Lucida Console", monospace;
 
@@ -37,10 +38,16 @@
   border: 1px solid #aaaaaa;
 }
 
+.markdown_edit .CodeMirror {
+  height: auto;
+  min-height: 120px;
+}
+
 .markdown_edit .editor-toolbar:before {
   background: none;  /* hide toolbar's top border */
 }
 
-.markdown_edit .CodeMirror-scroll {
+.markdown_edit .CodeMirror-sizer,
+.markdown_edit .editor-preview {
   padding: 5px;
 }

http://git-wip-us.apache.org/repos/asf/allura/blob/5a36a259/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 266d77a..f3f2c44 100644
--- a/Allura/allura/lib/widgets/resources/js/sf_markitup.js
+++ b/Allura/allura/lib/widgets/resources/js/sf_markitup.js
@@ -46,10 +46,19 @@ $(window).load(function() {
               }
               toolbar.push(tool);
             }
-            new Editor({
+            var editor = new Editor({
               element: $textarea[0],
               toolbar: toolbar
-            }).render();
+            });
+            var cm = editor.codemirror;
+            cm.on('viewportChange', function(cm, from, to) {
+              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();
 
             function show_help(editor) {
               $help_contents.html('Loading...');