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

📄 isc_richtexteditor.js

📁 javascript 很酷的类库
💻 JS
📖 第 1 页 / 共 3 页
字号:
,isc.A.$23h=function(_1){return this.$lh(_1)},isc.A.handleKeyPress=function(_1,_2){var _3=isc.EH.getKey();if(this.ignoreKeys.contains(_3))return isc.EH.STOP_BUBBLING;if(this.countLines)this.rememberSelectionStartLine();this.$23k();var _4=this.Super("handleKeyPress",arguments);if(isc.Browser.isIE&&this.$23l){isc.Timer.clearTimeout(this.$23l);delete this.$23l}if(_4!=false&&isc.Browser.isIE&&_3==this.$10j){this.$223();this.$225.pasteHTML(this.$9z);this.$225.collapse(true);this.$225.select();_4=false}return _4},isc.A.$23k=function(){if(!this.$23m){this.$23m=true;if(!this.$23n)this.$23n="$23o";isc.Page.setEvent(isc.EH.IDLE,this,isc.Page.FIRE_ONCE,this.$23n)}},isc.A.$23o=function(){delete this.$23m;var _1=this.contents,_2=this.getContents();if(_1==_2)return;if(this.countLines&&this.selectionIsCollapsed())this.doLinesChanged(_1,_2);this.adjustOverflow("edited");if(this.changed!=null)this.changed(_1,_2);this.contents=_2},isc.A.setSyntaxHiliter=function(_1){if(_1==null){this.removeSyntaxHiliter;return}this.syntaxHiliter=_1;this.countLines=true;var _2=this.getContents()||isc.emptyString;this.setContents(_2)},isc.A.removeSyntaxHiliter=function(){var _1=this.getContents()||isc.emptyString;delete this.syntaxHiliter;delete this.countLines;this.setContents(_1)},isc.A.doLinesChanged=function(_1,_2){var _3=this.getLastSelectionStartLine();if(_3==null)return;var _4=this.getLine(_3);var _5=isc.emptyString;var _6=this.markCurrentSelection();if(isc.Browser.isIE){if(!_4){this.getLineContainer().innerHTML=isc.emptyString;var _7=this.createLine();this.getLineContainer().appendChild(_7);var _8=document.selection.createRange();_8.moveToElementText(_7);_8.collapse();_8.select();_6=this.markCurrentSelection();_3=0;_4=this.getLine(0)}_5=_4.innerHTML}else{var _9=this.getSelectionStartLine();var _10=this.getLineNumber(_9);if(_10<_3){_4=_9;_3=_10}var _11=_4;var _12=0;while(_11&&_11!=_9){if(_11.innerHTML){_5+=_11.innerHTML}_12++;_11=_11.nextSibling}var _13=_9.nextSibling;if(_13&&_13.tagName.toLowerCase()=="br"){_13.parentNode.removeChild(_13);_9.appendChild(_13)}_5+=_9.innerHTML;if(!_5.replace(/\n|\r/g,isc.emptyString).match(/<br>$/i)){if(_9.nextSibling){_5+=_9.nextSibling.innerHTML;_12++}}}if(!_1){_1=this.contents;_2=this.getContents()}if(this.linesChanged){this.linesChanged(_1,_2,_3,_12,_5,_6)}else if(this.syntaxHiliter){this.doSyntaxHilite(_1,_2,_3,_12,_5,_6)}},isc.A.doSyntaxHilite=function(_1,_2,_3,_4,_5,_6){var _7=this.removeMarkup(_5,true);var _8=this.getSelectionMarkerIndex(_7);if(_8==-1){this.doFullSyntaxHilite();return}_7=this.removeMarkup(_5);var _9=this.syntaxHiliter.hilite(_7,true,_8,this.$23p(_6));this.overwriteLines(_3,_4,_9);this.moveSelectionToMarker(_6)},isc.A.doFullSyntaxHilite=function(){var _1=this.markCurrentSelection();var _2=this.$23q();var _3=this.removeMarkup(_2,true);var _4=this.getSelectionMarkerIndex(_3);if(_4==-1){_4=_2.length}_3=this.removeMarkup(_2);this.setContents(_3,true,_4,this.$23p(_1));this.moveSelectionToMarker(_1);delete this.fullHiliteTimer},isc.A.queueFullHilite=function(){if(this.fullHiliteTimer)isc.Timer.clearTimeout(this.fullHiliteTimer);this.fullHiliteTimer=this.delayCall("doFullSyntaxHilite",[],this.fullSyntaxHiliteDelay)},isc.A.selectionIsCollapsed=function(){if(isc.Browser.isIE){var _1=document.selection.createRange();return _1.text.length==0}else if(isc.Browser.isMoz){var _2=this.getContentWindow().getSelection();return _2.isCollapsed}},isc.A.rememberSelectionStartLine=function(){this.startLineNum=this.getLineNumber(this.getSelectionStartLine())},isc.A.getLastSelectionStartLine=function(){return this.startLineNum},isc.A.$23r=function(){this.$23l=this.delayCall("doLinesChanged",[],0)},isc.A.$23s=function(){if(!this.$23t)this.$23t=this.getID()+".rememberSelectionStartLine();event.returnValue=true";return this.$23t},isc.A.$23u=function(){if(!this.$23v)this.$23v=this.getID()+".$23r();event.returnValue=true"return this.$23v},isc.A.$23w=function(){if(!this.$23x){this.$23x="<span isLine='true'";if(this.syntaxHiliter&&!this.syntaxHiliter.autoWrap)this.$23x+=" style='white-space:nowrap'";if(isc.Browser.isIE){this.$23x+=" onbeforepaste='"+this.$23s()+"' onpaste='"+this.$23u()+"'"}this.$23x+=">$1</span>"}return this.$23x},isc.A.createLine=function(_1){var _2=this.getContentDocument();var _3=_2.createElement("span");_3.setAttribute("isLine","true");if(this.syntaxHiliter&&!this.syntaxHiliter.autoWrap)_3.setAttribute("style","white-space:nowrap");if(isc.Browser.isIE){_3.setAttribute("onbeforepaste",this.$23s());_3.setAttribute("onpaste",this.$23u())}_3.innerHTML=_1?_1:"<br>";return _3},isc.A.$23y=function(){if(!this.selectionIdSequence)this.selectionIdSequence=0;return this.getID()+"_selection_"+this.selectionIdSequence++},isc.A.getSelectionStartLine=function(){var _1=this.getContentDocument();var _2;if(isc.Browser.isIE){var _3=this.$23y();var _4=_1.selection.createRange();_4.collapse();_4.pasteHTML("<span id='"+_3+"'></span>");var _5=_1.getElementById(_3);_2=_5.parentNode;_2.removeChild(_5)}else if(isc.Browser.isMoz){var _6=this.getContentWindow().getSelection();var _2=_6.anchorNode}var _7=_2;while(_2.parentNode!=null){if(_2.getAttribute&&_2.getAttribute("isLine")!=null)_7=_2;_2=_2.parentNode}return _7},isc.A.$23p=function(_1){return"<span isSelectionSpan='true' id='"+_1+"'></span>"},isc.A.markCurrentSelection=function(){var _1=this.$23y();var _2=this.getContentDocument();if(isc.Browser.isIE){var _3=_2.selection.createRange();_3.collapse();_3.pasteHTML(this.$23p(_1))}else if(isc.Browser.isMoz){var _4=_2.createElement("span");_4.setAttribute('isSelectionSpan',"true");_4.setAttribute('id',_1);var _5=this.getContentWindow().getSelection();var _3=_5.getRangeAt(0);if(_5.isCollapsed){_3.insertNode(_4)}else{var _6=_3.cloneRange();_6.collapse(false);_6.insertNode(_4);_6.detach()}}return _1},isc.A.overwriteLines=function(_1,_2,_3){if(!isc.isAn.Array(_3))_3=[_3];var _4=this.getLine(_1);while(_1>=0&&(!_4||!_4.getAttribute||!_4.getAttribute("isLine"))){_4=this.getLine(_1);_1--}if(_1<0){this.getLineContainer().innerHTML=isc.emptyString;_4=this.createLine();this.getLineContainer().appendChild(_4);if(isc.Browser.isMoz)_1++}var _5=_4.parentNode;_4.innerHTML=_3[0];while(_2!=null&&_2-->0){var _6=this.getLine(_1+1);if(_6){_5.removeChild(_6)}}for(var i=1;i<_3.length;i++){if(_3[i]!=-1)this.addLineAfter(_1+i-1,_3[i])}},isc.A.addLineAfter=function(_1,_2){var _3=this.getLine(_1);var _4=this.getNextLine(_3);_2=this.createLine(_2);if(_4){_4.parentNode.insertBefore(_2,_4)}else{_3.parentNode.appendChild(_2)}},isc.A.escapeSelection=function(_1,_2){if(_2==null)_2=isc.emptyString;return _1.replace(/<span [^>]*isSelectionSpan[^>]*><\/span>/gi,_2)},isc.A.getSelectionMarkerIndex=function(_1){var _2=new RegExp("<span [^>]*isSelectionSpan[^>]*>","i");var _3=_2.exec(_1);if(_3)return _3.index;return-1},isc.A.getLineNumber=function(_1){var _2=_1.parentNode.childNodes;for(var i=0;i<_2.length;i++)if(_2[i]==_1)return i},isc.A.getPreviousLine=function(_1){return _1.previousSibling},isc.A.getNextLine=function(_1){return _1.nextSibling},isc.A.getLineContainer=function(){return isc.Browser.isIE?this.getHandle():this.getContentBody()},isc.A.getLine=function(_1){return this.getLineContainer().childNodes[_1]},isc.A.getLineHTML=function(_1){return _1.innerHTML},isc.A.getLineContents=function(_1){return this.removeMarkup(this.getLineHTML(_1))},isc.A.removeMarkup=function(_1,_2){if(_2){_1=_1.replace(/\n|\r|(<\/?(?!br|BR|([^>]*isSelectionSpan)).*?>)/gi,isc.emptyString)}else{_1=_1.replace(/\n|\r|(<\/?(?!br|BR).*?>)/gi,isc.emptyString)}_1=_1.unescapeHTML();if(isc.Browser.isOpera){var _3=new RegExp(String.fromCharCode(160),"g");_1=_1.replace(_3," ")}return _1},isc.A.moveSelectionToMarker=function(_1){var _2=this.getContentDocument();var _3=_2.getElementById(_1);if(isc.Browser.isIE){var _4=_2.selection.createRange();_4.moveToElementText(_3);_4.collapse();_4.select()}else if(isc.Browser.isMoz){var _5=this.getContentWindow().getSelection();_5.removeAllRanges();var _4=_2.createRange();_4.setStartBefore(_3);_4.setEndBefore(_3);_5.addRange(_4)}this.destroySelectionMarker(_1)},isc.A.destroySelectionMarker=function(_1){var _2=this.getContentDocument();var _3=_2.getElementById(_1);if(_3)_3.parentNode.removeChild(_3)},isc.A.setEditable=function(_1){if(_1==this.editable)return;this.editable=_1;this.$23i(_1)},isc.A.$23i=function(_1,_2){if(this.$22y()){var _3=this.getContentDocument();if(_3){if(_1||_2)_3.designMode="on";if(isc.Browser.isMoz)_3.execCommand("readonly",false,_1);if(!_1)_3.designMode="off"}}else{var _4=this.getHandle();if(_4!=null){_4.contentEditable=(_1?true:"inherit");if(isc.Browser.isIE){if(!this.isVisible()&&this.$224())this.$23z();else if(isc.Browser.version<6)this.$223()}}}},isc.A.parentVisibilityChanged=function(_1){if(!this.$22y()&&isc.Browser.isIE&&(_1==isc.Canvas.HIDDEN)&&this.$224()){this.$23z()}return this.Super("parentVisibilityChanged",arguments)},isc.A.$23z=function(){document.body.focus();var _1=isc.EH.getFocusCanvas();if(_1!=this&&_1!=null){_1.focus()}},isc.A.setHandleDisabled=function(_1){this.Super("setHandleDisabled",arguments);if(this.editable)this.$23i(_1?false:true)},isc.A.$229=function(){if(!this.isDrawn()||this.$220)return;var _1=this.$23q();if(_1!=null)this.contents=_1},isc.A.$23q=function(){var _1;if(this.$22y()){var _2=this.getContentBody();if(!_2)return;_1=_2.innerHTML}else{var _3=this.getHandle();if(_3)_1=_3.innerHTML}return _1},isc.A.getContents=function(_1){this.$229();if((this.syntaxHiliter||this.countLines)&&!_1){return this.removeMarkup(this.contents)}else{return this.contents}},isc.A.setContents=function(_1,_2,_3,_4){if(_1==this.contents&&!_2)return;this.contents=_1;if(!this.isDrawn()||this.$220)return;this.$23j(this.hiliteAndCount(_1,_3,_4))},isc.A.$23j=function(_1){this.contents=_1;if(!this.isDrawn())return;if(this.$22y()){var _2=this.getContentBody();if(!_2)return;_2.innerHTML=_1}else{var _3=this.getHandle();if(_3)_3.innerHTML=_1}this.adjustOverflow()},isc.A.hiliteAndCount=function(_1,_2,_3){if(this.syntaxHiliter){_1=this.syntaxHiliter.hilite(_1,false,_2,_3)}if(this.countLines){if(_1==isc.emptyString)_1="<BR>";_1=_1.replace(/((?:.*?<br>)|(?:.+$))/gi,this.$23w())}return _1},isc.A.appendContents=function(_1,_2,_3){_1=this.hiliteAndCount(_1,_2,_3);var _4=this.$22y()?this.getContentBody():this.getHandle();_4.innerHTML+=_1;this.adjustOverflow()},isc.A.$230=function(_1,_2){if(!this.isDrawn()||!this.editable)return;if(!isc.Page.isLoaded()){this.logWarn("Unsupported attempt to manipulate RichTextCanvas content style "+"before page load: postponed until the page has done loading.");isc.Page.setEvent("Load",this.getID()+".$230('"+_1+"','"+_2+"');");return}this.focus();var _3=this.$22y(),_4=_3?this.getContentDocument():document;if(!_4)return;if(!this.$231(_1))return false;try{_4.execCommand(_1,false,_2)}catch(e){return false}if(_3){var _5=this.getContentWindow();_5.focus()}else{this.$223()}this.$23o()},isc.A.$231=function(_1){try{var _2=this.$22y()?this.getContentDocument():document;if(!_2)return false;if(!_2.queryCommandEnabled(_1))return false}catch(e){return false}return true},isc.A.boldSelection=function(){this.$230("bold")},isc.A.italicSelection=function(){this.$230("italic")},isc.A.underlineSelection=function(){this.$230("underline")}

⌨️ 快捷键说明

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