mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 06:46:26 +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
66 lines
1.8 KiB
JavaScript
66 lines
1.8 KiB
JavaScript
/*!
|
|
* VisualEditor ContentEditable Annotation class.
|
|
*
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* Generic ContentEditable annotation.
|
|
*
|
|
* This is an abstract class, annotations should extend this and call this constructor from their
|
|
* constructor. You should not instantiate this class directly.
|
|
*
|
|
* Subclasses of ve.dm.Annotation should have a corresponding subclass here that controls rendering.
|
|
*
|
|
* @abstract
|
|
* @extends ve.ce.View
|
|
*
|
|
* @constructor
|
|
* @param {ve.dm.Annotation} model Model to observe
|
|
* @param {ve.ce.ContentBranchNode} [parentNode] Node rendering this annotation
|
|
* @param {Object} [config] Configuration options
|
|
*/
|
|
ve.ce.Annotation = function VeCeAnnotation( model, parentNode, config ) {
|
|
// Parent constructor
|
|
ve.ce.View.call( this, model, config );
|
|
|
|
// Properties
|
|
this.parentNode = parentNode || null;
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ce.Annotation, ve.ce.View );
|
|
|
|
/* Static Properties */
|
|
|
|
ve.ce.Annotation.static.tagName = 'span';
|
|
|
|
/**
|
|
* Whether this annotation's continuation (or lack thereof) needs to be forced.
|
|
*
|
|
* This should be set to true only for annotations that aren't continued by browsers but are in DM,
|
|
* or the other way around, or those where behavior is inconsistent between browsers.
|
|
*
|
|
* @property static.forceContinuation
|
|
* @static
|
|
* @inheritable
|
|
*/
|
|
ve.ce.Annotation.static.forceContinuation = false;
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* Get the content branch node this annotation is rendered in, if any.
|
|
* @returns {ve.ce.ContentBranchNode|null} Content branch node or null if none
|
|
*/
|
|
ve.ce.Annotation.prototype.getParentNode = function () {
|
|
return this.parentNode;
|
|
};
|
|
|
|
/** */
|
|
ve.ce.Annotation.prototype.getModelHtmlDocument = function () {
|
|
return this.parentNode && this.parentNode.getModelHtmlDocument();
|
|
};
|