mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-19 09:41:09 +00:00
b518e55ef9
This is not great, but it's a start (and unblocks other pull-throughs). New changes: c401efc98 build: Replace jsduck with jsdoc for documentation 16ba162a0 JSDoc: @mixins -> @mixes 9e0a1f53b JSDoc: Fix complex return types 449b6cc0f Prefer arrow function callbacks 1539af2c8 Remove 'this' bindings in arrow functions b760f3b14 Use arrow functions in OO.ui.Process steps 57c24109e Use arrow functions in jQuery callbacks 9622ccef9 Convert some remaining functions callbacks to arrow functions f6c885021 Remove useless local variable 1cd800020 Clear branch node cache when rebuilding tree Bug: T250843 Bug: T363329 Change-Id: I0f4878ca84b95e3f388b358b943f105637e455f9
65 lines
1.5 KiB
JavaScript
65 lines
1.5 KiB
JavaScript
/*!
|
|
* VisualEditor DataModel MWTransclusionContentModel class.
|
|
*
|
|
* @copyright See AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* Represents a raw wikitext snippet that is part of an unbalanced sequence of template invocations.
|
|
* Meant to be an item in a {@see ve.dm.MWTransclusionModel}. Holds a back-reference to it's parent.
|
|
*
|
|
* @class
|
|
* @extends ve.dm.MWTransclusionPartModel
|
|
*
|
|
* @constructor
|
|
* @param {ve.dm.MWTransclusionModel} transclusion
|
|
* @param {string} [wikitext='']
|
|
*/
|
|
ve.dm.MWTransclusionContentModel = function VeDmMWTransclusionContentModel( transclusion, wikitext ) {
|
|
// Parent constructor
|
|
ve.dm.MWTransclusionContentModel.super.call( this, transclusion );
|
|
|
|
// Properties
|
|
this.wikitext = wikitext || '';
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.dm.MWTransclusionContentModel, ve.dm.MWTransclusionPartModel );
|
|
|
|
/* Events */
|
|
|
|
/**
|
|
* Emitted when the wikitext changed.
|
|
*
|
|
* @event ve.dm.MWTransclusionContentModel#change
|
|
*/
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* @param {string} wikitext
|
|
* @fires change
|
|
*/
|
|
ve.dm.MWTransclusionContentModel.prototype.setWikitext = function ( wikitext ) {
|
|
if ( this.wikitext !== wikitext ) {
|
|
this.wikitext = wikitext;
|
|
this.emit( 'change' );
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
ve.dm.MWTransclusionContentModel.prototype.serialize = function () {
|
|
return this.wikitext;
|
|
};
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
ve.dm.MWTransclusionContentModel.prototype.containsValuableData = function () {
|
|
return this.wikitext !== '';
|
|
};
|