Fixed link conversions to match parser

Change-Id: I67838a8c05729e4d32e6e2dfca53c7d457143ce3
This commit is contained in:
Trevor Parscal 2012-06-08 15:17:18 -07:00
parent 20d1c290d4
commit d61045085a

View file

@ -24,7 +24,8 @@ ve.dm.LinkAnnotation.converters = {
'toDomElement': function( subType, annotation ) { 'toDomElement': function( subType, annotation ) {
if ( annotation.type ) { if ( annotation.type ) {
var link = document.createElement( 'a' ); var link = document.createElement( 'a' );
link.setAttribute( 'data-type', 'link/' + subType ); link.setAttribute( 'data-type', subType );
link.setAttribute( 'href', annotation.data.href );
return link; return link;
} }
}, },
@ -32,7 +33,7 @@ ve.dm.LinkAnnotation.converters = {
// FIXME: the parser currently doesn't output this data this way // FIXME: the parser currently doesn't output this data this way
// Internal links get 'linkType': 'internal' in the data-mw-rt attrib, while external // Internal links get 'linkType': 'internal' in the data-mw-rt attrib, while external
// links currently get nothing // links currently get nothing
return { 'type': 'link/' + ( element.getAttribute( 'data-type' ) || 'unknown' ) }; return { 'type': 'link/' + ( element.getAttribute( 'data-type' ) || 'unknown' ), 'data': { 'href': element.getAttribute( 'href' ) } };
} }
}; };