⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webhtmleditordocking.txt.exclude

📁 小孔子全站管理系统网站内容管理。相当于一个文章发布系统一个样
💻 EXCLUDE
📖 第 1 页 / 共 3 页
字号:


function lionskyDockingManager(doc, editor)
{
    this.Document = doc;    
    this.EnableDockingState = false;
    this.Editor = editor;
    this.DragHelperElem = null;
    this.DragHelperTooltip = null;
    this.DragHelperTooltipElem=null; 
    this.DockingZones=new Array(); 
	this.DockableObjects=new Array();
    this.InitializeDragHelper();
}
lionskyDockingManager.prototype.InitializeDragHelper = function()
{
	var div = this.Document.getElementById(this.Editor.Id + "_DragHelper");
	if(div)
	{
	    if (this.Document.all)
	    {
		    div.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=25)"; 
	    }
	    else 
	    {
		    div.style.setProperty("-moz-opacity","0.25",""); 
	    }
	    this.AttachDockDragProperty(div, false , false , true);  
        this.DragHelperElem = div;    
    }
    var oDiv=document.getElementById(this.Editor.Id + "_DragHelperTooltip");
    if(oDiv)
    {
	    this.AttachPrototype(oDiv,new lionskyDragHelperTooltipEventHandler(this)); 	
	    this.DragHelperTooltip = oDiv;
	}
}
lionskyDockingManager.prototype.GetDragHelperTooltipObject= function (mouseDownDockableObject)
{
	var dragHelperTooltipElem=mouseDownDockableObject.Controller.DragHelperTooltip; 
	if (!dragHelperTooltipElem)
	{
	    return null; 
	}
	dragHelperTooltipElem.SetzIndex(); 
	return dragHelperTooltipElem; 
} ; 

lionskyDockingManager.prototype.SetParentDockingZone = function(dockableObject)
{	
	if (dockableObject.ParentDockingZone)
	{
	    return; 
	}
	var dockingZone; 
	var dockingzoneAttribute=dockableObject.getAttribute("dockingzone"); 
	if (dockingzoneAttribute)
	{
		dockingZone=document.getElementById(dockingzoneAttribute); 
	}
	else if (dockableObject.parentNode.getAttribute("DockingMode"))
	{
		dockingZone=dockableObject.parentNode; 
	}
	if (dockingZone&&typeof(dockingZone.InsertBefore) == "function")
	{
		var dockingOrderAttribute=parseInt(dockableObject.getAttribute("dockingorder")); 
		if (isNaN(dockingOrderAttribute))
		{
			dockingOrderAttribute=null; 
		}
		dockingZone.InsertBefore(dockableObject,dockingOrderAttribute); 
	}
	else if (dockableObject.parentNode != document.body)
	{
		if ("complete" == document.readyState)
		{
			dockableObject.parentNode.removeChild(dockableObject); 
			document.body.appendChild(dockableObject); 
		}
		if (dockableObject.InsertBeforeSimulateLayer)
		{
			dockableObject.InsertBeforeSimulateLayer(); 
		}
	}
}
lionskyDockingManager.prototype.ShowDragHelperTooltip= function (e, rect, showFlag)
{
	var dragHelperTooltipElem = this.DragHelperTooltipElem; 
	if (dragHelperTooltipElem)
	{
		if (showFlag)
		{
			dragHelperTooltipElem.SetDragHelperTooltipValue("("+rect.left+","+rect.top+")"); 
		}
		else 
		{
			dragHelperTooltipElem.SetDragHelperTooltipValue("("+rect["width"]+" x "+rect["height"]+")"); 
		}
		var x=e.clientX+5+GetScrollLeft(document); 
		var y=e.clientY+5+GetScrollTop(document); 
		dragHelperTooltipElem.Show(x,y); 
	}
} ; 

lionskyDockingManager.prototype.EnableDocking = function(imageSrc)
{
    if (imageSrc)
	{
		var img=GetImage(); 
		if (img)
		{
			img.src=imageSrc; 
		}
	}
	if (this.EnableDockingState)
	{
	    return; 
	}
	this.Editor.attachEvent(document,"onmousemove",this.OnMouseOverDockingZoneEvent);  
	this.EnableDockingState= true;
}
lionskyDockingManager.prototype.RegisterDockingZone = function(dockableZone,dockingMode)
{
    if (!dockableZone)
    {
        return; 
    } 
	if (!dockingMode)
	{
		dockingMode=dockableZone.getAttribute("DockingMode"); 
	}
	this.AttachPrototype(dockableZone,new lionskyDockingZoneEventHandler(this)); 
	dockableZone.DockingMode=(dockingMode?dockingMode: "Horizontal");
	this.DockingZones.push(dockableZone); 
}
lionskyDockingManager.prototype.AttachPrototype= function (object,baseObject)
{
	for (var index in baseObject)
	{
		object[index]=baseObject[index]; 
	}
} ; 
lionskyDockingManager.prototype.RegisterDockableObject = function(dockableObject,allowShowDragHelper,attachDragHelperProperty,attachDragResizeProperty, effectsUpdateRate, effectsDuration, effectsEnable,allowMove,dockableMode)
{
	if (!dockableObject)
	{
	    return; 
	}
	if (null == allowShowDragHelper)
	{
	    allowShowDragHelper= true; 
	}
	if (null == attachDragHelperProperty)
	{
	    attachDragHelperProperty= true; 
	}
	this.InitializeDockableObject(dockableObject,allowShowDragHelper,attachDragHelperProperty,attachDragResizeProperty, effectsUpdateRate, effectsDuration, effectsEnable,allowMove,dockableMode); 
	this.SetParentDockingZone(dockableObject); 
}
lionskyDockingManager.prototype.InitializeDockableObject = function(dockableObject,allowShowDragHelper,attachDragHelperProperty,attachDragResizeProperty, effectsUpdateRate, effectsDuration, effectsEnable,allowMove,dockableMode)
{
	if (!dockableObject)
	{
	    return; 
	}
	if (dockableObject.DragHandleElemOnClick)
	{
	    return; 
	}
	allowMove=( true == dockableMode); 
	this.AttachDockDragProperty(dockableObject,allowShowDragHelper,attachDragHelperProperty,attachDragResizeProperty, effectsUpdateRate, effectsDuration, effectsEnable,allowMove,dockableMode);  
	dockableObject.Obo=null; 
	dockableObject.DragHandleElemClientOnClick=null; 
	dockableObject.AllowShowDragHelperCopy=dockableObject.AllowShowDragHelper; 
	this.AttachPrototype(dockableObject,new DockableObjectEventHandler(effectsUpdateRate, effectsDuration, effectsEnable)); 	
	dockableObject.ParentDockingZone=null; 
	if (dockableObject.Initialize)
	{
	    dockableObject.Initialize(); 
	}
	this.DockableObjects[this.DockableObjects.length]=dockableObject; 
}
lionskyDockingManager.prototype.SetWindowScroll = function (rect)
{
	var scrollBy_y = 0; 
	var scrollTop = GetScrollTop(document); 
	var scrollBottom = (document.body.clientHeight+scrollTop); 
	if (rect.top<scrollTop)
	{
		scrollBy_y = - ((scrollTop-rect.top) + 1); 
	}
	else if (rect.bottom>scrollBottom)
	{
		scrollBy_y = (rect.bottom-scrollBottom) + 1; 
	}
	var scrollBy_x = 0; 
	var scrollLeft = GetScrollLeft(document); 
	var scrollRight = (document.body.clientWidth+scrollLeft); 
	if (rect.left<scrollLeft)
	{
		scrollBy_x=-((scrollLeft-rect.left)+1); 
	}
	else if (rect.right>scrollRight)
	{
		scrollBy_x=(rect.right-scrollRight)+1; 
	}
	window.scrollBy(scrollBy_x,scrollBy_y); 
} ; 
lionskyDockingManager.prototype.AttachDragResizeProperty = function(dockableObject)
{
	if (!dockableObject)
	{
	    return; 
	}
	this.AttachPrototype(dockableObject,new DragResizeEventHandler(this)); 
	dockableObject.CanDragResize= true; 
	dockableObject.InitResizeArg(); 
}
lionskyDockingManager.prototype.AttachDockDragProperty = function (dockableObject,allowShowDragHelper,attachDragHelperProperty,attachDragResizeProperty, effectsUpdateRate, effectsDuration, effectsEnable,allowMove,dockableMode)
{
	if (!dockableObject)
	{
	    return; 
	}
	if (dockableObject.AccountMoveSize)
	{
	    return; 
	}
	this.AttachPrototype(dockableObject,new DockDragEventHandler(this, effectsUpdateRate, effectsDuration, effectsEnable)); 
	if (attachDragResizeProperty != false)
	{
	   this.AttachDragResizeProperty(dockableObject); 
	}
	dockableObject.OnDragStart=null; 
	dockableObject.OnMouseUpEvent=null; 
	dockableObject.CanMove= true; 
	dockableObject.CanResize= true; 
	if (attachDragHelperProperty != false &&null != document.all)
	{
	    this.AttachDragHelperProperty(dockableObject); 
	}
	dockableObject.AllowShowDragHelper=(allowShowDragHelper != false); 
	dockableObject.AllowMove=( false != allowMove); 
	if ("string" != typeof(dockableMode))
	{
	    dockableMode="";
	}
	dockableMode=dockableMode.toLowerCase(); 
}
lionskyDockingManager.prototype.AttachDragHelperProperty = function(dockableObject)
{	
	this.AttachPrototype(dockableObject,new DragHelperEventHandler()); 
	if ("complete" == document.readyState)
	{
		dockableObject.SetOverlay(); 
	}
	else 
	{
		dockableObject.NoSetOverlay= true;
	}
}
lionskyDockingManager.prototype.OnMouseOverDockingZoneEvent = function(e)
{
    if (!Cache_SelectDockableObject)
	{
	    return; 
	}
	if (Cache_SelectDockableObject.AllowMove)
	{
	    return; 
	}
	if (!e)
	{
		e=window.event; 
	}
	Cache_SelectDockableObject.OnMouseOverEvent(e); 
	if (Cache_SelectDockableObject.IsDragMove())
	{
		if (null == Cache_SelectDockableObject.ParentDockingZone||Cache_SelectDockableObject.AllowShowDragHelperCopy)
		{
			Cache_OnMouseOverDockingZone=null; 
			var dockingZone; 
			for (var i=0; i<Cache_SelectDockableObject.Controller.DockingZones.length; i++)
			{
				dockingZone=Cache_SelectDockableObject.Controller.DockingZones[i]; 
				if (dockingZone.HitTest(Cache_SelectDockableObject,null == Cache_OnMouseOverDockingZone,e))
				{
					if (!Cache_OnMouseOverDockingZone)
					{
						Cache_OnMouseOverDockingZone=dockingZone; 
					}
				}
			}
		}
		else if (!Cache_SelectDockableObject.AllowShowDragHelperCopy)
		{
			Cache_SelectDockableObject.DragHandleElemOnClick(e); 
		}
	}
	return CancelEvent(e); 
}

function lionskyDockingZoneEventHandler(controller)
{
    this.Controller=controller;
    this.CssClass = ";border-color:DarkBlue;border-style:Dashed;border-width:2px;";
}
lionskyDockingZoneEventHandler.prototype.Bounds = function()
{
    return GetObjectBounds(this); 
}
lionskyDockingZoneEventHandler.prototype.SetOnMouseOverDockingStyle = function(obj,cacheOnMouseOverDockingZone)
{
	if (!obj)
	{
	    return; 
	}
	if (cacheOnMouseOverDockingZone&&null == obj.TempCssClass)
	{
		obj.TempCssClass=obj.style.cssText; 
		obj.style.cssText+= this.CssClass; 
	}
	else if (!cacheOnMouseOverDockingZone&&null != obj.TempCssClass)
	{
		obj.style.cssText=obj.TempCssClass; 
		obj.TempCssClass=null; 
	}
}
lionskyDockingZoneEventHandler.prototype.HitTest = function(dockableObject, cacheOnMouseOverDockingZone, e)
{
	if (!dockableObject.CheckDockableModeisDockingMode(this ))
	{
	    return false; 
	}
	if (null == cacheOnMouseOverDockingZone)
	{
	    cacheOnMouseOverDockingZone= true; 
	}
	var dockableObjectRect=dockableObject.Bounds(); 
	var dockingZoneRect=this.Bounds(); 
	var x=e.clientX+GetScrollLeft(document); 
	var y=e.clientY+GetScrollTop(document); 
	var inBounds=this.Bounds().CheckInBounds(x,y); 
	this.OnMouseOverDockableObject=null; 
	var item; 
	for (var i=0; i<this.childNodes.length; i++)
	{
		item=this.childNodes[i]; 
		if (1 != item.nodeType || item.ParentDockingZone || item == dockableObject){continue;}
		if (!this.OnMouseOverDockableObject&&inBounds&&item.Bounds&&item.Bounds().CheckInBounds(x,y))
		{ 
			this.OnMouseOverDockableObject=item; 
		}
		this.SetOnMouseOverDockingStyle(item,cacheOnMouseOverDockingZone&&item == this.OnMouseOverDockableObject); 
	}
	if (!this.OnMouseOverDockableObject)
	{ 
		this.OnMouseOverDockableObject=(inBounds?this :null); 
	} 
	this.SetOnMouseOverDockingStyle(this,cacheOnMouseOverDockingZone&&this == this.OnMouseOverDockableObject); 
	return inBounds; 
}
lionskyDockingZoneEventHandler.prototype.GetDockableObjectByIndex = function(dockingOrderAttribute)
{
    if (0<=dockingOrderAttribute&&dockingOrderAttribute<this.childNodes.length)
    {
		return this.childNodes[dockingOrderAttribute]; 
	}
	return null;
}
lionskyDockingZoneEventHandler.prototype.InsertBefore = function(dockableObject, dockingOrderAttribute)
{
    if (this == dockableObject.ParentDockingZone)
    {
        return; 
    }
	if (null == dockableObject.getAttribute("dockable"))
	{
		alert("Error: You are trying to dock non-dockable object"); 
		return; 
	}
	if (!dockableObject.CheckDockableModeisDockingMode(this ))
	{
		alert("Error: You are not allowed to dock '"+dockableObject.id+"' to '"+this.id+"' docking zone"); 
		return;
	}
	dockableObject.ParentDockingZone=this ; 
	dockableObject.parentNode.removeChild(dockableObject); 
	dockableObject.style.position=""; 
	var insertBeforeObject; 
	
	if (null != dockingOrderAttribute)
	{
		insertBeforeObject=this.GetDockableObjectByIndex(dockingOrderAttribute); 
	}
	else 
	{
		insertBeforeObject=(this.OnMouseOverDockableObject != this ?this.OnMouseOverDockableObject:null); 
	}	
	if (insertBeforeObject)
	{ 
		this.insertBefore(dockableObject,insertBeforeObject); 
	}
	else 
	{ 
		this.appendChild(dockableObject); 
	} 
	this.SetOnMouseOverDockingStyle(this.OnMouseOverDockableObject, false); 
	this.OnMouseOverDockableObject=null; 
	dockableObject.SetDefault(); 
}

function DockableObjectEventHandler(effectsUpdateRate, effectsDuration, effectsEnable)
{
    this.EffectsUpdateRate = effectsUpdateRate; 
    this.EffectsDuration = effectsDuration;
    this.EffectsEnable = effectsEnable;
}

DockableObjectEventHandler.prototype.HaveParentDokingZone = function()
{	
	return (null != this.ParentDockingZone); 
}
DockableObjectEventHandler.prototype.InsertBefore = function()
{	
    if (!this.ParentDockingZoneCopy)
    {
        return;
    }
    this.ParentDockingZoneCopy.InsertBefore(this ); 
}
DockableObjectEventHandler.prototype.DragHandleElemOnClick = function(e)
{
	if (!this.ParentDockingZone)
	{
	    return; 
	}
	this.ParentDockingZone=null; 
	this.CanDragResize= true; 
	this.parentNode.removeChild(this ); 
	this.style.position="absolute"; 
	this.Hide(this.TitleGrip, true); 
	this.Hide(this.DragHandleElem, false); 
	document.body.appendChild(this); 
	this.SetzIndex(); 
	if (this.InsertBeforeSimulateLayer)
	{ 
		this.InsertBeforeSimulateLayer(); 
	}
	if (this.DragHandleElemClientOnClick)
	{ 
	    this.DragHandleElemClientOnClick(); 
	}
}
DockableObjectEventHandler.prototype.InsertBeforeDragHelperFrame = function()
{     
	if (this.InsertBeforeSimulateLayer&&!this.HaveParentDokingZone())
	{ 
		this.InsertBeforeSimulateLayer(); 
	}
} 
var Cache_OnMouseOverDockingZone=null; 
DockableObjectEventHandler.prototype.OnMouseUpEvent = function(e, rect)
{
    if(this.EffectsEnable)
    {
        var obj = this;
        var MotionHanlderList=new Array(); 
        var MoveToObject = new Object();
        MoveToObject.object = this;
        MoveToObject.Left = rect.left;
        MoveToObject.Top = rect.top;
        MoveToObject.NoInitializeEvent = true

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -