adapt line height of the hidden textarea

This commit is contained in:
Fabian Jakobs 2011-02-02 12:39:35 +01:00
commit ad1ac504b4
2 changed files with 5 additions and 4 deletions

View file

@ -34,8 +34,6 @@
<div id="editor"> <div id="editor">
</div> </div>
</script>
<script src="demo/require.js" type="text/javascript" charset="utf-8"></script> <script src="demo/require.js" type="text/javascript" charset="utf-8"></script>
<script> <script>

View file

@ -306,23 +306,26 @@ var VirtualRenderer = function(container, theme) {
if (useragent.isIE) if (useragent.isIE)
return; return;
if (!this.layerConfig)
return;
var pos = this.$cursorLayer.getPixelPosition(); var pos = this.$cursorLayer.getPixelPosition();
if (!pos) if (!pos)
return; return;
var bounds = this.content.getBoundingClientRect(); var bounds = this.content.getBoundingClientRect();
var offset = (this.layerConfig && this.layerConfig.offset) || 0; var offset = this.layerConfig.offset;
var left = bounds.left + pos.left + this.$padding; var left = bounds.left + pos.left + this.$padding;
var top = bounds.top + pos.top - this.scrollTop + offset; var top = bounds.top + pos.top - this.scrollTop + offset;
if (useragent.isIPad) { if (useragent.isIPad) {
left -= 3; left -= 3;
top -= 0;
} }
textarea.style.left = left + "px"; textarea.style.left = left + "px";
textarea.style.top = top + "px"; textarea.style.top = top + "px";
textarea.style.lineHeight = this.layerConfig.lineHeight + "px";
}; };
this.getFirstVisibleRow = function() { this.getFirstVisibleRow = function() {