Created
August 24, 2013 00:08
-
-
Save hostilefork/6325151 to your computer and use it in GitHub Desktop.
Explicit license of a StackOverflow answer to make FontBakery happy. :-)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright 2012 Brian Dickens <hostilefork@gmail.com> | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, | |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
See the License for the specific language governing permissions and | |
limitations under the License. | |
*/ | |
$(document).ready(function(){ | |
var heightUpdateFunction = function() { | |
// http://stackoverflow.com/questions/11584061/ | |
var newHeight = | |
editor.getSession(). | |
getScreenLength() | |
* editor.renderer.lineHeight | |
+ editor.renderer.scrollBar.getWidth(); | |
$('#editor').height(newHeight.toString() + "px"); | |
$('#editor-section').height(newHeight.toString() + "px"); | |
// This call is required for the editor to fix all of | |
// its inner structure for adapting to a change in size | |
editor.resize(); | |
}; | |
// Set initial size to match initial content | |
heightUpdateFunction(); | |
// Whenever a change happens inside the ACE editor, update | |
// the size again | |
editor.getSession().on('change', heightUpdateFunction); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment