mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
53e9258280
This should make it much simpler to keep MediaWiki specifics out of VisualEditor, which will in turn make it easier to integrate VisualEditor into another platform. Change-Id: I073e9737b37c28af889f2457d10b082cefd0d63b
72 lines
1.7 KiB
JavaScript
72 lines
1.7 KiB
JavaScript
/**
|
|
* VisualEditor initialization Target class.
|
|
*
|
|
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* Generic platform.
|
|
*
|
|
* @class
|
|
* @abstract
|
|
* @constructor
|
|
* @param {String} pageName Name of target page
|
|
*/
|
|
ve.init.Platform = function() {
|
|
// Inheritance
|
|
ve.EventEmitter.call( this );
|
|
};
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* Gets a regular expression that matches allowed external link URLs.
|
|
*
|
|
* @method
|
|
* @abstract
|
|
* @returns {RegExp} Regular expression object
|
|
*/
|
|
ve.init.Platform.prototype.getExternalLinkUrlProtocolsRegExp = function() {
|
|
throw 've.init.Platform.getExternalLinkUrlProtocolsRegExp must be overridden in subclass';
|
|
};
|
|
|
|
/**
|
|
* Gets a remotely accessible URL to the modules directory.
|
|
*
|
|
* @method
|
|
* @abstract
|
|
* @returns {String} Remote modules URL
|
|
*/
|
|
ve.init.Platform.prototype.getModulesUrl = function() {
|
|
throw 've.init.Platform.getModulesUrl must be overridden in subclass';
|
|
};
|
|
|
|
/**
|
|
* Adds multiple messages to the localization system.
|
|
*
|
|
* @method
|
|
* @abstract
|
|
* @param {Object} messages Map of message-key/message-string pairs
|
|
*/
|
|
ve.init.Platform.prototype.addMessages = function( messages ) {
|
|
throw 've.init.Platform.addMessages must be overridden in subclass';
|
|
};
|
|
|
|
/**
|
|
* Gets a message from the localization system.
|
|
*
|
|
* @method
|
|
* @abstract
|
|
* @param {String} key Message key
|
|
* @param {Mixed} [...] List of arguments which will be injected at $1, $2, etc. in the messaage
|
|
* @returns {String} Localized message
|
|
*/
|
|
ve.init.Platform.prototype.getMessage = function( key ) {
|
|
throw 've.init.Platform.getMessage must be overridden in subclass';
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
ve.extendClass( ve.init.Platform, ve.EventEmitter );
|