allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jetm...@apache.org
Subject [10/21] allura git commit: [#7897] ticket:804 Autoresize editor
Date Wed, 08 Jul 2015 09:58:45 GMT
[#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/6556bcff
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/6556bcff
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/6556bcff

Branch: refs/heads/ib/7897
Commit: 6556bcffaefbc2266f856a06736943c242c8da97
Parents: d4d6225
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Tue Jul 7 11:41:30 2015 +0300
Committer: Igor Bondarenko <jetmind2@gmail.com>
Committed: Tue Jul 7 11:41:30 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/6556bcff/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/6556bcff/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...');


Mime
View raw message