In IE, now resizing on iframe init with onresize instead of a somewhat arbitrary setTimeout() delay.
This prevents the resize from breaking and only showing part of the iframe contents.
This commit is contained in:
parent
8b911179f8
commit
1ded442791
|
@ -20,7 +20,8 @@ function Editor( id, notebook_id, note_text, deleted_from, revisions_list, read_
|
||||||
"scrolling": "no",
|
"scrolling": "no",
|
||||||
"id": iframe_id,
|
"id": iframe_id,
|
||||||
"name": iframe_id,
|
"name": iframe_id,
|
||||||
"class": "note_frame"
|
"class": "note_frame",
|
||||||
|
"onresize": function () { self.resize(); }
|
||||||
} );
|
} );
|
||||||
this.iframe.editor = this;
|
this.iframe.editor = this;
|
||||||
this.title = null;
|
this.title = null;
|
||||||
|
@ -171,15 +172,11 @@ Editor.prototype.finish_init = function () {
|
||||||
|
|
||||||
if ( this.iframe.contentDocument ) { // browsers such as Firefox
|
if ( this.iframe.contentDocument ) { // browsers such as Firefox
|
||||||
if ( this.read_write ) this.exec_command( "styleWithCSS", false );
|
if ( this.read_write ) this.exec_command( "styleWithCSS", false );
|
||||||
this.resize();
|
|
||||||
if ( this.init_highlight ) self.highlight();
|
|
||||||
} else { // browsers such as IE, which won't resize correctly if done too soon
|
|
||||||
setTimeout( function () {
|
|
||||||
self.resize();
|
|
||||||
if ( self.init_highlight ) self.highlight();
|
|
||||||
}, 50 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.resize();
|
||||||
|
if ( this.init_highlight ) self.highlight();
|
||||||
|
|
||||||
this.scrape_title();
|
this.scrape_title();
|
||||||
if ( this.init_focus )
|
if ( this.init_focus )
|
||||||
this.focus();
|
this.focus();
|
||||||
|
@ -244,10 +241,12 @@ Editor.prototype.insert_html = function ( html ) {
|
||||||
Editor.prototype.resize = function () {
|
Editor.prototype.resize = function () {
|
||||||
var dimensions;
|
var dimensions;
|
||||||
// TODO: find a better way to determine which dimensions to use than just checking for contentDocument
|
// TODO: find a better way to determine which dimensions to use than just checking for contentDocument
|
||||||
if ( this.iframe.contentDocument ) // Firefox
|
if ( this.iframe.contentDocument ) { // Firefox
|
||||||
dimensions = { "h": elementDimensions( this.document.documentElement ).h };
|
dimensions = { "h": elementDimensions( this.document.documentElement ).h };
|
||||||
else // IE
|
} else { // IE
|
||||||
|
if ( !this.document ) return;
|
||||||
dimensions = { "h": this.document.body.scrollHeight };
|
dimensions = { "h": this.document.body.scrollHeight };
|
||||||
|
}
|
||||||
|
|
||||||
setElementDimensions( this.iframe, dimensions );
|
setElementDimensions( this.iframe, dimensions );
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue