[kupu-checkins] r43560 - kupu/trunk/kupu/common

duncan at codespeak.net duncan at codespeak.net
Tue May 22 12:49:26 CEST 2007


Author: duncan
Date: Tue May 22 12:49:25 2007
New Revision: 43560

Modified:
   kupu/trunk/kupu/common/kupudrawers.js
Log:
Fix up the mask frame so it is correctly sized and positioned under all drawers. The frame stops select boxes and embedded objects showing through the drawer in IE.


Modified: kupu/trunk/kupu/common/kupudrawers.js
==============================================================================
--- kupu/trunk/kupu/common/kupudrawers.js	(original)
+++ kupu/trunk/kupu/common/kupudrawers.js	Tue May 22 12:49:25 2007
@@ -39,8 +39,10 @@
         }
         this.current_drawer = drawer;
         if (args===undefined) args = [];
+        drawer.initMask(drawer.element);
         drawer.createContent.apply(drawer, args);
         drawer.editor.suspendEditing();
+        drawer.fixMask();
     };
 
     this.updateState = function(selNode) {
@@ -80,6 +82,9 @@
 };
 
 proto.hide = function() {
+    if (this.maskframe) {
+        this.maskframe.style.display='none';
+    }
     this.element.style.display = 'none';
     this.focussed = false;
 };
@@ -106,6 +111,37 @@
     }
 };
 
+proto.initMask = function(el) {
+    var e = this.maskframe = document.getElementById('kupu-maskframe');
+    if (!this.maskframe) {
+        e = this.maskframe = newElement('iframe',
+            {'id':'kupu-maskframe','src':"javascript:false;", 'frameBorder':"0", 'scrolling':"no" });
+        var style = e.style;
+        style.display = 'none';
+    }
+    el.parentNode.insertBefore(e, el);
+};
+
+proto.fixMask = function() {
+    var mask = this.maskframe;
+    if (mask) {
+        if (mask.parentNode != this.element.parentNode) {
+            this.element.parentNode.insertBefore(mask, this.element);
+        }
+        // display the mask to hide SELECT boxes in IE
+        var el = this.element;
+        var st = mask.style;
+        var st1 = el.style;
+        st.top=st1.top;
+        st.left=st1.left;
+        st.width = el.offsetWidth+'px';
+        st.height = el.offsetHeight+'px';
+        st.left = (el.offsetLeft)+'px';
+        st.position = 'absolute';
+        st.display = '';
+    }
+}
+
 function DrawerWithAnchors(editor, drawertool, anchorui) {
     Drawer.call(this, editor, drawertool);
     this.anchorui = anchorui;
@@ -480,15 +516,7 @@
             this.baseelement = getBaseTagClass(document.body, 'div', 'kupu-librarydrawer-parent');
         }
         this.anchorframe = getBaseTagClass(this.baseelement, 'iframe', 'kupu-anchorframe');
-        this.maskframe = getBaseTagClass(this.baseelement, 'iframe', 'kupu-maskframe');
         var e;
-        if (!this.maskframe) {
-            e = this.maskframe = newElement('iframe',
-                {'className':'kupu-maskframe','src':"javascript:false;", 'frameBorder':"0", 'scrolling':"no" });
-            var style = e.style;
-            style.display = 'none';
-            this.baseelement.insertBefore(e, this.baseelement.firstChild);
-        }
         this.tool = tool;
         this.element = document.getElementById(this.drawerid);
         if (!this.element) {
@@ -532,7 +560,6 @@
     this.hide = function() {
         var el = this.element;
         el.style.left = el.style.top = '';
-        this.maskframe.style.display='none';
         LibraryDrawer.prototype.hide.call(this);
     };
 
@@ -615,13 +642,6 @@
 
         // display the drawer div
         this.element.style.display = 'block';
-        // display the mask to hide SELECT boxes in IE
-        var st = this.maskframe.style;
-        var st1 = this.element.style;
-        st.top=st1.top;st.left=st1.left;
-        st.width = this.element.offsetWidth+'px';
-        st.height = this.element.offsetHeight+'px';
-        st.display = '';
     };
 
     this._singleLibsXslCallback = function(dom) {
@@ -710,6 +730,7 @@
         if (this.editor.getBrowserName() == 'IE' && id == this.resourcespanelid) {
             this.updateDisplay(this.drawerid);
         };
+        this.fixMask();
     };
 
     this.updateResources = function() {


More information about the kupu-checkins mailing list