mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-01 17:36:35 +00:00
36061c7f5d
URLs are resolved according to the <base> URL from the Parsoid DOM. For instance, a link can have its href set to '../Foo' in the DM, and the target will show up as '../Foo' in the link inspector, but the CE rendering will be <a href="http://localhost/Foo"> (assuming Parsoid sent <base href="http://localhost/wiki/Bar">). Bug: 48915 Change-Id: I919135eb758c82361525078f276ca193dc4c4820
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
/*!
|
|
* VisualEditor ContentEditable MWExternalLinkAnnotation class.
|
|
*
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* ContentEditable MediaWiki external link annotation.
|
|
*
|
|
* @class
|
|
* @extends ve.ce.LinkAnnotation
|
|
* @constructor
|
|
* @param {ve.dm.MWExternalLinkAnnotation} model Model to observe
|
|
* @param {ve.ce.ContentBranchNode} [parentNode] Node rendering this annotation
|
|
* @param {Object} [config] Configuration options
|
|
*/
|
|
ve.ce.MWExternalLinkAnnotation = function VeCeMWExternalLinkAnnotation( model, parentNode, config ) {
|
|
// Parent constructor
|
|
ve.ce.LinkAnnotation.call( this, model, parentNode, config );
|
|
|
|
// DOM changes
|
|
this.$.addClass( 've-ce-mwExternalLinkAnnotation' );
|
|
// Put the href in the title
|
|
// Deliberately not using getResolvedAttribute() here
|
|
this.$.attr( 'title', model.getAttribute( 'href' ) );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ce.MWExternalLinkAnnotation, ve.ce.LinkAnnotation );
|
|
|
|
/* Static Properties */
|
|
|
|
ve.ce.MWExternalLinkAnnotation.static.name = 'link/mwExternal';
|
|
|
|
/* Registration */
|
|
|
|
ve.ce.annotationFactory.register( ve.ce.MWExternalLinkAnnotation );
|