mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 12:07:19 +00:00
Instituted minimum height for edit textareas
This commit is contained in:
parent
e5b6d9a722
commit
caf32d9598
@ -12,6 +12,8 @@ An editor plugin for editting text
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var MIN_TEXT_AREA_HEIGHT = 100;
|
||||
|
||||
function TextEditor(macroNode) {
|
||||
this.macroNode = macroNode;
|
||||
}
|
||||
@ -80,7 +82,7 @@ TextEditor.prototype.saveChanges = function() {
|
||||
};
|
||||
|
||||
TextEditor.prototype.fixHeight = function() {
|
||||
if(this.macroNode.child && this.macroNode.child.domNode) {
|
||||
if(this.macroNode.child && this.macroNode.child.children[0] && this.macroNode.child.children[0].type === "textarea") {
|
||||
var wrapper = this.macroNode.child.domNode,
|
||||
textarea = this.macroNode.child.children[0].domNode;
|
||||
// Set the text area height to 1px temporarily, which allows us to read the true scrollHeight
|
||||
@ -88,7 +90,7 @@ TextEditor.prototype.fixHeight = function() {
|
||||
wrapper.style.height = textarea.style.height + "px";
|
||||
textarea.style.overflow = "hidden";
|
||||
textarea.style.height = "1px";
|
||||
textarea.style.height = textarea.scrollHeight + "px";
|
||||
textarea.style.height = Math.max(textarea.scrollHeight,MIN_TEXT_AREA_HEIGHT) + "px";
|
||||
wrapper.style.height = prevWrapperHeight;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user