Changeset 1010
- Timestamp:
- 05/24/08 16:45:43 (5 years ago)
- Location:
- branches/new-dialogs-merge
- Files:
-
- 3 modified
-
Xinha.css (modified) (2 diffs)
-
XinhaCore.js (modified) (4 diffs)
-
modules/Dialogs/XinhaDialog.js (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/new-dialogs-merge/Xinha.css
r1007 r1010 122 122 } 123 123 .xinha_dialog_background { 124 filter: alpha(opacity = 0); 125 -moz-opacity: 0; 126 opacity: 0; 127 border:none; 128 } 129 .xinha_dialog_background.modal { 124 130 background-color:#666; 125 131 filter: alpha(opacity = 70); … … 127 133 opacity: 0.7; 128 134 border:none; 135 } 136 body.xinha_dialog_background.modal { 137 filter: alpha(opacity = 100); 129 138 } 130 139 .dialog .content { padding: 2px; } -
branches/new-dialogs-merge/XinhaCore.js
r1009 r1010 2205 2205 'lp_cell': this._panels.left.container, // left panel 2206 2206 'ed_cell': document.createElement('td'), // editor 2207 'iframe_cover' : document.createElement('div'), //the editor iframe has to be covered when draging a dialog over it2208 2207 'rp_cell': this._panels.right.container, // right panel 2209 2208 … … 2276 2275 this._iframe.className = 'xinha_iframe'; 2277 2276 Xinha.freeLater(this, '_iframe'); 2278 2279 fw.iframe_cover.style.display = 'none';2280 fw.iframe_cover.style.position = 'absolute';2281 2282 fw.ed_cell.appendChild(fw.iframe_cover);2283 2277 2284 2278 // creates & appends the status bar … … 2665 2659 this._textArea.style.height = this._iframe.style.height; 2666 2660 this._textArea.style.width = this._iframe.style.width; 2667 2668 var iframePos = Xinha.getElementTopLeft(this._iframe); 2669 framework.iframe_cover.style.top = iframePos.top; 2670 framework.iframe_cover.style.left = iframePos.left; 2671 framework.iframe_cover.style.height = this._iframe.style.height; 2672 framework.iframe_cover.style.width = this._iframe.style.width; 2673 2661 2674 2662 this.notifyOf('resize', {width:this._htmlArea.offsetWidth, height:this._htmlArea.offsetHeight}); 2675 2663 this.firePluginEvent('onResize',this._htmlArea.offsetWidth, this._htmlArea.offsetWidth); … … 5504 5492 }; 5505 5493 5494 Xinha.getEvent = function(ev) 5495 { 5496 return ev || window.event; 5497 } 5506 5498 /** 5507 5499 * Prepares an element to receive more than one DOM-0 event handler -
branches/new-dialogs-merge/modules/Dialogs/XinhaDialog.js
r1009 r1010 14 14 -- This is the new all-in-one implementation of dialogs for Xinha 15 15 -- 16 17 16 -- 18 17 -- $HeadURL:http://svn.xinha.webfactional.com/trunk/modules/Dialogs/inline-dialog.js $ … … 43 42 44 43 45 if (Xinha.is_ie && Xinha.ie_version < 7)44 if (Xinha.is_ie) 46 45 { // IE6 needs the iframe to hide select boxes 47 46 var backG = document.createElement("iframe"); … … 50 49 { 51 50 var doc = window.event.srcElement.contentWindow.document; 52 if (doc && doc.body) 53 { 54 doc.body.style.backgroundColor = "#666666"; 51 if (this.readyState == 'complete' && doc && doc.body) 52 { 53 var div = doc.createElement('div'); 54 //insert styles to make background color skinable 55 var styles, stylesheets = document.styleSheets; 56 for (var i=0;i<stylesheets.length;i++) 57 { 58 if (stylesheets[i].id.indexOf('Xinha') != -1 && stylesheets[i].cssText) 59 styles += stylesheets[i].cssText; 60 } 61 div.innerHTML = '<br><style type="text/css">\Å'+styles+'\n</style>'; // strange way, but didn't work otherwise 62 doc.getElementsByTagName('body')[0].appendChild(div); 63 doc.body.className = 'xinha_dialog_background'; 64 if (dialog.modal) doc.body.className += ' modal'; 55 65 } 56 66 } … … 62 72 } 63 73 backG.className = "xinha_dialog_background"; 74 if (this.modal) backG.className += ' modal'; 64 75 with (backG.style) 65 76 { … … 125 136 126 137 captionBar.style.MozUserSelect = "none"; 127 138 captionBar.style.WebkitUserSelect = "none"; //seems to have no effect 139 captionBar.unselectable = "on"; 140 captionBar.onselectstart = function() {return false;}; 141 128 142 this.buttons = document.createElement('div'); 129 143 with (this.buttons.style) … … 141 155 this.closer.className= 'closeButton'; 142 156 143 this.closer.onmousedown = function(ev) { this.className = "closeButton buttonClick"; Xinha._stopEvent( (ev) ? ev : window.event); return false;};144 this.closer.onmouseout = function(ev) { this.className = "closeButton"; Xinha._stopEvent( (ev) ? ev : window.event); return false;};157 this.closer.onmousedown = function(ev) { this.className = "closeButton buttonClick"; Xinha._stopEvent(Xinha.getEvent(ev)); return false;}; 158 this.closer.onmouseout = function(ev) { this.className = "closeButton"; Xinha._stopEvent(Xinha.getEvent(ev)); return false;}; 145 159 this.closer.onmouseup = function() { this.className = "closeButton"; dialog.hide(); return false;}; 146 160 … … 153 167 154 168 butX.appendChild(document.createTextNode('\u00D7')); // cross 169 //below different symbols for future use 155 170 //butX.appendChild(document.createTextNode('\u25AC')); //bar 156 171 //butX.appendChild(document.createTextNode('\u25BA')); //triangle right … … 242 257 } 243 258 244 if ( modal )245 {246 this.posBackground({top:0, left:0});247 }248 249 259 // We need to preserve the selection 250 260 // if this is called before some editor has been activated, it activates the editor 251 261 if (Xinha._someEditorHasBeenActivated) 252 262 { 253 this._lastRange = this.editor.saveSelection();263 this._lastRange = this.editor.saveSelection(); 254 264 255 265 if (Xinha.is_ie && !modal) … … 272 282 if ( !this.attached ) 273 283 { 274 this.showBackground();275 var viewport = Xinha.viewportSize();276 284 if ( modal ) 277 285 { 278 var pageSize = Xinha.pageSize(); 279 this.resizeBackground({width:pageSize.x + "px",height:pageSize.y + "px"}); 280 } 281 var viewportHeight = viewport.y; 282 var viewportWidth = viewport.x; 286 this.showBackground() 287 this.posBackground({top:0, left:0}); 288 this.resizeBackground(Xinha.Dialog.calcFullBgSize()); 289 } 290 else this.background.style.display = ''; 291 283 292 //this.onResizeWin = function () {dialog.sizeBackground()}; 284 293 //Xinha._addEvent(window, 'resize', this.onResizeWin ); … … 288 297 var dialogHeight = rootElem.offsetHeight; 289 298 var dialogWidth = rootElem.offsetWidth; 290 299 var viewport = Xinha.viewportSize(); 300 var viewportHeight = viewport.y; 301 var viewportWidth = viewport.x; 302 291 303 if (dialogHeight > viewportHeight) 292 304 { … … 449 461 if (!this.modal) 450 462 { 451 Xinha.Dialog.coverIframes(); 452 } 453 ev = ev || window.event; 463 this.posBackground({top:0, left:0}); 464 this.resizeBackground(Xinha.Dialog.calcFullBgSize()); 465 } 466 ev = Xinha.getEvent(ev); 454 467 455 468 this.editor.suspendUpdateToolbar = true; … … 467 480 dialog.mouseMove = function(ev) { dialog.dragIt(ev); }; 468 481 Xinha._addEvent(document,"mousemove", dialog.mouseMove ); 469 482 if (Xinha.is_ie) Xinha._addEvent(this.background.contentWindow.document,"mousemove", dialog.mouseMove ); 483 470 484 dialog.mouseUp = function (ev) { dialog.dragEnd(ev); }; 471 485 Xinha._addEvent(document,"mouseup", dialog.mouseUp); 472 486 if (Xinha.is_ie) Xinha._addEvent(this.background.contentWindow.document,"mouseup", dialog.mouseUp); 473 487 }; 474 488 … … 498 512 499 513 dialog.posDialog(newPos); 500 501 if (!dialog.modal)502 {503 dialog.posBackground(newPos);504 }505 514 }; 506 515 … … 509 518 var dialog = this; 510 519 this.editor.suspendUpdateToolbar = false; 511 512 if (!this.modal) 513 { 514 Xinha.Dialog.unCoverIframes(); 515 } 516 520 517 521 if (!dialog.dragging) 518 522 { … … 522 526 523 527 Xinha._removeEvent(document, "mousemove", dialog.mouseMove ); 524 Xinha._removeEvent(document, "mousemove", dialog.mouseMove ); 525 Xinha._removeEvent(document, "mouseup", dialog.mouseUp); 526 528 if (Xinha.is_ie) Xinha._removeEvent(this.background.contentWindow.document, "mousemove", dialog.mouseMove ); 529 Xinha._removeEvent(document, "mouseup", dialog.mouseUp); 530 if (Xinha.is_ie) Xinha._removeEvent(this.background.contentWindow.document, "mouseup", dialog.mouseUp); 531 532 var rootElemStyle = dialog.rootElem.style; 533 527 534 dialog.size.top = dialog.rootElem.style.top; 528 535 dialog.size.left = dialog.rootElem.style.left; 529 }; 530 536 537 if (!this.modal) 538 { 539 this.sizeBgToDialog(); 540 } 541 542 }; 531 543 532 544 Xinha.Dialog.prototype.resizeStart = function (ev) { … … 540 552 if (!this.modal) 541 553 { 542 Xinha.Dialog.coverIframes(); 554 this.posBackground({top:0, left:0}); 555 this.resizeBackground(Xinha.Dialog.calcFullBgSize()); 543 556 } 544 557 dialog.scrollPos = dialog.editor.scrollPos(); … … 552 565 dialog.mouseMove = function(ev) { dialog.resizeIt(ev); }; 553 566 Xinha._addEvent(document,"mousemove", dialog.mouseMove ); 567 if (Xinha.is_ie) Xinha._addEvent(this.background.contentWindow.document,"mousemove", dialog.mouseMove ); 554 568 dialog.mouseUp = function (ev) { dialog.resizeEnd(ev); }; 555 569 Xinha._addEvent(document,"mouseup", dialog.mouseUp); 570 if (Xinha.is_ie) Xinha._addEvent(this.background.contentWindow.document,"mouseup", dialog.mouseUp ); 556 571 }; 557 572 … … 584 599 dialog.sizeDialog(newSize); 585 600 586 if (!this.modal)587 {588 dialog.resizeBackground(newSize);589 }590 601 591 602 dialog.width = dialog.rootElem.offsetWidth; … … 600 611 dialog.resizing = false; 601 612 this.editor.suspendUpdateToolbar = false; 602 if (!this.modal) 603 { 604 Xinha.Dialog.unCoverIframes(); 605 } 613 606 614 Xinha._removeEvent(document, "mousemove", dialog.mouseMove ); 615 if (Xinha.is_ie) Xinha._removeEvent(this.background.contentWindow.document, "mouseup", dialog.mouseUp); 607 616 Xinha._removeEvent(document, "mouseup", dialog.mouseUp); 617 if (Xinha.is_ie) Xinha._removeEvent(this.background.contentWindow.document, "mouseup", dialog.mouseUp); 608 618 609 619 dialog.size.width = dialog.rootElem.offsetWidth; 610 620 dialog.size.height = dialog.rootElem.offsetHeight; 621 622 if (!this.modal) 623 { 624 this.sizeBgToDialog(); 625 } 611 626 }; 612 627 … … 619 634 this.attached = true; 620 635 this.rootElem.side = side; 621 this.captionBar.ondblclick = function(ev) { dialog.detachFromPanel( ev ? ev :window.event); };636 this.captionBar.ondblclick = function(ev) { dialog.detachFromPanel(Xinha.getEvent(ev)); }; 622 637 623 638 rootElem.style.position = "static"; 624 639 rootElem.parentNode.removeChild(rootElem); 640 641 this.background.style.display = 'none'; 625 642 626 643 this.captionBar.style.paddingLeft = "3px"; … … 648 665 var dialog = this; 649 666 var rootElem = dialog.rootElem; 667 var rootElemStyle = rootElem.style; 650 668 var editor = dialog.editor; 651 669 652 670 dialog.attached = false; 671 672 this.background.style.display = ''; 673 this.sizeBgToDialog(); 674 653 675 var pos = Xinha.getElementTopLeft(rootElem); 654 rootElem .style.position = "absolute";655 rootElem .style.top = pos.top + "px";656 rootElem .style.left = pos.left + "px";676 rootElemStyle.position = "absolute"; 677 rootElemStyle.top = pos.top + "px"; 678 rootElemStyle.left = pos.left + "px"; 657 679 658 680 dialog.captionBar.style.paddingLeft = "22px"; … … 661 683 dialog.icon.style.display = ''; 662 684 663 664 685 if ( dialog.size.width ) rootElem.style.width = dialog.size.width + 'px'; 665 686 … … 672 693 }; 673 694 695 Xinha.Dialog.calcFullBgSize = function() 696 { 697 var page = Xinha.pageSize(); 698 var viewport = Xinha.viewportSize(); 699 return {width:(page.x > viewport.x ? page.x : viewport.x ) + "px",height:(page.x > viewport.y ? page.y : viewport.y ) + "px"}; 700 } 701 702 Xinha.Dialog.prototype.sizeBgToDialog = function() 703 { 704 var rootElemStyle = this.rootElem.style; 705 var bgStyle = this.background.style; 706 bgStyle.top = rootElemStyle.top; 707 bgStyle.left = rootElemStyle.left; 708 bgStyle.width = rootElemStyle.width; 709 bgStyle.height = rootElemStyle.height; 710 } 674 711 Xinha.Dialog.prototype.hideBackground = function() 675 712 { … … 1046 1083 } 1047 1084 } 1048 Xinha.Dialog.coverIframes = function()1049 {1050 for (var i=0;i<__xinhas.length;i++)1051 {1052 __xinhas[i]._framework.iframe_cover.style.display = '';1053 }1054 }1055 Xinha.Dialog.unCoverIframes = function()1056 {1057 for (var i=0;i<__xinhas.length;i++)1058 {1059 __xinhas[i]._framework.iframe_cover.style.display = 'none';1060 }1061 }
