2014-06-18 23:27:05 +02:00
ace . define ( "ace/ext/emmet" , [ "require" , "exports" , "module" , "ace/keyboard/hash_handler" , "ace/editor" , "ace/snippets" , "ace/range" , "ace/config" ] , function ( e , t , n ) { function a ( ) { } var r = e ( "ace/keyboard/hash_handler" ) . HashHandler , i = e ( "ace/editor" ) . Editor , s = e ( "ace/snippets" ) . snippetManager , o = e ( "ace/range" ) . Range , u ; i . prototype . indexToPosition = function ( e ) { return this . session . doc . indexToPosition ( e ) } , i . prototype . positionToIndex = function ( e ) { return this . session . doc . positionToIndex ( e ) } , a . prototype = { setupContext : function ( e ) { this . ace = e , this . indentation = e . session . getTabString ( ) , u || ( u = window . emmet ) , u . require ( "resources" ) . setVariable ( "indentation" , this . indentation ) , this . $syntax = null , this . $syntax = this . getSyntax ( ) } , getSelectionRange : function ( ) { var e = this . ace . getSelectionRange ( ) ; return { start : this . ace . positionToIndex ( e . start ) , end : this . ace . positionToIndex ( e . end ) } } , createSelection : function ( e , t ) { this . ace . selection . setRange ( { start : this . ace . indexToPosition ( e ) , end : this . ace . indexToPosition ( t ) } ) } , getCurrentLineRange : function ( ) { var e = this . ace . getCursorPosition ( ) . row , t = this . ace . session . getLine ( e ) . length , n = this . ace . positionToIndex ( { row : e , column : 0 } ) ; return { start : n , end : n + t } } , getCaretPos : function ( ) { var e = this . ace . getCursorPosition ( ) ; return this . ace . positionToIndex ( e ) } , setCaretPos : function ( e ) { var t = this . ace . indexToPosition ( e ) ; this . ace . selection . moveToPosition ( t ) } , getCurrentLine : function ( ) { var e = this . ace . getCursorPosition ( ) . row ; return this . ace . session . getLine ( e ) } , replaceContent : function ( e , t , n , r ) { n == null && ( n = t == null ? this . getContent ( ) . length : t ) , t == null && ( t = 0 ) ; var i = this . ace , u = o . fromPoints ( i . indexToPosition ( t ) , i . indexToPosition ( n ) ) ; i . session . remove ( u ) , u . end = u . start , e = this . $updateTabstops ( e ) , s . insertSnippet ( i , e ) } , getContent : function ( ) { return this . ace . getValue ( ) } , getSyntax : function ( ) { if ( this . $syntax ) return this . $syntax ; var e = this . ace . session . $modeId . split ( "/" ) . pop ( ) ; if ( e == "html" || e == "php" ) { var t = this . ace . getCursorPosition ( ) , n = this . ace . session . getState ( t . row ) ; typeof n != "string" && ( n = n [ 0 ] ) , n && ( n = n . split ( "-" ) , n . length > 1 ? e = n [ 0 ] : e == "php" && ( e = "html" ) ) } return e } , getProfileName : function ( ) { switch ( this . getSyntax ( ) ) { case "css" : return "css" ; case "xml" : case "xsl" : return "xml" ; case "html" : var e = u . require ( "resources" ) . getVariable ( "profile" ) ; return e || ( e = this . ace . session . getLines ( 0 , 2 ) . join ( "" ) . search ( /<!DOCTYPE[^>]+XHTML/i ) != - 1 ? "xhtml" : "html" ) , e } return "xhtml" } , prompt : function ( e ) { return prompt ( e ) } , getSelection : function ( ) { return this . ace . session . getTextRange ( ) } , getFilePath : function ( ) { return "" } , $updateTabstops : function ( e ) { var t = 1e3 , n = 0 , r = null , i = u . require ( "range" ) , s = u . require ( "tabStops" ) , o = u . require ( "resources" ) . getVocabulary ( "user" ) , a = { tabstop : function ( e ) { var o = parseInt ( e . group , 10 ) , u = o === 0 ; u ? o = ++ n : o += t ; var f = e . placeholder ; f && ( f = s . processText ( f , a ) ) ; var l = "${" + o + ( f ? ":" + f : "" ) + "}" ; return u && ( r = i . create ( e . start , l ) ) , l } , escape : function ( e ) { return e == "$" ? "\\$" : e == "\\" ? "\\\\" : e } } ; return e = s . processText ( e , a ) , o . variables . insert _final _tabstop && ! /\$\{0\}$/ . test ( e ) ? e += "${0}" : r && ( e = u . require ( "utils" ) . replaceSubstring ( e , "${0}" , r ) ) , e } } ; var f = { expand _abbreviation : { mac : "ctrl+alt+e" , win : "alt+e" } , match _pair _outward : { mac : "ctrl+d" , win : "ctrl+," } , match _pair _inward : { mac : "ctrl+j" , win : "ctrl+shift+0" } , matching _pair : { mac : "ctrl+alt+j" , win : "alt+j" } , next _edit _point : "alt+right" , prev _edit _point : "alt+left" , toggle _comment : { mac : "command+/" , win : "ctrl+/" } , split _join _tag : { mac : "shift+command+'" , win : "shift+ctrl+`" } , remove _tag : { mac : "command+'" , win : "shift+ctrl+;" } , evaluate _math _expression : { mac : "shift+command+y" , win : "shift+ctrl+y" } , increment _number _by _1 : "ctrl+up" , decrement _number _by _1 : "ctrl+down" , increment _number _by _01 : "alt+up" , decrement _number _by _01 : "alt+down" , increment _number _by _10 : { mac : "alt+command+up" , win : "shift+alt+up" } , decrement _number _by _10 : { mac : "alt+command+down" , win : "shift+alt+down" } , select _next _item : { mac : "shift+command+." , win : "shift+ctrl+." } , select _previous _item : { mac : "shift+command+," , win : "shift+ctrl+," } , reflect _css _value : { mac : "shift+command+r" , win : "shift+ctrl+r" } , encode _decode _data _url : { mac : "shift+ctrl+d" , win : "ctrl+'" } , expand _abbreviation _with _tab : "Tab" , wrap _with _abbreviation : { mac : "shift+ctrl+a" , win : "shift+ctrl+a" } } , l = new a ; t . com