From 69d545448f8d0b9e6609585e61b7e876a8852d70 Mon Sep 17 00:00:00 2001 From: Stanislas Rolland Date: Thu, 8 Sep 2011 11:19:48 -0400 Subject: [PATCH] [BUGFIX] Padding of RTE statusbar is too big onLayout produces incorrect results when executed on a hidden element. Change-Id: Iffe239a05f43033ca7bb352d0f840e733b82bace Resolves: #29485 Releases: 4.5, 4.6 Reviewed-on: http://review.typo3.org/4859 Reviewed-by: Stanislas Rolland Tested-by: Stanislas Rolland --- typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js b/typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js index 2c733dc5fee4..5bd1f7747b33 100644 --- a/typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js +++ b/typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js @@ -834,17 +834,12 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, { * In all browsers, it breaks the evaluation of the framework dimensions */ initStyleChangeEventListener: function () { - if (this.isNested && !Ext.isWebKit) { + if (this.isNested && Ext.isGecko) { var options = { - stopEvent: true + stopEvent: true, + delay: 50 }; - if (Ext.isGecko) { - options.delay = 50; - } Ext.each(this.nestedParentElements.sorted, function (nested) { - if (!Ext.isGecko) { - options.target = Ext.get(nested); - } this.mon( Ext.get(nested), Ext.isIE ? 'propertychange' : 'DOMAttrModified', @@ -1823,6 +1818,19 @@ HTMLArea.Framework = Ext.extend(Ext.Panel, { HTMLArea.util.TYPO3.accessParentElements(parentElements, 'HTMLArea.Framework.superclass.doLayout.call(args[0])', [this]); } }, + /* + * onLayout will fail if inside a hidden tab or inline element + */ + onLayout: function () { + if (!this.isNested || HTMLArea.util.TYPO3.allElementsAreDisplayed(this.nestedParentElements.sorted)) { + HTMLArea.Framework.superclass.onLayout.call(this); + } else { + // Clone the array of nested tabs and inline levels instead of using a reference as HTMLArea.util.TYPO3.accessParentElements will modify the array + var parentElements = [].concat(this.nestedParentElements.sorted); + // Walk through all nested tabs and inline levels to get correct sizes + HTMLArea.util.TYPO3.accessParentElements(parentElements, 'HTMLArea.Framework.superclass.onLayout.call(args[0])', [this]); + } + }, /* * Make the framework resizable, if configured */ @@ -1882,18 +1890,14 @@ HTMLArea.Framework = Ext.extend(Ext.Panel, { this.resizer.resizeTo(frameworkWidth, frameworkHeight); } else { this.setSize(frameworkWidth, frameworkHeight); + this.doLayout(); } }, /* * Resize the framework components */ onFrameworkResize: function () { - // For unknown reason, in Chrome 7, this following is the only way to set the height of the iframe - if (Ext.isChrome) { - this.iframe.getResizeEl().dom.setAttribute('style', 'width:' + this.getInnerWidth() + 'px; height:' + this.getInnerHeight() + 'px;'); - } else { - this.iframe.setSize(this.getInnerWidth(), this.getInnerHeight()); - } + this.iframe.setSize(this.getInnerWidth(), this.getInnerHeight()); this.textArea.setSize(this.getInnerWidth(), this.getInnerHeight()); }, /* @@ -1910,12 +1914,7 @@ HTMLArea.Framework = Ext.extend(Ext.Panel, { if (this.getInnerHeight() <= 0) { this.onWindowResize(); } else { - // For unknown reason, in Chrome 7, this following is the only way to set the height of the iframe - if (Ext.isChrome) { - this.iframe.getResizeEl().dom.setAttribute('style', 'width:' + this.getInnerWidth() + 'px; height:' + this.getInnerHeight() + 'px;'); - } else { - this.iframe.setHeight(this.getInnerHeight()); - } + this.iframe.setHeight(this.getInnerHeight()); this.textArea.setHeight(this.getInnerHeight()); } }, -- 2.20.1