📄 snippets.js
字号:
function Snippets( n ){ BiEventTarget.call( this ); this._name = n || "Snippet"; this._children = [];}_p = Snippets.prototype = new BiEventTarget;_p._className = "Snippets";_p.setUri = function ( uri ){ if ( this._xmlLoader ) { this._xmlLoader.abort(); this._xmlLoader.dispose(); } this._xmlLoader = new BiXmlLoader; this._xmlLoader.setUri( uri ); this._xmlLoader.setAsync( true ); this._uri = this._xmlLoader.getUri(); // type cast to BiUri this._xmlLoader.addEventListener( "load", this._onload, this ); this._xmlLoader.addEventListener( "error", this._onerror, this ); this._xmlLoader.load();};Snippets.addProperty( "uri", Function.READ );_p.getLoaded = function (){ if ( this._xmlLoader ) return this._xmlLoader.getLoaded(); return true;};_p._onload = function (e){ var p = new BiXmlResourceParser; p.processChildNodes( this, this._xmlLoader.getDocument().documentElement ); this.dispatchEvent( new BiEvent("load") ); this._xmlLoader.dispose(); delete this._xmlLoader;};_p._onerror = function (e){ this.dispatchEvent( new BiEvent("error") ); this._xmlLoader.dispose(); delete this._xmlLoader;};Snippets.addProperty( "name", Function.READ_WRITE );_p.add = function ( c ){ this._children.push( c );};Snippets.addProperty( "children", Function.READ );_p.addXmlNode = function ( n, p ){ if ( n.nodeType == 1 ) // ELEMENT { var c = p.fromNode( n ); if ( c instanceof Snippet || c instanceof Snippets ) this.add( c ); }};function Snippet( n, t ){ this._name = n; this._text = t || "";}_p = Snippet.prototype = new BiObject;_p._className = "Snippet";Snippet.addProperty( "name", Function.READ_WRITE );Snippet.addProperty( "text", Function.READ_WRITE );_p.addXmlNode = function ( n, p ){ this._text += n.text;};function SnippetMenu(){ BiMenu.call( this )}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -