mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-09-13 21:31:23 +00:00
Major refactoring of rendering mechanism
We now use a fake DOM implementation on the server to let us share more rendering code between the text output vs. DOM output paths.
This commit is contained in:
@@ -49,7 +49,7 @@ BitmapEditor.prototype.postRenderInDom = function() {
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(currImage,0,0);
|
||||
// And also copy the current bitmap to the off-screen canvas
|
||||
self.currCanvas = document.createElement("canvas");
|
||||
self.currCanvas = self.editWidget.renderer.renderTree.document.createElement("canvas");
|
||||
self.currCanvas.width = currImage.width;
|
||||
self.currCanvas.height = currImage.height;
|
||||
ctx = self.currCanvas.getContext("2d");
|
||||
|
||||
@@ -127,12 +127,12 @@ TextEditor.prototype.fixHeight = function() {
|
||||
$tw.utils.nextTick(function() {
|
||||
// Resize the textarea to fit its content
|
||||
var textarea = self.editWidget.children[0].domNode,
|
||||
scrollTop = document.body.scrollTop;
|
||||
scrollTop = self.editWidget.renderer.renderTree.document.body.scrollTop;
|
||||
textarea.style.height = "auto";
|
||||
var newHeight = Math.max(textarea.scrollHeight + textarea.offsetHeight - textarea.clientHeight,MIN_TEXT_AREA_HEIGHT);
|
||||
if(newHeight !== textarea.offsetHeight) {
|
||||
textarea.style.height = newHeight + "px";
|
||||
document.body.scrollTop = scrollTop;
|
||||
self.editWidget.renderer.renderTree.document.body.scrollTop = scrollTop;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -143,7 +143,7 @@ TextEditor.prototype.postRenderInDom = function() {
|
||||
};
|
||||
|
||||
TextEditor.prototype.refreshInDom = function() {
|
||||
if(document.activeElement !== this.editWidget.children[0].domNode) {
|
||||
if(this.editWidget.renderer.renderTree.document.activeElement !== this.editWidget.children[0].domNode) {
|
||||
var editInfo = this.getEditInfo();
|
||||
this.editWidget.children[0].domNode.value = editInfo.value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user