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

📄 editorcode_ie.js

📁 通达网络办公 - Office Anywhere 2008 增强版100%源码(3.4.081216) 内含 通达OA2008增強版接近完美破解补丁20081216集 及 最新通达OA2008ADV(
💻 JS
📖 第 1 页 / 共 4 页
字号:
var TDEvents=function(A){this.Owner=A;this._RegisteredEvents={};};TDEvents.prototype.AttachEvent=function(A,B){var C;if (!(C=this._RegisteredEvents[A])) this._RegisteredEvents[A]=[B];else{if (C.IndexOf(B)==-1) C.push(B);}};TDEvents.prototype.FireEvent=function(A,B){var C=true;var D=this._RegisteredEvents[A];if (D){for (var i=0;i<D.length;i++){try{C=(D[i](this.Owner,B)&&C);}catch(e){if (e.number!=-2146823277) throw e;}}};return C;};
var TDDataProcessor=function(){};TDDataProcessor.prototype={ConvertToHtml:function(A){if (TDConfig.FullPage){TD.DocTypeDeclaration=A.match(TDRegexLib.DocTypeTag);if (!TDRegexLib.HasBodyTag.test(A)) A='<body>'+A+'</body>';if (!TDRegexLib.HtmlOpener.test(A)) A='<html dir="'+TDConfig.ContentLangDirection+'">'+A+'</html>';if (!TDRegexLib.HeadOpener.test(A)) A=A.replace(TDRegexLib.HtmlOpener,'$&<head><title></title></head>');return A;}else{var B=TDConfig.DocType+'<html dir="'+TDConfig.ContentLangDirection+'"';if (TDBrowserInfo.IsIE&&TDConfig.DocType.length>0&&!TDRegexLib.Html4DocType.test(TDConfig.DocType)) B+=' style="overflow-y: scroll"';B+='><head><title></title></head><body'+TDConfig.GetBodyAttributes()+'>'+A+'</body></html>';return B;}},ConvertToDataFormat:function(A,B,C,D){var E=TDXHtml.GetXHTML(A,!B,D);if (C&&TDRegexLib.EmptyOutParagraph.test(E)) return '';return E;},FixHtml:function(A){return A;}};
var TD={Name:TDURLParams['InstanceName'],Status:0,EditMode:0,Toolbar:null,HasFocus:false,DataProcessor:new TDDataProcessor(),AttachToOnSelectionChange:function(A){this.Events.AttachEvent('OnSelectionChange',A);},GetLinkedFieldValue:function(){return this.LinkedField.value;},GetParentForm:function(){return this.LinkedField.form;},StartupValue:'',IsDirty:function(){if (this.EditMode==1) return (this.StartupValue!=this.EditingArea.Textarea.value);else{if (!this.EditorDocument) return false;return (this.StartupValue!=this.EditorDocument.body.innerHTML);}},ResetIsDirty:function(){if (this.EditMode==1) this.StartupValue=this.EditingArea.Textarea.value;else if (this.EditorDocument.body) this.StartupValue=this.EditorDocument.body.innerHTML;},StartEditor:function(){this.TempBaseTag=TDConfig.BaseHref.length>0?'<base href="'+TDConfig.BaseHref+'" _temp="true"></base>':'';var A=TD.KeystrokeHandler=new TDKeystrokeHandler();A.OnKeystroke=_TD_KeystrokeHandler_OnKeystroke;A.SetKeystrokes(TDConfig.Keystrokes);if (TDBrowserInfo.IsIE7){if ((CTRL+86/*V*/) in A.Keystrokes) A.SetKeystrokes([CTRL+86,true]);if ((SHIFT+45/*INS*/) in A.Keystrokes) A.SetKeystrokes([SHIFT+45,true]);};A.SetKeystrokes([CTRL+8,true]);this.EditingArea=new TDEditingArea(document.getElementById('xEditingArea'));this.EditingArea.FFSpellChecker=TDConfig.FirefoxSpellChecker;this.SetData(this.GetLinkedFieldValue(),true);TDTools.AddEventListener(document,"keydown",this._TabKeyHandler);this.AttachToOnSelectionChange(_TD_PaddingNodeListener);if (TDBrowserInfo.IsGecko) this.AttachToOnSelectionChange(this._ExecCheckEmptyBlock);},Focus:function(){TD.EditingArea.Focus();},SetStatus:function(A){this.Status=A;if (A==1){TDFocusManager.AddWindow(window,true);if (TDBrowserInfo.IsIE) TDFocusManager.AddWindow(window.frameElement,true);if (TDConfig.StartupFocus) TD.Focus();};this.Events.FireEvent('OnStatusChange',A);},FixBody:function(){var A=TDConfig.EnterMode;if (A!='p'&&A!='div') return;var B=this.EditorDocument;if (!B) return;var C=B.body;if (!C) return;TDDomTools.TrimNode(C);var D=C.firstChild;var E;while (D){var F=false;switch (D.nodeType){case 1:if (!TDListsLib.BlockElements[D.nodeName.toLowerCase()]&&!D.getAttribute('_fakelement')&&D.getAttribute('_moz_dirty')==null) F=true;break;case 3:if (E||D.nodeValue.Trim().length>0) F=true;};if (F){var G=D.parentNode;if (!E) E=G.insertBefore(B.createElement(A),D);E.appendChild(G.removeChild(D));D=E.nextSibling;}else{if (E){TDDomTools.TrimNode(E);E=null;};D=D.nextSibling;}};if (E) TDDomTools.TrimNode(E);},GetData:function(A){if (TD.EditMode==1) return TD.EditingArea.Textarea.value;this.FixBody();var B=TD.EditorDocument;if (!B) return null;var C=TDConfig.FullPage;var D=TD.DataProcessor.ConvertToDataFormat(C?B.documentElement:B.body,!C,TDConfig.IgnoreEmptyParagraphValue,A);D=TD.ProtectEventsRestore(D);if (TDBrowserInfo.IsIE) D=D.replace(TDRegexLib.ToReplace,'$1');if (C){if (TD.DocTypeDeclaration&&TD.DocTypeDeclaration.length>0) D=TD.DocTypeDeclaration+'\n'+D;if (TD.XmlDeclaration&&TD.XmlDeclaration.length>0) D=TD.XmlDeclaration+'\n'+D;};return TDConfig.ProtectedSource.Revert(D);},UpdateLinkedField:function(){var A=TD.GetXHTML(TDConfig.FormatOutput);if (TDConfig.HtmlEncodeOutput) A=TDTools.HTMLEncode(A);TD.LinkedField.value=A;TD.Events.FireEvent('OnAfterLinkedFieldUpdate');},RegisteredDoubleClickHandlers:{},OnDoubleClick:function(A){var B=TD.RegisteredDoubleClickHandlers[A.tagName];if (B) B(A);},RegisterDoubleClickHandler:function(A,B){TD.RegisteredDoubleClickHandlers[B.toUpperCase()]=A;},OnAfterSetHTML:function(){TDDocumentProcessor.Process(TD.EditorDocument);TDUndo.SaveUndoStep();TD.Events.FireEvent('OnSelectionChange');TD.Events.FireEvent('OnAfterSetHTML');},ProtectUrls:function(A){A=A.replace(TDRegexLib.ProtectUrlsA,'$& _savedurl=$1');A=A.replace(TDRegexLib.ProtectUrlsImg,'$& _savedurl=$1');A=A.replace(TDRegexLib.ProtectUrlsArea,'$& _savedurl=$1');return A;},ProtectEvents:function(A){return A.replace(TDRegexLib.TagsWithEvent,_TD_ProtectEvents_ReplaceTags);},ProtectEventsRestore:function(A){return A.replace(TDRegexLib.ProtectedEvents,_TD_ProtectEvents_RestoreEvents);},ProtectTags:function(A){var B=TDConfig.ProtectedTags;if (TDBrowserInfo.IsIE) B+=B.length>0?'|ABBR|XML|EMBED':'ABBR|XML|EMBED';var C;if (B.length>0){C=new RegExp('<('+B+')(?!\w|:)','gi');A=A.replace(C,'<TD:$1');C=new RegExp('<\/('+B+')>','gi');A=A.replace(C,'<\/TD:$1>');};B='META';if (TDBrowserInfo.IsIE) B+='|HR';C=new RegExp('<(('+B+')(?=\\s|>|/)[\\s\\S]*?)/?>','gi');A=A.replace(C,'<TD:$1 />');return A;},SetData:function(A,B){this.EditingArea.Mode=TD.EditMode;if (TDBrowserInfo.IsIE&&TD.EditorDocument){TD.EditorDocument.detachEvent("onselectionchange",Doc_OnSelectionChange);};if (TD.EditMode==0){this._ForceResetIsDirty=(B===true);A=TDConfig.ProtectedSource.Protect(A);A=TD.DataProcessor.ConvertToHtml(A);A=A.replace(TDRegexLib.InvalidSelfCloseTags,'$1></$2>');A=TD.ProtectEvents(A);A=TD.ProtectUrls(A);A=TD.ProtectTags(A);if (TD.TempBaseTag.length>0&&!TDRegexLib.HasBaseTag.test(A)) A=A.replace(TDRegexLib.HeadOpener,'$&'+TD.TempBaseTag);var C='';if (!TDConfig.FullPage) C+=_TD_GetEditorAreaStyleTags();if (TDBrowserInfo.IsIE) C+=TD._GetBehaviorsStyle();else if (TDConfig.ShowBorders) C+='<link href="'+TDConfig.FullBasePath+'css/showtableborders_gecko.css" rel="stylesheet" type="text/css" _temp="true" />';C+='<link href="'+TDConfig.FullBasePath+'css/internal.css" rel="stylesheet" type="text/css" _temp="true" />';A=A.replace(TDRegexLib.HeadCloser,C+'$&');this.EditingArea.OnLoad=_TD_EditingArea_OnLoad;this.EditingArea.Start(A);}else{TD.EditorWindow=null;TD.EditorDocument=null;TDDomTools.PaddingNode=null;this.EditingArea.OnLoad=null;this.EditingArea.Start(A);this.EditingArea.Textarea._TDShowContextMenu=true;TD.EnterKeyHandler=null;if (B) this.ResetIsDirty();TD.KeystrokeHandler.AttachToElement(this.EditingArea.Textarea);this.EditingArea.Textarea.focus();TD.Events.FireEvent('OnAfterSetHTML');};if (TDBrowserInfo.IsGecko) window.onresize();},HasFocus:false,RedirectNamedCommands:{},ExecuteNamedCommand:function(A,B,C,D){if (!D) TDUndo.SaveUndoStep();if (!C&&TD.RedirectNamedCommands[A]!=null) TD.ExecuteRedirectedNamedCommand(A,B);else{TD.Focus();TD.EditorDocument.execCommand(A,false,B);TD.Events.FireEvent('OnSelectionChange');};if (!D) TDUndo.SaveUndoStep();},GetNamedCommandState:function(A){try{if (TDBrowserInfo.IsSafari&&TD.EditorWindow&&A.IEquals('Paste')) return 0;if (!TD.EditorDocument.queryCommandEnabled(A)) return -1;else{return TD.EditorDocument.queryCommandState(A)?1:0;}}catch (e){return 0;}},GetNamedCommandValue:function(A){var B='';var C=TD.GetNamedCommandState(A);if (C==-1) return null;try{B=this.EditorDocument.queryCommandValue(A);}catch(e) {};return B?B:'';},Paste:function(A){if (TD.Status!=2||!TD.Events.FireEvent('OnPaste')) return false;return A||TD._ExecPaste();},PasteFromWord:function(){TDDialog.OpenDialog('TDDialog_Paste',TDLang.PasteFromWord,'dialog/paste.html',400,330,'Word');},Preview:function(){var A=TDConfig.ScreenWidth*0.8;var B=TDConfig.ScreenHeight*0.7;var C=(TDConfig.ScreenWidth-A)/2;var D=window.open('',null,'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width='+A+',height='+B+',left='+C);var E;if (TDConfig.FullPage){if (TD.TempBaseTag.length>0) E=TD.TempBaseTag+TD.GetXHTML();else E=TD.GetXHTML();}else{E=TDConfig.DocType+'<html dir="'+TDConfig.ContentLangDirection+'"><head>'+TD.TempBaseTag+'<title>'+TDLang.Preview+'</title>'+_TD_GetEditorAreaStyleTags()+'</head><body'+TDConfig.GetBodyAttributes()+'>'+TD.GetXHTML()+'</body></html>';};D.document.write(E);D.document.close();},SwitchEditMode:function(A){var B=(TD.EditMode==0);var C=TD.IsDirty();var D;if (B){TDCommands.GetCommand('ShowBlocks').SaveState();if (!A&&TDBrowserInfo.IsIE) TDUndo.SaveUndoStep();D=TD.GetXHTML(TDConfig.FormatSource);if (D==null) return false;}else D=this.EditingArea.Textarea.value;TD.EditMode=B?1:0;TD.SetData(D,!C);TD.Focus();TDTools.RunFunction(TD.ToolbarSet.RefreshModeState,TD.ToolbarSet);return true;},InsertElement:function(A){if (typeof A=='string') A=this.EditorDocument.createElement(A);var B=A.nodeName.toLowerCase();var C=new TDDomRange(this.EditorWindow);if (TDListsLib.BlockElements[B]!=null){C.SplitBlock();C.InsertNode(A);var D=TDDomTools.GetNextSourceElement(A,false,null,['hr','br','param','img','area','input']);if (!D&&TDConfig.EnterMode!='br'){D=this.EditorDocument.body.appendChild(this.EditorDocument.createElement(TDConfig.EnterMode));if (TDBrowserInfo.IsGeckoLike) TDTools.AppendBogusBr(D);};if (TDListsLib.EmptyElements[B]==null) C.MoveToElementEditStart(A);else if (D) C.MoveToElementEditStart(D);else C.MoveToPosition(A,4);if (TDBrowserInfo.IsGecko){if (D) D.scrollIntoView(false);A.scrollIntoView(false);}}else{C.MoveToSelection();C.DeleteContents();C.InsertNode(A);C.SetStart(A,4);C.SetEnd(A,4);};C.Select();C.Release();this.Focus();return A;},_InsertBlockElement:function(A){},_IsFunctionKey:function(A){if (A>=16&&A<=20) return true;if (A==27||(A>=33&&A<=40)) return true;if (A==45) return true;return false;},_KeyDownListener:function(A){if (!A) A=TD.EditorWindow.event;if (TD.EditorWindow){if (!TD._IsFunctionKey(A.keyCode)&&!(A.ctrlKey||A.metaKey)&&!(A.keyCode==46)) TD._KeyDownUndo();};return true;},_KeyDownUndo:function(){if (!TDUndo.Typing){TDUndo.SaveUndoStep();TDUndo.Typing=true;TD.Events.FireEvent("OnSelectionChange");};TDUndo.TypesCount++;TDUndo.Changed=1;if (TDUndo.TypesCount>TDUndo.MaxTypes){TDUndo.TypesCount=0;TDUndo.SaveUndoStep();}},_TabKeyHandler:function(A){if (!A) A=window.event;var B=A.keyCode;if (B==9&&TD.EditMode!=0){if (TDBrowserInfo.IsIE){var C=document.selection.createRange();if (C.parentElement()!=TD.EditingArea.Textarea) return true;C.text='\t';C.select();}else{var a=[];var D=TD.EditingArea.Textarea;var E=D.selectionStart;var F=D.selectionEnd;a.push(D.value.substr(0,E));a.push('\t');a.push(D.value.substr(F));D.value=a.join('');D.setSelectionRange(E+1,E+1);};if (A.preventDefault) return A.preventDefault();return A.returnValue=false;};return true;}};TD.Events=new TDEvents(TD);TD.GetHTML=TD.GetXHTML=TD.GetData;TD.SetHTML=TD.SetData;TD.InsertElementAndGetIt=TD.CreateElement=TD.InsertElement;function _TD_ProtectEvents_ReplaceTags(A){return A.replace(TDRegexLib.EventAttributes,_TD_ProtectEvents_ReplaceEvents);};function _TD_ProtectEvents_ReplaceEvents(A,B){return ' '+B+'_protectedatt="'+encodeURIComponent(A)+'"';};function _TD_ProtectEvents_RestoreEvents(A,B){return decodeURIComponent(B);};function _TD_MouseEventsListener(A){if (!A) A=window.event;if (A.type=='mousedown') TD.MouseDownFlag=true;else if (A.type=='mouseup') TD.MouseDownFlag=false;else if (A.type=='mousemove') TD.Events.FireEvent('OnMouseMove',A);};function _TD_PaddingNodeListener(){if (TDConfig.EnterMode.IEquals('br')) return;TDDomTools.EnforcePaddingNode(TD.EditorDocument,TDConfig.EnterMode);if (!TDBrowserInfo.IsIE&&TDDomTools.PaddingNode){var A=TD.EditorWindow.getSelection();if (A&&A.rangeCount==1){var B=A.getRangeAt(0);if (B.collapsed&&B.startContainer==TD.EditorDocument.body&&B.startOffset==0){B.selectNodeContents(TDDomTools.PaddingNode);B.collapse(true);A.removeAllRanges();A.addRange(B);}}}else if (TDDomTools.PaddingNode){var C=TDSelection.GetParentElement();var D=TDDomTools.PaddingNode;if (C&&C.nodeName.IEquals('body')){if (TD.EditorDocument.body.childNodes.length==1&&TD.EditorDocument.body.firstChild==D){var B=TD.EditorDocument.body.createTextRange();var F=false;if (!D.childNodes.firstChild){D.appendChild(D.ownerDocument.createTextNode('\ufeff'));F=true;};B.moveToElementText(D);B.select();if (F) B.pasteHTML('');}}}};function _TD_EditingArea_OnLoad(){TD.EditorWindow=TD.EditingArea.Window;TD.EditorDocument=TD.EditingArea.Document;TD.InitializeBehaviors();TD.MouseDownFlag=false;TDTools.AddEventListener(TD.EditorDocument,'mousemove',_TD_MouseEventsListener);TDTools.AddEventListener(TD.EditorDocument,'mousedown',_TD_MouseEventsListener);TDTools.AddEventListener(TD.EditorDocument,'mouseup',_TD_MouseEventsListener);if (TDBrowserInfo.IsSafari){var A=function(evt){if (!(evt.ctrlKey||evt.metaKey)) return;if (TD.EditMode!=0) return;switch (evt.keyCode){case 89:TDUndo.Redo();break;case 90:TDUndo.Undo();break;}};TDTools.AddEventListener(TD.EditorDocument,'keyup',A);};TD.EnterKeyHandler=new TDEnterKey(TD.EditorWindow,TDConfig.EnterMode,TDConfig.ShiftEnterMode,TDConfig.TabSpaces);TD.KeystrokeHandler.AttachToElement(TD.EditorDocument);if (TD._ForceResetIsDirty) TD.ResetIsDirty();if (TDBrowserInfo.IsIE&&TD.HasFocus) TD.EditorDocument.body.setActive();TD.OnAfterSetHTML();TDCommands.GetCommand('ShowBlocks').RestoreState();if (TD.Status!=0) return;if (TDConfig.Debug) TDDebug._GetWindow();TD.SetStatus(1);};function _TD_GetEditorAreaStyleTags(){var A='';var B=TDConfig.EditorAreaCSS;var C=TDConfig.EditorAreaStyles;for (var i=0;i<B.length;i++) A+='<link href="'+B[i]+'" rel="stylesheet" type="text/css" />';if (C&&C.length>0) A+="<style>"+C+"</style>";return A;};function _TD_KeystrokeHandler_OnKeystroke(A,B){if (TD.Status!=2) return false;if (TD.EditMode==0){switch (B){case 'Paste':return!TD.Paste();case 'Cut':TDUndo.SaveUndoStep();return false;}}else{if (B.Equals('Paste','Undo','Redo','SelectAll','Cut')) return false;};var C=TD.Commands.GetCommand(B);return (C.Execute.apply(C,TDTools.ArgumentsToArray(arguments,2))!==false);};(function(){var A=window.parent.document;var B=A.getElementById(TD.Name);var i=0;while (B||i==0){if (B&&B.tagName.toLowerCase().Equals('input','textarea')){TD.LinkedField=B;break;};B=A.getElementsByName(TD.Name)[i++];}})();var TDTempBin={Elements:[],AddElement:function(A){var B=this.Elements.length;this.Elements[B]=A;return B;},RemoveElement:function(A){var e=this.Elements[A];this.Elements[A]=null;return e;},Reset:function(){var i=0;while (i<this.Elements.length) this.Elements[i++]=null;this.Elements.length=0;}};var TDFocusManager=TD.FocusManager={IsLocked:false,AddWindow:function(A,B){var C;if (TDBrowserInfo.IsIE) C=A.nodeType==1?A:A.frameElement?A.frameElement:A.document;else if (TDBrowserInfo.IsSafari) C=A;else C=A.document;TDTools.AddEventListener(C,'blur',TDFocusManager_Win_OnBlur);TDTools.AddEventListener(C,'focus',B?TDFocusManager_Win_OnFocus_Area:TDFocusManager_Win_OnFocus);},RemoveWindow:function(A){if (TDBrowserInfo.IsIE) oTarget=A.nodeType==1?A:A.frameElement?A.frameElement:A.document;else oTarget=A.document;TDTools.RemoveEventListener(oTarget,'blur',TDFocusManager_Win_OnBlur);TDTools.RemoveEventListener(oTarget,'focus',TDFocusManager_Win_OnFocus_Area);TDTools.RemoveEventListener(oTarget,'focus',TDFocusManager_Win_OnFocus);},Lock:function(){this.IsLocked=true;},Unlock:function(){if (this._HasPendingBlur) TDFocusManager._Timer=window.setTimeout(TDFocusManager_FireOnBlur,100);this.IsLocked=false;},_ResetTimer:function(){this._HasPendingBlur=false;if (this._Timer){window.clearTimeout(this._Timer);delete this._Timer;}}};function TDFocusManager_Win_OnBlur(){if (typeof(TD)!='undefined'&&TD.HasFocus){TDFocusManager._ResetTimer();TDFocusManager._Timer=window.setTimeout(TDFocusManager_FireOnBlur,100);}};function TDFocusManager_FireOnBlur(){if (TDFocusManager.IsLocked) TDFocusManager._HasPendingBlur=true;else{TD.HasFocus=false;TD.Events.FireEvent("OnBlur");}};function TDFocusManager_Win_OnFocus_Area(){TD.Focus();TDFocusManager_Win_OnFocus();};function TDFocusManager_Win_OnFocus(){TDFocusManager._ResetTimer();if (!TD.HasFocus&&!TDFocusManager.IsLocked){TD.HasFocus=true;TD.Events.FireEvent("OnFocus");}};
TD.Description="TDeditor for Internet Explorer 5.5+";TD._GetBehaviorsStyle=function(){if (!TD._BehaviorsStyle){var A=TDConfig.FullBasePath;var B='';var C;C='<style type="text/css" _temp="true">';if (TDConfig.ShowBorders) B='url('+A+'css/behaviors/showtableborders.htc)';C+='INPUT,TEXTAREA,SELECT,.TD__Anchor,.TD__PageBreak,.TD__InputHidden';if (TDConfig.DisableObjectResizing){C+=',IMG';B+=' url('+A+'css/behaviors/disablehandles.htc)';};C+=' { behavior: url('+A+'css/behaviors/disablehandles.htc) ; }';if (B.length>0) C+='TABLE { behavior: '+B+' ; }';C+='</style>';TD._BehaviorsStyle=C;};return TD._BehaviorsStyle;};function Doc_OnMouseUp(){if (TD.EditorWindow.event.srcElement.tagName=='HTML'){TD.Focus();TD.EditorWindow.event.cancelBubble=true;TD.EditorWindow.event.returnValue=false;}};function Doc_OnPaste(){var A=TD.EditorDocument.body;A.detachEvent('onpaste',Doc_OnPaste);var B=TD.Paste(!TDConfig.ForcePasteAsPlainText&&!TDConfig.AutoDetectPasteFromWord);A.attachEvent('onpaste',Doc_OnPaste);return B;};function Doc_OnDblClick(){TD.OnDoubleClick(TD.EditorWindow.event.srcElement);TD.EditorWindow.event.cancelBubble=true;};function Doc_OnSelectionChange(){if (TD.EditorDocument) TD.Events.FireEvent("OnSelectionChange");};function Doc_OnDrop(){if (TD.MouseDownFlag){TD.MouseDownFlag=false;return;};var A=TD.EditorWindow.event;if (TDConfig.ForcePasteAsPlainText){if (TD._CheckIsPastingEnabled()||TDConfig.ShowDropDialog) TD.PasteAsPlainText(A.dataTransfer.getData('Text'));}else{if (TDConfig.ShowDropDialog) TDTools.RunFunction(TDDialog.OpenDialog,TDDialog,['TDDialog_Paste',TDLang.Paste,'dialog/paste.html',400,330,'Security']);};A.returnValue=false;A.cancelBubble=true;};TD.InitializeBehaviors=function(A){this.EditorDocument.attachEvent('onmouseup',Doc_OnMouseUp);this.EditorDocument.body.attachEvent('onpaste',Doc_OnPaste);this.EditorDocument.body.attachEvent('ondrop',Doc_OnDrop);TD.ContextMenu._InnerContextMenu.AttachToElement(TD.EditorDocument.body);this.EditorDocument.attachEvent("onkeydown",TD._KeyDownListener);this.EditorDocument.attachEvent("ondblclick",Doc_OnDblClick);this.EditorDocument.attachEvent("onselectionchange",Doc_OnSelectionChange);};TD.InsertHtml=function(A){A=TDConfig.ProtectedSource.Protect(A);A=TD.ProtectEvents(A);A=TD.ProtectUrls(A);A=TD.ProtectTags(A);TD.EditorWindow.focus();TDUndo.SaveUndoStep();var B=TD.EditorDocument.selection;if (B.type.toLowerCase()=='control') B.clear();A='<span id="__fakeTDRemove__">&nbsp;</span>'+A;B.createRange().pasteHTML(A);TD.EditorDocument.getElementById('__fakeTDRemove__').removeNode(true);TDDocumentProcessor.Process(TD.EditorDocument);this.Events.FireEvent("OnSelectionChange");};TD.SetInnerHtml=function(A){var B=TD.EditorDocument;B.body.innerHTML='<div id="__fakeTDRemove__">&nbsp;</div>'+A;B.getElementById('__fakeTDRemove__').removeNode(true);};function TD_PreloadImages(){var A=new TDImagePreloader();A.AddImages(TDConfig.PreloadImages);A.AddImages(TDConfig.SkinPath+'strip.gif');A.OnComplete=LoadToolbarSetup;A.Start();};function Document_OnContextMenu(){return (event.srcElement._TDShowContextMenu==true);};document.oncontextmenu=Document_OnContextMenu;function TD_Cleanup(){this.LinkedField=null;this.EditorWindow=null;this.EditorDocument=null;};TD._ExecPaste=function(){if (TD._PasteIsRunning) return true;if (TDConfig.ForcePasteAsPlainText){TD.PasteAsPlainText();return false;};var A=TD._CheckIsPastingEnabled(true);if (A===false) TDTools.RunFunction(TDDialog.OpenDialog,TDDialog,['TDDialog_Paste',TDLang.Paste,'dialog/paste.html',400,330,'Security']);else{if (TDConfig.AutoDetectPasteFromWord&&A.length>0){var B=/<\w[^>]*(( class="?MsoNormal"?)|(="mso-))/gi;if (B.test(A)){if (confirm(TDLang.PasteWordConfirm)){TD.PasteFromWord();return false;}}};TD._PasteIsRunning=true;TD.ExecuteNamedCommand('Paste');delete TD._PasteIsRunning;};return false;};TD.PasteAsPlainText=function(A){if (!TD._CheckIsPastingEnabled()){TDDialog.OpenDialog('TDDialog_Paste',TDLang.PasteAsText,'dialog/paste.html',400,330,'PlainText');return;};var B=null;if (!A) B=clipboardData.getData("Text");else B=A;if (B&&B.length>0){B=TDTools.HTMLEncode(B);B=TDTools.ProcessLineBreaks(window,TDConfig,B);var C=B.search('</p>');var D=B.search('<p>');if ((C!=-1&&D!=-1&&C<D)||(C!=-1&&D==-1)){var E=B.substr(0,C);B=B.substr(C+4);this.InsertHtml(E);};TDUndo.SaveLocked=true;this.InsertHtml(B);TDUndo.SaveLocked=false;}};TD._CheckIsPastingEnabled=function(A){TD._PasteIsEnabled=false;document.body.attachEvent('onpaste',TD_CheckPasting_Listener);var B=TD.GetClipboardHTML();document.body.detachEvent('onpaste',TD_CheckPasting_Listener);if (TD._PasteIsEnabled){if (!A) B=true;}else B=false;delete TD._PasteIsEnabled;return B;};function TD_CheckPasting_Listener(){TD._PasteIsEnabled=true;};TD.GetClipboardHTML=function(){var A=document.getElementById('___TDHiddenDiv');if (!A){A=document.createElement('DIV');A.id='___TDHiddenDiv';var B=A.style;B.position='absolute';B.visibility=B.overflow='hidden';B.width=B.height=1;document.body.appendChild(A);};A.innerHTML='';var C=document.body.createTextRange();C.moveToElementText(A);C.execCommand('Paste');var D=A.innerHTML;A.innerHTML='';return D;};TD.CreateLink=function(A,B){var C=[];TD.ExecuteNamedCommand('Unlink',null,false,!!B);if (A.length>0){if (TDSelection.GetType()=='Control'){var D=this.EditorDocument.createElement('A');D.href=A;var E=TDSelection.GetSelectedElement();E.parentNode.insertBefore(D,E);E.parentNode.removeChild(E);D.appendChild(E);return [D];};var F='javascript:void(0);/*'+(new Date().getTime())+'*/';TD.ExecuteNamedCommand('CreateLink',F,false,!!B);var G=this.EditorDocument.links;for (i=0;i<G.length;i++){var D=G[i];if (D.getAttribute('href',2)==F){var I=D.innerHTML;D.href=A;D.innerHTML=I;var J=D.lastChild;if (J&&J.nodeName=='BR'){TDDomTools.InsertAfterNode(D,D.removeChild(J));};C.push(D);}}};return C;};
var TDConfig=TD.Config={};if (document.location.protocol=='file:'){TDConfig.BasePath=decodeURIComponent(document.location.pathname.substr(1));TDConfig.BasePath=TDConfig.BasePath.replace(/\\/gi, '/');var sFullProtocol=document.location.href.match(/^(file\:\/{2,3})/)[1];if (TDBrowserInfo.IsOpera) sFullProtocol+='localhost/';TDConfig.BasePath=sFullProtocol+TDConfig.BasePath.substring(0,TDConfig.BasePath.lastIndexOf('/')+1);TDConfig.FullBasePath=TDConfig.BasePath;}else{TDConfig.BasePath=document.location.pathname.substring(0,document.location.pathname.lastIndexOf('/')+1);TDConfig.FullBasePath=document.location.protocol+'//'+document.location.host+TDConfig.BasePath;};TDConfig.EditorPath=TDConfig.BasePath.replace(/editor\/$/,'');try{TDConfig.ScreenWidth=screen.width;TDConfig.ScreenHeight=screen.height;}catch (e){TDConfig.ScreenWidth=800;TDConfig.ScreenHeight=600;};TDConfig.ProcessHiddenField=function(){this.PageConfig={};var A=window.parent.document.getElementById(TD.Name+'___Config');if (!A) return;var B=A.value.split('&');for (var i=0;i<B.length;i++){if (B[i].length==0) continue;var C=B[i].split('=');var D=decodeURIComponent(C[0]);var E=decodeURIComponent(C[1]);if (D=='CustomConfigurationsPath') TDConfig[D]=E;else if (E.toLowerCase()=="true") this.PageConfig[D]=true;else if (E.toLowerCase()=="false") this.PageConfig[D]=false;else if (E.length>0&&!isNaN(E)) this.PageConfig[D]=parseInt(E,10);else this.PageConfig[D]=E;}};function TDConfig_LoadPageConfig(){var A=TDConfig.PageConfig;for (var B in A) TDConfig[B]=A[B];};function TDConfig_PreProcess(){var A=TDConfig;if (A.AllowQueryStringDebug){try{if ((/debug=true/i).test(window.top.location.search)) A.Debug=true;}catch (e) {/*Ignore it. Much probably we are inside a FRAME where the "top" is in another domain (security error).*/}};if (!A.PluginsPath.EndsWith('/')) A.PluginsPath+='/';if (typeof(A.EditorAreaCSS)=='string') A.EditorAreaCSS=A.EditorAreaCSS.split(',');var B=A.ToolbarComboPreviewCSS;if (!B||B.length==0) A.ToolbarComboPreviewCSS=A.EditorAreaCSS;else if (typeof(B)=='string') A.ToolbarComboPreviewCSS=[B];};TDConfig.ToolbarSets={};TDConfig.Plugins={};TDConfig.Plugins.Items=[];TDConfig.Plugins.Add=function(A,B,C){TDConfig.Plugins.Items.AddItem([A,B,C]);};TDConfig.ProtectedSource={};TDConfig.ProtectedSource._CodeTag=(new Date()).valueOf();TDConfig.ProtectedSource.RegexEntries=[/<!--[\s\S]*?-->/g,/<script[\s\S]*?<\/script>/gi,/<noscript[\s\S]*?<\/noscript>/gi,/<object[\s\S]+?<\/object>/gi];TDConfig.ProtectedSource.Add=function(A){this.RegexEntries.AddItem(A);};TDConfig.ProtectedSource.Protect=function(A){var B=this._CodeTag;function _Replace(protectedSource){var C=TDTempBin.AddElement(protectedSource);return '<!--{'+B+C+'}-->';};for (var i=0;i<this.RegexEntries.length;i++){A=A.replace(this.RegexEntries[i],_Replace);};return A;};TDConfig.ProtectedSource.Revert=function(A,B){function _Replace(m,opener,index){var C=B?TDTempBin.RemoveElement(index):TDTempBin.Elements[index];return TDConfig.ProtectedSource.Revert(C,B);};var D=new RegExp("(<|&lt;)!--\\{"+this._CodeTag+"(\\d+)\\}--(>|&gt;)","g");return A.replace(D,_Replace);};TDConfig.GetBodyAttributes=function(){var A='';if (this.BodyId&&this.BodyId.length>0) A+=' id="'+this.BodyId+'"';if (this.BodyClass&&this.BodyClass.length>0) A+=' class="'+this.BodyClass+'"';return A;};TDConfig.ApplyBodyAttributes=function(A){if (this.BodyId&&this.BodyId.length>0) A.id=TDConfig.BodyId;if (this.BodyClass&&this.BodyClass.length>0) A.className+=' '+TDConfig.BodyClass;};
var TDDebug={};TDDebug._GetWindow=function(){if (!this.DebugWindow||this.DebugWindow.closed) this.DebugWindow=window.open(TDConfig.BasePath+'debug.html','TDeditorDebug','menubar=no,scrollbars=yes,resizable=yes,location=no,toolbar=no,width=600,height=500',true);return this.DebugWindow;};TDDebug.Output=function(A,B,C){if (!TDConfig.Debug) return;try{this._GetWindow().Output(A,B);}catch (e) {}};TDDebug.OutputObject=function(A,B){if (!TDConfig.Debug) return;try{this._GetWindow().OutputObject(A,B);}catch (e) {}}

⌨️ 快捷键说明

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