fix autoresizing editor on ie
This commit is contained in:
parent
650fe73386
commit
4e86a104c2
2 changed files with 22 additions and 23 deletions
|
|
@ -62,13 +62,11 @@ var ScrollBarV = function(parent, renderer) {
|
|||
// of 0px
|
||||
// in Firefox 6+ scrollbar is hidden if element has the same width as scrollbar
|
||||
// make element a little bit wider to retain scrollbar when page is zoomed
|
||||
renderer.once("beforeRender", function() {
|
||||
renderer.$scrollbarWidth =
|
||||
this.width = dom.scrollbarWidth(parent.ownerDocument);
|
||||
this.fullWidth = this.width;
|
||||
this.element.style.width = (this.width || 15) + 5 + "px";
|
||||
this.setVisible(false);
|
||||
}.bind(this));
|
||||
renderer.$scrollbarWidth =
|
||||
this.width = dom.scrollbarWidth(parent.ownerDocument);
|
||||
this.fullWidth = this.width;
|
||||
this.element.style.width = (this.width || 15) + 5 + "px";
|
||||
this.setVisible(false);
|
||||
this.element.style.overflowY = "scroll";
|
||||
|
||||
event.addListener(this.element, "scroll", this.onScrollV.bind(this));
|
||||
|
|
@ -89,12 +87,10 @@ var ScrollBarH = function(parent, renderer) {
|
|||
// of 0px
|
||||
// in Firefox 6+ scrollbar is hidden if element has the same width as scrollbar
|
||||
// make element a little bit wider to retain scrollbar when page is zoomed
|
||||
renderer.once("beforeRender", function() {
|
||||
this.height = renderer.$scrollbarWidth;
|
||||
this.fullHeight = this.height;
|
||||
this.element.style.height = (this.height || 15) + 5 + "px";
|
||||
this.setVisible(false);
|
||||
}.bind(this));
|
||||
this.height = renderer.$scrollbarWidth;
|
||||
this.fullHeight = this.height;
|
||||
this.element.style.height = (this.height || 15) + 5 + "px";
|
||||
this.setVisible(false);
|
||||
this.element.style.overflowX = "scroll";
|
||||
|
||||
event.addListener(this.element, "scroll", this.onScrollH.bind(this));
|
||||
|
|
|
|||
|
|
@ -318,10 +318,14 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.resizing++;
|
||||
else
|
||||
this.resizing = force ? 1 : 0;
|
||||
// `|| el.scrollHeight` is required for outosizing editors on ie
|
||||
// where elements with clientHeight = 0 alsoe have clientWidth = 0
|
||||
var el = this.container;
|
||||
if (!height)
|
||||
height = this.container.clientHeight;
|
||||
height = el.clientHeight || el.scrollHeight;
|
||||
if (!width)
|
||||
width = this.container.clientWidth;
|
||||
width = el.clientWidth || el.scrollWidth;
|
||||
|
||||
var changes = this.$updateCachedSize(force, gutterWidth, width, height);
|
||||
|
||||
// console.log("resizing to", width, height, JSON.stringify(this.$size))
|
||||
|
|
@ -332,18 +336,18 @@ var VirtualRenderer = function(container, theme) {
|
|||
// }.bind(this), 500)
|
||||
|
||||
if (!this.$size.scrollerHeight)
|
||||
return;
|
||||
return this.resizing = 0;
|
||||
|
||||
if (force)
|
||||
this.$gutterLayer.$padding = null;
|
||||
|
||||
if (force)
|
||||
this.$renderChanges(changes, true);
|
||||
else
|
||||
this.$loop.schedule(changes);
|
||||
|
||||
if (force)
|
||||
this.$gutterLayer.$padding = null;
|
||||
|
||||
if (force)
|
||||
delete this.resizing;
|
||||
if (this.resizing)
|
||||
this.resizing = 0;
|
||||
};
|
||||
|
||||
this.$updateCachedSize = function(force, gutterWidth, width, height) {
|
||||
|
|
@ -398,7 +402,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.onGutterResize = function() {
|
||||
var gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;
|
||||
if (gutterWidth != this.gutterWidth)
|
||||
this.$updateCachedSize(true, gutterWidth, this.$size.width, this.$size.height);
|
||||
this.$changes != this.$updateCachedSize(true, gutterWidth, this.$size.width, this.$size.height);
|
||||
|
||||
if (this.session.getUseWrapMode() && this.adjustWrapLimit())
|
||||
this.$loop.schedule(this.CHANGE_FULL);
|
||||
|
|
@ -727,7 +731,6 @@ var VirtualRenderer = function(container, theme) {
|
|||
|
||||
this.$renderChanges = function(changes, force) {
|
||||
if ((!this.session || !this.container.offsetWidth) || (!changes && !force)) {
|
||||
this.$logChanges(changes);
|
||||
this.$changes |= changes;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue