@@ -89,6 +89,9 @@ var DeltaInsertOp = (function () {
8989 DeltaInsertOp . prototype . isLink = function ( ) {
9090 return this . isText ( ) && ! ! this . attributes . link ;
9191 } ;
92+ DeltaInsertOp . prototype . isAnchorLink = function ( ) {
93+ return this . isLink ( ) && this . attributes . link . indexOf ( '#' ) === 0 ;
94+ } ;
9295 DeltaInsertOp . prototype . isCustom = function ( ) {
9396 return this . insert instanceof InsertData_1 . InsertDataCustom ;
9497 } ;
@@ -402,7 +405,7 @@ var OpToHtmlConverter = (function () {
402405 . map ( function ( item ) { return arr . preferSecond ( item ) + ':' + attrs [ item [ 0 ] ] ; } ) ;
403406 } ;
404407 OpToHtmlConverter . prototype . getTagAttributes = function ( ) {
405- if ( this . op . attributes . code ) {
408+ if ( this . op . attributes . code && ! this . op . isLink ( ) ) {
406409 return [ ] ;
407410 }
408411 var makeAttr = function ( k , v ) { return ( { key : k , value : v } ) ; } ;
@@ -441,10 +444,12 @@ var OpToHtmlConverter = (function () {
441444 var styleAttr = styles . length ? [ makeAttr ( 'style' , styles . join ( ';' ) ) ] : [ ] ;
442445 tagAttrs = tagAttrs . concat ( styleAttr ) ;
443446 if ( this . op . isLink ( ) ) {
444- var target = this . op . attributes . target || this . options . linkTarget ;
445447 tagAttrs = tagAttrs
446- . concat ( makeAttr ( 'href' , funcs_html_1 . encodeLink ( this . op . attributes . link ) ) )
447- . concat ( target ? makeAttr ( 'target' , target ) : [ ] ) ;
448+ . concat ( makeAttr ( 'href' , funcs_html_1 . encodeLink ( this . op . attributes . link ) ) ) ;
449+ if ( ! this . op . isAnchorLink ( ) ) {
450+ var target = this . op . attributes . target || this . options . linkTarget ;
451+ tagAttrs = tagAttrs . concat ( target ? makeAttr ( 'target' , target ) : [ ] ) ;
452+ }
448453 if ( ! ! this . options . linkRel && OpToHtmlConverter . IsValidRel ( this . options . linkRel ) ) {
449454 tagAttrs . push ( makeAttr ( 'rel' , this . options . linkRel ) ) ;
450455 }
@@ -453,9 +458,6 @@ var OpToHtmlConverter = (function () {
453458 } ;
454459 OpToHtmlConverter . prototype . getTags = function ( ) {
455460 var attrs = this . op . attributes ;
456- if ( attrs . code ) {
457- return [ 'code' ] ;
458- }
459461 if ( ! this . op . isText ( ) ) {
460462 return [ this . op . isVideo ( ) ? 'iframe'
461463 : this . op . isImage ( ) ? 'img'
@@ -474,9 +476,9 @@ var OpToHtmlConverter = (function () {
474476 return firstItem === 'header' ? [ 'h' + attrs [ firstItem ] ] : [ arr . preferSecond ( item ) ] ;
475477 }
476478 }
477- return [ [ 'link' , 'a' ] , [ 'script' ] ,
479+ return [ [ 'link' , 'a' ] , [ 'mentions' , 'a' ] , [ ' script'] ,
478480 [ 'bold' , 'strong' ] , [ 'italic' , 'em' ] , [ 'strike' , 's' ] , [ 'underline' , 'u' ] ,
479- [ 'mentions' , 'a '] ]
481+ [ 'code ' ] ]
480482 . filter ( function ( item ) { return ! ! attrs [ item [ 0 ] ] ; } )
481483 . map ( function ( item ) {
482484 return item [ 0 ] === 'script' ?
0 commit comments