Extends
Constructor
new ve.init.sa.Platform([messagePaths])
#
Hierarchy
Initialization Standalone platform.
Example
var platform = new ve.init.sa.Platform( ve.messagePaths );
platform.initialize().done( () => {
$( document.body ).append( $( '<p>' ).text(
platform.getMessage( 'visualeditor' )
) );
} );
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
messagePaths |
Array.<string> |
optional |
Message folder paths |
Properties
addMessages
#
Add multiple messages to the localization system.
- Overrides:
- Source:
addParsedMessages
#
Add multiple parsed messages to the localization system.
- Overrides:
- Source:
createSafeStorageabstract
#
Create a safe storage object
- Overrides:
- Source:
formatNumber
#
For a number as a string
- Overrides:
- Source:
getConfig
#
Get a platform config value
- Overrides:
- Source:
getExternalLinkUrlProtocolsRegExp
#
Get an anchored regular expression that matches allowed external link URLs starting at the beginning of an input string.
- Overrides:
- Source:
Get an anchored regular expression that matches allowed external link URLs starting at the beginning of an input string.
getHtmlMessage
#
Get an HTML message from the localization system, with HTML or DOM arguments
- Overrides:
- Source:
getLanguageAutonym
#
Get a language's autonym from its code.
- Overrides:
- Source:
getLanguageCodes
#
Get a list of all language codes.
- Overrides:
- Source:
getLanguageDirection
#
Get a language's direction from its code.
- Overrides:
- Source:
getLanguageName
#
Get a language's name from its code, in the current user language if possible.
- Overrides:
- Source:
getMediaSourcesabstract
#
Get a list of URL entry points where media can be found.
- Inherited from:
- Source:
getMessage
#
Get a message from the localization system.
- Overrides:
- Source:
getParsedMessage
#
Get a parsed message as HTML string.
Does not support $# replacements.
- Overrides:
- Source:
getUnanchoredExternalLinkUrlProtocolsRegExp
#
Get an unanchored regular expression that matches allowed external link URLs anywhere in an input string.
Get an unanchored regular expression that matches allowed external link URLs anywhere in an input string.
getUserConfig
#
Get a user config value
- Overrides:
- Source:
getUserLanguages
#
Get the user language and any fallback languages.
- Overrides:
- Source:
notify
#
Show a read-only notification to the user.
- Overrides:
- Source:
parseNumber
#
Parse a string into a number
- Overrides:
- Source:
setUserConfig
#
Set a user config value
- Overrides:
- Source:
Methods
createConflictableStorage(safeStorage) → {ve.init.ConflictableStorage}
#
Create a list storage object from a safe storage object
Parameters:
Name | Type | Description |
---|---|---|
safeStorage |
ve.init.SafeStorage |
- Inherited from:
- Source:
Returns:
decodeEntities(html) → {string}
#
Decode HTML entities for insertion into the document
Parameters:
Name | Type | Description |
---|---|---|
html |
string | HTML string |
- Inherited from:
- Source:
Returns:
- Type
- string
fetchSpecialCharList() → {jQuery.Promise}
#
Fetch the special character list object
Returns a promise which resolves with the character list
- Inherited from:
- Source:
Returns:
- Type
- jQuery.Promise
Fetch the special character list object
Returns a promise which resolves with the character list
generateUniqueId() → {string}
#
Generate a unique ID
- Inherited from:
- Source:
Returns:
- Type
- string
getInitializedPromise() → {jQuery.Promise}
#
Get a promise to track when the platform has initialized. The platform won't be ready for use until this promise is resolved.
Since the initialization only happens once, and the same (resolved) promise is returned when called again, and since the Platform instance is global (shared between different Target instances) it is important not to rely on this promise being asynchronous.
- Inherited from:
- Source:
Returns:
Promise that will be resolved once the platform is ready
- Type
- jQuery.Promise
getMessagePaths() → {Array.<string>}
#
getMetadataIdRegExp() → {RegExp|null
}
#
null
}
#
Get a regular expression that matches IDs used only for linking document data to metadata. Use null if your document format does not have such IDs.
- Inherited from:
- Source:
Returns:
Regular expression object
- Type
-
RegExp
|
null
Get a regular expression that matches IDs used only for linking document data to metadata.
getUserName() → {string|null
}
#
null
}
#
Get the current user's name, if the platform supports it
- Inherited from:
- Source:
Returns:
User name, or null if not applicable
- Type
-
string
|
null
hasLanguageCode(code) → {boolean}
#
Check if a language code is known to this platform.
Parameters:
Name | Type | Description |
---|---|---|
code |
string | Language code |
- Inherited from:
- Source:
Returns:
Language code is known
- Type
- boolean
initialize() → {jQuery.Promise}private
#
Initialize the platform. The default implementation is to do nothing and return a resolved promise. Subclasses should override this if they have asynchronous initialization work to do. The promise rejects if the platform is incompatible.
External callers should not call this. Instead, call #getInitializedPromise.
- Overrides:
- Source:
Returns:
Promise that will be resolved once initialization is done
- Type
- jQuery.Promise
processSpecialCharSymbols(symbols) → {Array.<Object>}
#
Post-process the symbol list.
If a keyed object format is used, it is coverted to an array, and the label property is set from the key when required.
For individual symbols, turns the source
property into a CSS class.
Parameters:
- Inherited from:
- Source: