1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 10:29:54 +00:00

Ensure iframe textarea styles are updated

Previously, changing the palette didn’t update the textarea styles.
This commit is contained in:
Jermolene 2016-04-24 12:30:44 +01:00
parent f5f92072e1
commit b7530bac44

View File

@ -64,10 +64,7 @@ function FramedEngine(options) {
this.domNode.setAttribute("rows",this.widget.editRows);
}
// Copy the styles from the dummy textarea
$tw.utils.copyStyles(this.dummyTextArea,this.domNode);
this.domNode.style.display = "block";
this.domNode.style.width = "100%";
this.domNode.style.margin = "0";
this.copyStyles();
// Set the text
if(this.widget.editTag === "textarea") {
this.domNode.appendChild(this.iframeDoc.createTextNode(this.value));
@ -83,6 +80,16 @@ function FramedEngine(options) {
this.iframeDoc.body.appendChild(this.domNode);
}
/*
Copy styles from the dummy text area to the textarea in the iframe
*/
FramedEngine.prototype.copyStyles = function() {
$tw.utils.copyStyles(this.dummyTextArea,this.domNode);
this.domNode.style.display = "block";
this.domNode.style.width = "100%";
this.domNode.style.margin = "0";
};
/*
Set the text of the engine if it doesn't currently have focus
*/
@ -107,6 +114,9 @@ FramedEngine.prototype.getText = function() {
Fix the height of textarea to fit content
*/
FramedEngine.prototype.fixHeight = function() {
// Make sure styles are updated
this.copyStyles();
// Adjust height
if(this.widget.editTag === "textarea") {
if(this.widget.editAutoHeight) {
if(this.domNode && !this.domNode.isTiddlyWikiFakeDom) {