@@ -116,11 +116,11 @@ var supportReferrals = [
116116 search : '[]()'
117117 } ,
118118 {
119- text : '![image text ][reference]' ,
119+ text : '![image alt ][reference]' ,
120120 search : '![][]'
121121 } ,
122122 {
123- text : '' ,
123+ text : '' ,
124124 search : '![]()'
125125 } ,
126126 {
@@ -2959,8 +2959,10 @@ function matchInContainer(text) {
29592959$ ( editor . getInputField ( ) )
29602960 . textcomplete ( [
29612961 { // emoji strategy
2962- match : / (?: ^ | \n | ) \B : ( [ \- + \w ] * ) $ / ,
2962+ match : / ( ^ | \n | \s ) \B : ( [ \- + \w ] * ) $ / ,
29632963 search : function ( term , callback ) {
2964+ var line = editor . getLine ( editor . getCursor ( ) . line ) ;
2965+ term = line . match ( this . match ) [ 2 ] ;
29642966 var list = [ ] ;
29652967 $ . map ( emojify . emojiNames , function ( emoji ) {
29662968 if ( emoji . indexOf ( term ) === 0 ) //match at first character
@@ -2976,7 +2978,7 @@ $(editor.getInputField())
29762978 return '<img class="emoji" src="' + serverurl + '/vendor/emojify/images/' + value + '.png"></img> ' + value ;
29772979 } ,
29782980 replace : function ( value ) {
2979- return ':' + value + ':' ;
2981+ return '$1 :' + value + ': ' ;
29802982 } ,
29812983 index : 1 ,
29822984 context : function ( text ) {
@@ -3033,9 +3035,8 @@ $(editor.getInputField())
30333035 match : / ( ^ | \n ) : : : ( \s * ) ( \w * ) $ / ,
30343036 search : function ( term , callback ) {
30353037 var line = editor . getLine ( editor . getCursor ( ) . line ) ;
3036- term = line . match ( this . match ) [ 3 ] ;
3038+ term = line . match ( this . match ) [ 3 ] . trim ( ) ;
30373039 var list = [ ] ;
3038- term = term . trim ( ) ;
30393040 $ . map ( this . containers , function ( container ) {
30403041 if ( container . indexOf ( term ) === 0 && container !== term )
30413042 list . push ( container ) ;
@@ -3079,13 +3080,17 @@ $(editor.getInputField())
30793080 }
30803081 } ,
30813082 { //extra tags for blockquote
3082- match : / (?: ^ | \n | \s ) ( \> .* ) ( \[ \] ) ( \w * ) $ / ,
3083+ match : / (?: ^ | \n | \s ) ( \> .* | ) ( ( \^ | ) \[ ( \^ | ) \] ( \[ \] | \( \) | \: | ) ) ( \w * ) $ / ,
30833084 search : function ( term , callback ) {
3085+ var line = editor . getLine ( editor . getCursor ( ) . line ) ;
3086+ quote = line . match ( this . match ) [ 1 ] . trim ( ) ;
30843087 var list = [ ] ;
3085- $ . map ( supportExtraTags , function ( extratag ) {
3086- if ( extratag . search . indexOf ( term ) === 0 )
3087- list . push ( extratag . command ( ) ) ;
3088- } ) ;
3088+ if ( quote . indexOf ( '>' ) == 0 ) {
3089+ $ . map ( supportExtraTags , function ( extratag ) {
3090+ if ( extratag . search . indexOf ( term ) === 0 )
3091+ list . push ( extratag . command ( ) ) ;
3092+ } ) ;
3093+ }
30893094 $ . map ( supportReferrals , function ( referral ) {
30903095 if ( referral . search . indexOf ( term ) === 0 )
30913096 list . push ( referral . text ) ;
@@ -3121,7 +3126,7 @@ $(editor.getInputField())
31213126 }
31223127 } ,
31233128 { //referral
3124- match : / ( ^ | \n | \s ) ( \! | \! | \[ \] ) ( \w * ) $ / ,
3129+ match : / ( ^ | \n | \s ) ( \! ( \[ \] | ) ( \[ \] | \( \) | ) ) ( \w * ) $ / ,
31253130 search : function ( term , callback ) {
31263131 callback ( $ . map ( supportReferrals , function ( referral ) {
31273132 return referral . search . indexOf ( term ) === 0 ? referral . text : null ;
0 commit comments