Changeset 1009
- Timestamp:
- 05/23/08 19:42:14 (5 years ago)
- Location:
- branches/new-dialogs-merge
- Files:
-
- 3 modified
-
XinhaCore.js (modified) (10 diffs)
-
modules/CreateLink/link.js (modified) (1 diff)
-
modules/Dialogs/XinhaDialog.js (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/new-dialogs-merge/XinhaCore.js
r1006 r1009 1782 1782 function(ev) 1783 1783 { 1784 ev = Xinha.is_ie ? window.event : ev;1784 ev = ev || window.event; 1785 1785 editor.btnClickEvent = {clientX : ev.clientX, clientY : ev.clientY}; 1786 1786 if ( obj.enabled ) … … 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 it 2207 2208 'rp_cell': this._panels.right.container, // right panel 2208 2209 … … 2259 2260 fw.table.appendChild(fw.tbody); 2260 2261 2261 var xinha = this._framework.table;2262 var xinha = fw.table; 2262 2263 this._htmlArea = xinha; 2263 2264 Xinha.freeLater(this, '_htmlArea'); … … 2265 2266 2266 2267 // create the toolbar and put in the area 2267 this._framework.tb_cell.appendChild( this._createToolbar() );2268 fw.tb_cell.appendChild( this._createToolbar() ); 2268 2269 2269 2270 // create the IFRAME & add to container … … 2271 2272 iframe.src = this.popupURL(editor.config.URIs.blank); 2272 2273 iframe.id = "XinhaIFrame_" + this._textArea.id; 2273 this._framework.ed_cell.appendChild(iframe);2274 fw.ed_cell.appendChild(iframe); 2274 2275 this._iframe = iframe; 2275 2276 this._iframe.className = 'xinha_iframe'; 2276 2277 Xinha.freeLater(this, '_iframe'); 2277 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 2278 2284 // creates & appends the status bar 2279 2285 var statusbar = this._createStatusBar(); 2280 this._framework.sb_cell.appendChild(statusbar);2286 fw.sb_cell.appendChild(statusbar); 2281 2287 2282 2288 // insert Xinha before the textarea. … … 2287 2293 // extract the textarea and insert it into the xinha framework 2288 2294 Xinha.removeFromParent(textarea); 2289 this._framework.ed_cell.appendChild(textarea);2295 fw.ed_cell.appendChild(textarea); 2290 2296 2291 2297 // if another editor is activated while this one is in text mode, toolbar is disabled … … 2469 2475 this._risizing = true; 2470 2476 2477 var framework = this._framework; 2478 2471 2479 this.notifyOf('before_resize', {width:width, height:height}); 2472 2480 this.firePluginEvent('onBeforeResize', width, height); … … 2580 2588 // } 2581 2589 2582 this._framework.tb_cell.colSpan = col_span;2583 this._framework.tp_cell.colSpan = col_span;2584 this._framework.bp_cell.colSpan = col_span;2585 this._framework.sb_cell.colSpan = col_span;2590 framework.tb_cell.colSpan = col_span; 2591 framework.tp_cell.colSpan = col_span; 2592 framework.bp_cell.colSpan = col_span; 2593 framework.sb_cell.colSpan = col_span; 2586 2594 2587 2595 // Put in the panel rows, top panel goes above editor row 2588 if ( ! this._framework.tp_row.childNodes.length )2589 { 2590 Xinha.removeFromParent( this._framework.tp_row);2596 if ( !framework.tp_row.childNodes.length ) 2597 { 2598 Xinha.removeFromParent(framework.tp_row); 2591 2599 } 2592 2600 else 2593 2601 { 2594 if ( !Xinha.hasParentNode( this._framework.tp_row) )2595 { 2596 this._framework.tbody.insertBefore(this._framework.tp_row, this._framework.ler_row);2602 if ( !Xinha.hasParentNode(framework.tp_row) ) 2603 { 2604 framework.tbody.insertBefore(framework.tp_row, framework.ler_row); 2597 2605 } 2598 2606 } 2599 2607 2600 2608 // bp goes after the editor 2601 if ( ! this._framework.bp_row.childNodes.length )2602 { 2603 Xinha.removeFromParent( this._framework.bp_row);2609 if ( !framework.bp_row.childNodes.length ) 2610 { 2611 Xinha.removeFromParent(framework.bp_row); 2604 2612 } 2605 2613 else 2606 2614 { 2607 if ( !Xinha.hasParentNode( this._framework.bp_row) )2608 { 2609 this._framework.tbody.insertBefore(this._framework.bp_row, this._framework.ler_row.nextSibling);2615 if ( !Xinha.hasParentNode(framework.bp_row) ) 2616 { 2617 framework.tbody.insertBefore(framework.bp_row, framework.ler_row.nextSibling); 2610 2618 } 2611 2619 } … … 2614 2622 if ( !this.config.statusBar ) 2615 2623 { 2616 Xinha.removeFromParent( this._framework.sb_row);2624 Xinha.removeFromParent(framework.sb_row); 2617 2625 } 2618 2626 else 2619 2627 { 2620 if ( !Xinha.hasParentNode( this._framework.sb_row) )2621 { 2622 this._framework.table.appendChild(this._framework.sb_row);2628 if ( !Xinha.hasParentNode(framework.sb_row) ) 2629 { 2630 framework.table.appendChild(framework.sb_row); 2623 2631 } 2624 2632 } 2625 2633 2626 2634 // Size and set colspans, link up the framework 2627 this._framework.lp_cell.style.width = this.config.panel_dimensions.left;2628 this._framework.rp_cell.style.width = this.config.panel_dimensions.right;2629 this._framework.tp_cell.style.height = this.config.panel_dimensions.top;2630 this._framework.bp_cell.style.height = this.config.panel_dimensions.bottom;2631 this._framework.tb_cell.style.height = this._toolBar.offsetHeight + 'px';2632 this._framework.sb_cell.style.height = this._statusBar.offsetHeight + 'px';2635 framework.lp_cell.style.width = this.config.panel_dimensions.left; 2636 framework.rp_cell.style.width = this.config.panel_dimensions.right; 2637 framework.tp_cell.style.height = this.config.panel_dimensions.top; 2638 framework.bp_cell.style.height = this.config.panel_dimensions.bottom; 2639 framework.tb_cell.style.height = this._toolBar.offsetHeight + 'px'; 2640 framework.sb_cell.style.height = this._statusBar.offsetHeight + 'px'; 2633 2641 2634 2642 var edcellheight = height - this._toolBar.offsetHeight - this._statusBar.offsetHeight; … … 2657 2665 this._textArea.style.height = this._iframe.style.height; 2658 2666 this._textArea.style.width = this._iframe.style.width; 2659 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 2660 2674 this.notifyOf('resize', {width:this._htmlArea.offsetWidth, height:this._htmlArea.offsetHeight}); 2661 2675 this.firePluginEvent('onResize',this._htmlArea.offsetWidth, this._htmlArea.offsetWidth); -
branches/new-dialogs-merge/modules/CreateLink/link.js
r1008 r1009 1 // Paste Plain Text plugin for Xinha 2 3 // Distributed under the same terms as Xinha itself. 4 // This notice MUST stay intact for use (see license.txt). 1 /*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:-- 2 -- Xinha (is not htmlArea) - http://xinha.org 3 -- 4 -- Use of Xinha is granted by the terms of the htmlArea License (based on 5 -- BSD license) please read license.txt in this package for details. 6 -- 7 -- Copyright (c) 2005-2008 Xinha Developer Team and contributors 8 -- 9 -- Xinha was originally based on work by Mihai Bazon which is: 10 -- Copyright (c) 2003-2004 dynarch.com. 11 -- Copyright (c) 2002-2003 interactivetools.com, inc. 12 -- This copyright notice MUST stay intact for use. 13 -- 14 -- This is the standard implementation of the Xinha.prototype._createLink method, 15 -- which provides the functionality to insert a hyperlink in the editor. 16 -- 17 -- The file is loaded as a special plugin by the Xinha Core when no alternative method (plugin) is loaded. 18 -- 19 -- 20 -- $HeadURL:http://svn.xinha.webfactional.com/trunk/modules/CreateLink/link.js $ 21 -- $LastChangedDate:2008-04-12 19:10:04 +0200 (Sa, 12 Apr 2008) $ 22 -- $LastChangedRevision:990 $ 23 -- $LastChangedBy:ray $ 24 --------------------------------------------------------------------------*/ 5 25 6 26 function CreateLink(editor) { -
branches/new-dialogs-merge/modules/Dialogs/XinhaDialog.js
r1007 r1009 122 122 var captionBar = main.removeChild( main.getElementsByTagName("h1")[0]); 123 123 rootElem.insertBefore(captionBar,main); 124 captionBar.onmousedown = function(ev) { dialog._dragStart(ev); };124 Xinha._addEvent(captionBar, 'mousedown',function(ev) { dialog.dragStart(ev); }); 125 125 126 126 captionBar.style.MozUserSelect = "none"; … … 178 178 for (var i=0; i<all.length;i++) 179 179 { 180 var el = all[i];180 var el = all[i]; 181 181 if (el.tagName.toLowerCase() == 'textarea' || el.tagName.toLowerCase() == 'input') 182 182 { … … 198 198 right= "0px"; 199 199 } 200 this.resizer.onmousedown = function(ev) { dialog._resizeStart(ev); };200 Xinha._addEvent(this.resizer, 'mousedown', function(ev) { dialog.resizeStart(ev); }); 201 201 rootElem.appendChild(this.resizer); 202 202 … … 248 248 249 249 // We need to preserve the selection 250 this._lastRange = this.editor.saveSelection(); 251 252 if (Xinha.is_ie && !modal) 253 { 254 dialog.saveSelection = function() { dialog._lastRange = dialog.editor.saveSelection();}; 255 Xinha._addEvent(this.editor._doc,'mouseup', dialog.saveSelection); 256 } 257 250 // if this is called before some editor has been activated, it activates the editor 251 if (Xinha._someEditorHasBeenActivated) 252 { 253 this._lastRange = this.editor.saveSelection(); 254 255 if (Xinha.is_ie && !modal) 256 { 257 dialog.saveSelection = function() { dialog._lastRange = dialog.editor.saveSelection();}; 258 Xinha._addEvent(this.editor._doc,'mouseup', dialog.saveSelection); 259 } 260 } 261 258 262 if ( modal ) this.editor.deactivateEditor(); 259 263 … … 281 285 282 286 //rootElemStyle.display = ''; 283 Xinha.Dialog.fadeIn(this.rootElem);287 Xinha.Dialog.fadeIn(this.rootElem); 284 288 var dialogHeight = rootElem.offsetHeight; 285 289 var dialogWidth = rootElem.offsetWidth; … … 369 373 //this.rootElem.style.display = 'none'; 370 374 Xinha.Dialog.fadeOut(this.rootElem); 371 this.hideBackground();375 this.hideBackground(); 372 376 var dialog = this; 373 377 … … 437 441 }; 438 442 439 Xinha.Dialog.prototype. _dragStart = function (ev)443 Xinha.Dialog.prototype.dragStart = function (ev) 440 444 { 441 445 if ( this.attached || this.dragging) … … 443 447 return; 444 448 } 449 if (!this.modal) 450 { 451 Xinha.Dialog.coverIframes(); 452 } 453 ev = ev || window.event; 454 445 455 this.editor.suspendUpdateToolbar = true; 446 456 var dialog = this; … … 452 462 var st = dialog.rootElem.style; 453 463 454 dialog.xOffs = ((Xinha.is_ie) ? window.event.offsetX : ev.layerX);455 dialog.yOffs = ((Xinha.is_ie) ? window.event.offsetY : ev.layerY);464 dialog.xOffs = ev.offsetX || ev.layerX; //first value for IE/Opera/Safari, second value for Gecko (or should I say "netscape";)) 465 dialog.yOffs = ev.offsetY || ev.layerY; 456 466 457 467 dialog.mouseMove = function(ev) { dialog.dragIt(ev); }; 458 Xinha._addEvent(document, "mousemove", dialog.mouseMove ); 468 Xinha._addEvent(document,"mousemove", dialog.mouseMove ); 469 459 470 dialog.mouseUp = function (ev) { dialog.dragEnd(ev); }; 460 Xinha._addEvent(document, "mouseup", dialog.mouseUp);471 Xinha._addEvent(document,"mouseup", dialog.mouseUp); 461 472 462 473 }; … … 470 481 return false; 471 482 } 472 ev = (Xinha.is_ie) ? window.event : ev;473 483 474 484 if (dialog.rootElem.style.position == 'absolute') … … 499 509 var dialog = this; 500 510 this.editor.suspendUpdateToolbar = false; 511 512 if (!this.modal) 513 { 514 Xinha.Dialog.unCoverIframes(); 515 } 516 501 517 if (!dialog.dragging) 502 518 { … … 506 522 507 523 Xinha._removeEvent(document, "mousemove", dialog.mouseMove ); 508 Xinha._removeEvent(document, "mouseup", dialog.mouseUp ); 524 Xinha._removeEvent(document, "mousemove", dialog.mouseMove ); 525 Xinha._removeEvent(document, "mouseup", dialog.mouseUp); 509 526 510 527 dialog.size.top = dialog.rootElem.style.top; … … 513 530 514 531 515 Xinha.Dialog.prototype. _resizeStart = function (ev) {532 Xinha.Dialog.prototype.resizeStart = function (ev) { 516 533 var dialog = this; 517 534 this.editor.suspendUpdateToolbar = true; … … 521 538 } 522 539 dialog.resizing = true; 540 if (!this.modal) 541 { 542 Xinha.Dialog.coverIframes(); 543 } 523 544 dialog.scrollPos = dialog.editor.scrollPos(); 524 545 … … 530 551 531 552 dialog.mouseMove = function(ev) { dialog.resizeIt(ev); }; 532 Xinha._addEvent(document, "mousemove", dialog.mouseMove );553 Xinha._addEvent(document,"mousemove", dialog.mouseMove ); 533 554 dialog.mouseUp = function (ev) { dialog.resizeEnd(ev); }; 534 Xinha._addEvent(document, "mouseup", dialog.mouseUp); 535 555 Xinha._addEvent(document,"mouseup", dialog.mouseUp); 536 556 }; 537 557 … … 554 574 var posX = ev.clientX; 555 575 } 556 576 557 577 posX -= dialog.xOffs; 558 578 posY -= dialog.yOffs; … … 580 600 dialog.resizing = false; 581 601 this.editor.suspendUpdateToolbar = false; 582 602 if (!this.modal) 603 { 604 Xinha.Dialog.unCoverIframes(); 605 } 583 606 Xinha._removeEvent(document, "mousemove", dialog.mouseMove ); 584 Xinha._removeEvent(document, "mouseup", dialog.mouseUp);607 Xinha._removeEvent(document, "mouseup", dialog.mouseUp); 585 608 586 609 dialog.size.width = dialog.rootElem.offsetWidth; … … 628 651 629 652 dialog.attached = false; 630 653 var pos = Xinha.getElementTopLeft(rootElem); 631 654 rootElem.style.position = "absolute"; 655 rootElem.style.top = pos.top + "px"; 656 rootElem.style.left = pos.left + "px"; 632 657 633 658 dialog.captionBar.style.paddingLeft = "22px"; … … 643 668 document.body.appendChild(rootElem); 644 669 645 if (ev)646 {647 var scrollPos = dialog.editor.scrollPos();648 rootElem.style.top = (ev.clientY + scrollPos.y) - ((Xinha.is_ie) ? window.event.offsetY : ev.layerY) + "px";649 rootElem.style.left =(ev.clientX + scrollPos.x) - ((Xinha.is_ie) ? window.event.offsetX : ev.layerX) + "px";650 }651 670 dialog.captionBar.ondblclick = function() { dialog.attachToPanel(rootElem.side); }; 652 671 … … 690 709 st.height = size.height; 691 710 st.width = size.width; 692 this.main.style.height = parseInt(size.height,10) - this.captionBar.offsetHeight + "px"; 693 this.main.style.width = size.width; 694 711 var width = parseInt(size.width, 10); 712 var height = parseInt(size.height,10) - this.captionBar.offsetHeight; 713 this.main.style.height = (height > 20) ? height : 20 + "px"; 714 this.main.style.width = (width > 10) ? width : 10 + 'px'; 695 715 } 696 716 Xinha.Dialog.prototype.setValues = function(values) … … 931 951 } 932 952 953 /** When several modeless dialogs are shown, one can be brought to front with this function (as happens on mouseclick) 954 * 955 * @param {XinhaDialog} dialog The dialog to activate 956 */ 933 957 934 958 Xinha.Dialog.activateModeless = function(dialog) 935 959 { 936 var zIndex;937 960 if (Xinha.Dialog.activeModeless == dialog || dialog.attached ) 938 961 { … … 948 971 Xinha.Dialog.activeModeless.rootElem.style.zIndex = parseInt(Xinha.Dialog.activeModeless.rootElem.style.zIndex) + 10; 949 972 } 973 /** Set opacity cross browser 974 * 975 * @param {DomNode} el The element to set the opacity 976 * @param {Object} value opacity value (percent) 977 */ 950 978 Xinha.Dialog.setOpacity = function(el,value) 951 979 { 952 if (typeof el.style.filter != 'undefined') 953 { 954 el.style.filter = (value < 100) ? 'alpha(opacity='+value+')' : ''; 955 } 956 else 957 { 958 el.style.opacity = value/100; 959 } 960 } 980 if (typeof el.style.filter != 'undefined') 981 { 982 el.style.filter = (value < 100) ? 'alpha(opacity='+value+')' : ''; 983 } 984 else 985 { 986 el.style.opacity = value/100; 987 } 988 } 989 /** Fade in an element 990 * 991 * @param {DomNode} el The element to fade 992 * @param {Number} delay Time for one step in ms 993 * @param {Number} endOpacity stop when this value is reached (percent) 994 * @param {Number} step Fade this much per step (percent) 995 */ 961 996 Xinha.Dialog.fadeIn = function(el,endOpacity,delay,step) 962 997 { 963 delay = delay || 1; 964 step = step || 25; 965 endOpacity = endOpacity || 100; 966 el.op = el.op || 0; 967 var op = el.op; 968 if (el.style.display == 'none') 969 { 970 Xinha.Dialog.setOpacity(el,0); 971 el.style.display = ''; 972 } 973 if (op < endOpacity) 974 { 975 el.op += step; 976 Xinha.Dialog.setOpacity(el,op); 977 el.timeOut = setTimeout(function(){Xinha.Dialog.fadeIn(el,endOpacity,delay,step);},delay); 978 } 979 else 980 { 981 Xinha.Dialog.setOpacity(el,endOpacity); 982 el.op = endOpacity; 983 el.timeOut = null; 984 } 985 } 986 998 delay = delay || 1; 999 step = step || 25; 1000 endOpacity = endOpacity || 100; 1001 el.op = el.op || 0; 1002 var op = el.op; 1003 if (el.style.display == 'none') 1004 { 1005 Xinha.Dialog.setOpacity(el,0); 1006 el.style.display = ''; 1007 } 1008 if (op < endOpacity) 1009 { 1010 el.op += step; 1011 Xinha.Dialog.setOpacity(el,op); 1012 el.timeOut = setTimeout(function(){Xinha.Dialog.fadeIn(el,endOpacity,delay,step);},delay); 1013 } 1014 else 1015 { 1016 Xinha.Dialog.setOpacity(el,endOpacity); 1017 el.op = endOpacity; 1018 el.timeOut = null; 1019 } 1020 } 1021 /** Fade out an element 1022 * 1023 * @param {DomNode} el The element to fade 1024 * @param {Number} delay Time for one step in ms 1025 * @param {Number} step Fade this much per step (percent) 1026 */ 987 1027 Xinha.Dialog.fadeOut = function(el,delay,step) 988 1028 { 989 delay = delay || 1; 990 step = step || 30; 991 if (typeof el.op == 'undefined') el.op = 100; 992 var op = el.op; 993 994 if (op >= 0) 995 { 996 el.op -= step; 997 Xinha.Dialog.setOpacity(el,op); 998 el.timeOut = setTimeout(function(){Xinha.Dialog.fadeOut(el,delay,step);},delay); 999 } 1000 else 1001 { 1002 Xinha.Dialog.setOpacity(el,0); 1003 el.style.display = 'none'; 1004 el.op = 0; 1005 el.timeOut = null; 1006 } 1007 } 1029 delay = delay || 1; 1030 step = step || 30; 1031 if (typeof el.op == 'undefined') el.op = 100; 1032 var op = el.op; 1033 1034 if (op >= 0) 1035 { 1036 el.op -= step; 1037 Xinha.Dialog.setOpacity(el,op); 1038 el.timeOut = setTimeout(function(){Xinha.Dialog.fadeOut(el,delay,step);},delay); 1039 } 1040 else 1041 { 1042 Xinha.Dialog.setOpacity(el,0); 1043 el.style.display = 'none'; 1044 el.op = 0; 1045 el.timeOut = null; 1046 } 1047 } 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 }
