2012-05-25 19:50:48 +00:00
|
|
|
<?php
|
2012-07-19 00:11:26 +00:00
|
|
|
/**
|
|
|
|
* VisualEditor extension hooks
|
2012-07-19 21:25:16 +00:00
|
|
|
*
|
2012-07-19 00:11:26 +00:00
|
|
|
* @file
|
|
|
|
* @ingroup Extensions
|
2014-01-05 12:05:05 +00:00
|
|
|
* @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
|
2012-07-19 00:11:26 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
2012-05-25 19:50:48 +00:00
|
|
|
|
|
|
|
class VisualEditorHooks {
|
2013-06-11 22:14:44 +00:00
|
|
|
public static function onSetup() {
|
2013-08-02 23:40:52 +00:00
|
|
|
global $wgResourceModules, $wgVisualEditorResourceTemplate,
|
|
|
|
$wgVisualEditorTabMessages;
|
2013-06-11 22:14:44 +00:00
|
|
|
|
2013-07-31 01:20:37 +00:00
|
|
|
// This prevents VisualEditor from being run in environments that don't
|
|
|
|
// have the dependent code in core; this should be updated as a part of
|
|
|
|
// when additional dependencies are created and pushed into MediaWiki's
|
|
|
|
// core. The most direct effect of this is to avoid confusing any third
|
|
|
|
// parties who attempt to install VisualEditor onto non-alpha wikis, as
|
|
|
|
// this should have no impact on deploying to Wikimedia's wiki cluster.
|
|
|
|
// Is fine for release tarballs because 1.22wmf11 < 1.22alpha < 1.22.0.
|
2014-02-05 16:46:11 +00:00
|
|
|
wfUseMW( '1.22' );
|
2013-07-31 01:20:37 +00:00
|
|
|
|
2013-08-01 19:14:41 +00:00
|
|
|
// Add tab messages to the init init module
|
|
|
|
foreach ( $wgVisualEditorTabMessages as $msg ) {
|
|
|
|
if ( $msg !== null ) {
|
|
|
|
$wgResourceModules['ext.visualEditor.viewPageTarget.init']['messages'][] = $msg;
|
|
|
|
}
|
|
|
|
}
|
2013-06-11 22:14:44 +00:00
|
|
|
}
|
|
|
|
|
2012-05-25 19:50:48 +00:00
|
|
|
/**
|
2013-08-01 19:14:41 +00:00
|
|
|
* Adds VisualEditor JS to the output.
|
2012-06-11 06:54:41 +00:00
|
|
|
*
|
|
|
|
* This is attached to the MediaWiki 'BeforePageDisplay' hook.
|
2012-05-25 19:50:48 +00:00
|
|
|
*
|
|
|
|
* @param $output OutputPage
|
|
|
|
* @param $skin Skin
|
|
|
|
*/
|
2012-06-11 06:54:41 +00:00
|
|
|
public static function onBeforePageDisplay( &$output, &$skin ) {
|
2013-07-19 02:44:22 +00:00
|
|
|
$output->addModules( array( 'ext.visualEditor.viewPageTarget.init' ) );
|
2013-08-01 19:14:41 +00:00
|
|
|
$output->addModuleStyles( array( 'ext.visualEditor.viewPageTarget.noscript' ) );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Changes the Edit tab and adds the VisualEditor tab.
|
|
|
|
*
|
|
|
|
* This is attached to the MediaWiki 'SkinTemplateNavigation' hook.
|
|
|
|
*
|
|
|
|
* @param SkinTemplate $skin
|
|
|
|
* @param array $links Navigation links
|
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public static function onSkinTemplateNavigation( &$skin, &$links ) {
|
|
|
|
// Only do this if the user has VE enabled
|
|
|
|
if (
|
|
|
|
!$skin->getUser()->getOption( 'visualeditor-enable' ) ||
|
|
|
|
$skin->getUser()->getOption( 'visualeditor-betatempdisable' )
|
|
|
|
) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
global $wgVisualEditorTabMessages, $wgVisualEditorTabPosition;
|
|
|
|
if ( !isset( $links['views']['edit'] ) ) {
|
|
|
|
// There's no edit link, nothing to do
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
$title = $skin->getRelevantTitle();
|
|
|
|
// Rebuild the $links['views'] array and inject the VisualEditor tab before or after
|
|
|
|
// the edit tab as appropriate. We have to rebuild the array because PHP doesn't allow
|
|
|
|
// us to splice into the middle of an associative array.
|
|
|
|
$newViews = array();
|
|
|
|
foreach ( $links['views'] as $action => $data ) {
|
|
|
|
if ( $action === 'edit' ) {
|
|
|
|
// Build the VisualEditor tab
|
|
|
|
$existing = $title->exists() || (
|
|
|
|
$title->getNamespace() == NS_MEDIAWIKI &&
|
|
|
|
$title->getDefaultMessageText() !== false
|
|
|
|
);
|
|
|
|
$veParams = $skin->editUrlOptions();
|
|
|
|
unset( $veParams['action'] ); // Remove action=edit
|
|
|
|
$veParams['veaction'] = 'edit'; // Set veaction=edit
|
|
|
|
$veTabMessage = $wgVisualEditorTabMessages[$existing ? 'edit' : 'create'];
|
|
|
|
$veTabText = $veTabMessage === null ? $data['text'] :
|
|
|
|
wfMessage( $veTabMessage )->setContext( $skin->getContext() )->text();
|
|
|
|
$veTab = array(
|
|
|
|
'href' => $title->getLocalURL( $veParams ),
|
|
|
|
'text' => $veTabText,
|
|
|
|
'primary' => true,
|
|
|
|
'class' => '',
|
|
|
|
);
|
|
|
|
|
|
|
|
// Alter the edit tab
|
|
|
|
$editTab = $data;
|
|
|
|
$editTabMessage = $wgVisualEditorTabMessages[$existing ? 'editsource' : 'createsource'];
|
|
|
|
if ( $editTabMessage !== null ) {
|
|
|
|
$editTab['text'] = wfMessage( $editTabMessage )->setContext( $skin->getContext() )->text();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Inject the VE tab before or after the edit tab
|
|
|
|
if ( $wgVisualEditorTabPosition === 'before' ) {
|
|
|
|
$newViews['ve-edit'] = $veTab;
|
|
|
|
$newViews['edit'] = $editTab;
|
|
|
|
} else {
|
|
|
|
$newViews['edit'] = $editTab;
|
|
|
|
$newViews['ve-edit'] = $veTab;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Just pass through
|
|
|
|
$newViews[$action] = $data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$links['views'] = $newViews;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Changes the section edit links to add a VE edit link.
|
|
|
|
*
|
|
|
|
* This is attached to the MediaWiki 'DoEditSectionLink' hook.
|
|
|
|
*
|
|
|
|
* @param $skin Skin
|
|
|
|
* @param $title Title
|
|
|
|
* @param $section string
|
|
|
|
* @param $tooltip string
|
|
|
|
* @param $result string HTML
|
|
|
|
* @param $lang Language
|
|
|
|
* @returns bool true
|
|
|
|
*/
|
|
|
|
public static function onDoEditSectionLink( $skin, $title, $section, $tooltip, &$result, $lang ) {
|
|
|
|
// Only do this if the user has VE enabled
|
2013-09-16 21:12:50 +00:00
|
|
|
// (and we're not in parserTests)
|
2013-08-01 19:14:41 +00:00
|
|
|
if (
|
2013-09-16 21:12:50 +00:00
|
|
|
isset( $GLOBALS[ 'wgVisualEditorInParserTests' ] ) ||
|
2013-08-01 19:14:41 +00:00
|
|
|
!$skin->getUser()->getOption( 'visualeditor-enable' ) ||
|
|
|
|
$skin->getUser()->getOption( 'visualeditor-betatempdisable' )
|
|
|
|
) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
global $wgVisualEditorTabMessages, $wgVisualEditorTabPosition;
|
|
|
|
$veEditSection = $wgVisualEditorTabMessages['editsection'] !== null ?
|
|
|
|
$wgVisualEditorTabMessages['editsection'] : 'editsection';
|
|
|
|
$sourceEditSection = $wgVisualEditorTabMessages['editsectionsource'] !== null ?
|
|
|
|
$wgVisualEditorTabMessages['editsectionsource'] : 'editsection';
|
|
|
|
|
|
|
|
// Code mostly duplicated from Skin::doEditSectionLink() :(
|
|
|
|
$attribs = array();
|
|
|
|
if ( !is_null( $tooltip ) ) {
|
|
|
|
# Bug 25462: undo double-escaping.
|
|
|
|
$tooltip = Sanitizer::decodeCharReferences( $tooltip );
|
|
|
|
$attribs['title'] = wfMessage( 'editsectionhint' )->rawParams( $tooltip )
|
|
|
|
->inLanguage( $lang )->text();
|
|
|
|
}
|
|
|
|
$veLink = Linker::link( $title, wfMessage( $veEditSection )->inLanguage( $lang )->text(),
|
|
|
|
$attribs + array( 'class' => 'mw-editsection-visualeditor' ),
|
|
|
|
array( 'veaction' => 'edit', 'section' => $section ),
|
|
|
|
array( 'noclasses', 'known' )
|
|
|
|
);
|
|
|
|
$sourceLink = Linker::link( $title, wfMessage( $sourceEditSection )->inLanguage( $lang )->text(),
|
|
|
|
$attribs,
|
|
|
|
array( 'action' => 'edit', 'section' => $section ),
|
|
|
|
array( 'noclasses', 'known' )
|
|
|
|
);
|
|
|
|
|
|
|
|
$veFirst = $wgVisualEditorTabPosition === 'before';
|
|
|
|
$result = '<span class="mw-editsection">'
|
|
|
|
. '<span class="mw-editsection-bracket">[</span>'
|
|
|
|
. ( $veFirst ? $veLink : $sourceLink )
|
|
|
|
. '<span class="mw-editsection-divider">'
|
|
|
|
. wfMessage( 'pipe-separator' )->inLanguage( $lang )->text()
|
|
|
|
. '</span>'
|
|
|
|
. ( $veFirst ? $sourceLink : $veLink )
|
|
|
|
. '<span class="mw-editsection-bracket">]</span>'
|
|
|
|
. '</span>';
|
2013-06-26 17:23:56 +00:00
|
|
|
|
2012-05-25 19:50:48 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-11-05 20:46:14 +00:00
|
|
|
public static function onGetPreferences( $user, &$preferences ) {
|
2013-09-30 16:18:46 +00:00
|
|
|
if ( !array_key_exists( 'visualeditor-enable', $preferences ) ) {
|
|
|
|
$preferences['visualeditor-enable'] = array(
|
|
|
|
'type' => 'toggle',
|
|
|
|
'label-message' => 'visualeditor-preference-enable',
|
|
|
|
'section' => 'editing/beta'
|
|
|
|
);
|
|
|
|
}
|
2013-07-24 01:11:56 +00:00
|
|
|
$preferences['visualeditor-betatempdisable'] = array(
|
|
|
|
'type' => 'toggle',
|
|
|
|
'label-message' => 'visualeditor-preference-betatempdisable',
|
|
|
|
'section' => 'editing/beta'
|
|
|
|
);
|
2012-11-05 20:46:14 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-08-12 05:50:04 +00:00
|
|
|
public static function onGetBetaPreferences( $user, &$preferences ) {
|
2013-10-10 12:33:49 +00:00
|
|
|
global $wgExtensionAssetsPath, $wgVisualEditorSupportedSkins, $wgVisualEditorBrowserBlacklist;
|
2013-08-12 05:50:04 +00:00
|
|
|
|
2013-11-08 16:33:53 +00:00
|
|
|
$dir = RequestContext::getMain()->getLanguage()->getDir();
|
|
|
|
|
2013-09-30 16:18:46 +00:00
|
|
|
$preferences['visualeditor-enable'] = array(
|
|
|
|
'version' => '1.0',
|
|
|
|
'label-message' => 'visualeditor-preference-core-label',
|
|
|
|
'desc-message' => 'visualeditor-preference-core-description',
|
2013-10-21 23:06:10 +00:00
|
|
|
'screenshot' => $wgExtensionAssetsPath .
|
2013-11-08 16:33:53 +00:00
|
|
|
"/VisualEditor/betafeatures-icon-VisualEditor-$dir.svg",
|
2013-10-30 20:57:05 +00:00
|
|
|
'info-message' => 'visualeditor-preference-core-info-link',
|
|
|
|
'discussion-message' => 'visualeditor-preference-core-discussion-link',
|
2013-10-10 12:33:49 +00:00
|
|
|
'requirements' => array(
|
|
|
|
'javascript' => true,
|
|
|
|
'blacklist' => $wgVisualEditorBrowserBlacklist,
|
|
|
|
'skins' => $wgVisualEditorSupportedSkins,
|
|
|
|
)
|
2013-09-30 16:18:46 +00:00
|
|
|
);
|
|
|
|
|
2013-10-21 23:06:10 +00:00
|
|
|
/* Disabling Beta Features option for language for now
|
|
|
|
$preferences['visualeditor-enable-language'] = array(
|
2013-08-12 05:50:04 +00:00
|
|
|
'version' => '1.0',
|
2013-10-21 23:06:10 +00:00
|
|
|
'label-message' => 'visualeditor-preference-language-label',
|
|
|
|
'desc-message' => 'visualeditor-preference-language-description',
|
|
|
|
'screenshot' => $wgExtensionAssetsPath .
|
2013-11-08 16:33:53 +00:00
|
|
|
"/VisualEditor/betafeatures-icon-VisualEditor-language-$dir.svg",
|
2013-10-30 20:57:05 +00:00
|
|
|
'info-message' => 'visualeditor-preference-experimental-info-link',
|
|
|
|
'discussion-message' => 'visualeditor-preference-experimental-discussion-link',
|
2013-10-10 12:33:49 +00:00
|
|
|
'requirements' => array(
|
|
|
|
'betafeatures' => array(
|
|
|
|
'visualeditor-enable',
|
|
|
|
),
|
|
|
|
),
|
2013-08-12 05:50:04 +00:00
|
|
|
);
|
2013-10-21 23:06:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Disabling Beta Features option for generic content for now
|
|
|
|
$preferences['visualeditor-enable-mwalienextension'] = array(
|
|
|
|
'version' => '1.0',
|
|
|
|
'label-message' => 'visualeditor-preference-mwalienextension-label',
|
|
|
|
'desc-message' => 'visualeditor-preference-mwalienextension-description',
|
|
|
|
'screenshot' => $wgExtensionAssetsPath .
|
2013-11-08 16:33:53 +00:00
|
|
|
"/VisualEditor/betafeatures-icon-VisualEditor-alien-$dir.svg",
|
2013-10-30 20:57:05 +00:00
|
|
|
'info-message' => 'visualeditor-preference-mwalienextension-info-link',
|
|
|
|
'discussion-message' => 'visualeditor-preference-mwalienextension-discussion-link',
|
2013-10-21 23:06:10 +00:00
|
|
|
'requirements' => array(
|
|
|
|
'betafeatures' => array(
|
|
|
|
'visualeditor-enable',
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
*/
|
|
|
|
|
|
|
|
$preferences['visualeditor-enable-mwmath'] = array(
|
|
|
|
'version' => '1.0',
|
|
|
|
'label-message' => 'visualeditor-preference-mwmath-label',
|
|
|
|
'desc-message' => 'visualeditor-preference-mwmath-description',
|
|
|
|
'screenshot' => $wgExtensionAssetsPath .
|
2013-11-08 16:33:53 +00:00
|
|
|
"/VisualEditor/betafeatures-icon-VisualEditor-formulae-$dir.svg",
|
2013-10-30 20:57:05 +00:00
|
|
|
'info-message' => 'visualeditor-preference-mwmath-info-link',
|
|
|
|
'discussion-message' => 'visualeditor-preference-mwmath-discussion-link',
|
2013-10-21 23:06:10 +00:00
|
|
|
'requirements' => array(
|
|
|
|
'betafeatures' => array(
|
|
|
|
'visualeditor-enable',
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
/* Disabling Beta Features option for hieroglyphics for now
|
|
|
|
$preferences['visualeditor-enable-mwhiero'] = array(
|
|
|
|
'version' => '1.0',
|
|
|
|
'label-message' => 'visualeditor-preference-mwhiero-label',
|
|
|
|
'desc-message' => 'visualeditor-preference-mwhiero-description',
|
|
|
|
'screenshot' => $wgExtensionAssetsPath .
|
2013-11-08 16:33:53 +00:00
|
|
|
"/VisualEditor/betafeatures-icon-VisualEditor-hieroglyphics-$dir.svg",
|
2013-10-30 20:57:05 +00:00
|
|
|
'info-message' => 'visualeditor-preference-mwhiero-info-link',
|
|
|
|
'discussion-message' => 'visualeditor-preference-mwhiero-discussion-link',
|
2013-10-21 23:06:10 +00:00
|
|
|
'requirements' => array(
|
|
|
|
'betafeatures' => array(
|
|
|
|
'visualeditor-enable',
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Disabling Beta Features option for syntax highlighting for now
|
|
|
|
$preferences['visualeditor-enable-mwsyntaxHighlight'] = array(
|
|
|
|
'version' => '1.0',
|
|
|
|
'label-message' => 'visualeditor-preference-mwsyntaxHighlight-label',
|
|
|
|
'desc-message' => 'visualeditor-preference-mwsyntaxHighlight-description',
|
|
|
|
'screenshot' => $wgExtensionAssetsPath .
|
2013-11-08 16:33:53 +00:00
|
|
|
"/VisualEditor/betafeatures-icon-VisualEditor-syntaxHighlight-$dir.svg",
|
2013-10-30 20:57:05 +00:00
|
|
|
'info-message' => 'visualeditor-preference-mwsyntaxHighlight-info-link',
|
|
|
|
'discussion-message' => 'visualeditor-preference-mwsyntaxHighlight-discussion-link',
|
2013-10-21 23:06:10 +00:00
|
|
|
'requirements' => array(
|
|
|
|
'betafeatures' => array(
|
|
|
|
'visualeditor-enable',
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
*/
|
2013-08-12 05:50:04 +00:00
|
|
|
}
|
|
|
|
|
2012-11-22 02:26:29 +00:00
|
|
|
public static function onListDefinedTags( &$tags ) {
|
|
|
|
$tags[] = 'visualeditor';
|
2013-06-23 23:09:47 +00:00
|
|
|
$tags[] = 'visualeditor-needcheck';
|
2012-11-22 02:26:29 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-05-25 19:50:48 +00:00
|
|
|
/**
|
2012-06-11 06:54:41 +00:00
|
|
|
* Adds extra variables to the page config.
|
2012-05-25 19:50:48 +00:00
|
|
|
*/
|
2012-12-06 05:57:53 +00:00
|
|
|
public static function onMakeGlobalVariablesScript( array &$vars, OutputPage $out ) {
|
2014-01-26 22:59:30 +00:00
|
|
|
global $wgStylePath, $wgSVGMaxSize;
|
2013-11-08 16:19:15 +00:00
|
|
|
|
|
|
|
$pageLanguage = $out->getTitle()->getPageLanguage();
|
|
|
|
|
2012-06-11 06:54:41 +00:00
|
|
|
$vars['wgVisualEditor'] = array(
|
2012-12-12 23:35:33 +00:00
|
|
|
'isPageWatched' => $out->getUser()->isWatched( $out->getTitle() ),
|
2013-05-30 11:00:36 +00:00
|
|
|
// Same as in Linker.php
|
|
|
|
'magnifyClipIconURL' => $wgStylePath .
|
|
|
|
'/common/images/magnify-clip' .
|
2013-11-08 16:19:15 +00:00
|
|
|
( $pageLanguage->isRTL() ? '-rtl' : '' ) . '.png',
|
|
|
|
'pageLanguageCode' => $pageLanguage->getHtmlCode(),
|
2014-01-26 22:59:30 +00:00
|
|
|
'pageLanguageDir' => $pageLanguage->getDir(),
|
|
|
|
'svgMaxSize' => $wgSVGMaxSize,
|
2013-04-17 16:48:09 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds extra variables to the global config
|
|
|
|
*/
|
|
|
|
public static function onResourceLoaderGetConfigVars( array &$vars ) {
|
2013-07-26 20:20:10 +00:00
|
|
|
global $wgDefaultUserOptions,
|
|
|
|
$wgVisualEditorDisableForAnons,
|
2013-07-31 00:31:12 +00:00
|
|
|
$wgVisualEditorEnableExperimentalCode,
|
|
|
|
$wgVisualEditorNamespaces,
|
|
|
|
$wgVisualEditorPluginModules,
|
2013-08-01 19:14:41 +00:00
|
|
|
$wgVisualEditorTabPosition,
|
2013-08-01 20:18:33 +00:00
|
|
|
$wgVisualEditorTabMessages,
|
2013-10-10 12:33:49 +00:00
|
|
|
$wgVisualEditorBrowserBlacklist,
|
2013-10-07 22:55:22 +00:00
|
|
|
$wgVisualEditorSupportedSkins,
|
2014-01-06 08:43:37 +00:00
|
|
|
$wgVisualEditorShowBetaWelcome,
|
|
|
|
$wgVisualEditorPreferenceModules;
|
2013-06-03 22:23:45 +00:00
|
|
|
|
2013-04-17 16:48:09 +00:00
|
|
|
$vars['wgVisualEditorConfig'] = array(
|
2013-07-19 02:44:22 +00:00
|
|
|
'disableForAnons' => $wgVisualEditorDisableForAnons,
|
2014-01-06 08:43:37 +00:00
|
|
|
'preferenceModules' => $wgVisualEditorPreferenceModules,
|
2013-07-19 02:44:22 +00:00
|
|
|
'namespaces' => $wgVisualEditorNamespaces,
|
Infrastructure for loading plugins in the MW integration
Server-side, plugins can register themselves by adding to
$wgVisualEditorPluginModules. This is the recommended way for
MW extensions to extend VE. Client-side, plugins can register
themselves through mw.libs.ve.addPlugin(), which takes a string
(RL module name) or a callback.
When VisualEditor loads, we load the registered plugin modules in
parallel with ext.visualEditor.core. Note that they're loaded in
parallel, not after, and so the plugins should explicitly depend
on ext.visualEditor.core if they use or extend classes in VE core.
Once the modules finish loading and user and site scripts have run,
we execute the registered plugin callbacks. These callbacks can
optionally return a promise. We gather these promises and wait for
all of them to be resolved, then initialize the editor.
This allows Gadgets to extend VE by top-loading a small module that
depends on ext.visualEditor.viewPageTarget.init and calls
mw.libs.ve.addPlugin( 'ext.gadget.bottomHalfGadget' ); , the bottom
half being a hidden Gadget that depends on ext.visualEditor.core and
contains the actual code. The addPlugin() call needs to be in a
top-loading module because otherwise there's no guarantee that the
plugin will be registered before the user clicks edit and VE loads.
User and site scripts can extend VE by simply calling addPlugin()
directly, as mw.libs.ve is already present when user scripts run (since
it's top-loaded) and VE waits for 'user' and 'site' to run before
executing plugins.
If user/site scripts need to load additional JS files, they can load
these with $.getScript() and return the corresponding promise:
mw.libs.ve.addPlugin( function() { return $.getScript( 'URL' ); } );
For a diagram of all this, see
https://www.mediawiki.org/wiki/File:VE-plugin-infrastructure.jpg :)
VisualEditor.php:
* Add $wgVisualEditorPluginModules
VisualEditor.hooks.php:
* Expose $wgVisualEditorPluginModules in JS
ve.init.mw.ViewPageTarget.init.js:
* Add mw.libs.ve.addPlugin function that just stores the registered
values in an array and passes them into the mw.Target when it's
being initialized
ve.init.mw.Target.js:
* Add $wgVisualEditorPluginModules to the set of modules to load when
initializing VE
* Add a Deferred (this.modulesReady) to track module loading
* Add addPlugin() and addPlugins() methods that add to either
this.modules or this.pluginCallbacks
* In load(), instead of mw.loader.load()ing this.modules, use using()
to load this.modules plus user and site, and fire onModulesReady()
when they're loaded
* In onModulesReady(), execute the registered callbacks, gather the
returned promises, wait for all of them to be resolved, then resolve
this.modulesReady
* Fire onReady based on this.modulesReady being resolved, rather than
using a second using() call
Bug: 50514
Change-Id: Ib7d87a17eaac6ecdb8b0803b13840d7ee58902df
2013-07-22 20:34:28 +00:00
|
|
|
'pluginModules' => $wgVisualEditorPluginModules,
|
2013-07-26 20:20:10 +00:00
|
|
|
'defaultUserOptions' => array(
|
|
|
|
'betatempdisable' => $wgDefaultUserOptions['visualeditor-betatempdisable'],
|
2013-08-12 05:50:04 +00:00
|
|
|
'enable' => $wgDefaultUserOptions['visualeditor-enable'],
|
2013-07-26 20:20:10 +00:00
|
|
|
),
|
2013-10-10 12:33:49 +00:00
|
|
|
'blacklist' => $wgVisualEditorBrowserBlacklist,
|
2013-10-07 22:55:22 +00:00
|
|
|
'skins' => $wgVisualEditorSupportedSkins,
|
2013-08-01 19:14:41 +00:00
|
|
|
'tabPosition' => $wgVisualEditorTabPosition,
|
|
|
|
'tabMessages' => $wgVisualEditorTabMessages,
|
2013-08-01 20:18:33 +00:00
|
|
|
'showBetaWelcome' => $wgVisualEditorShowBetaWelcome,
|
2012-06-11 06:54:41 +00:00
|
|
|
);
|
2012-12-06 05:57:53 +00:00
|
|
|
|
2014-01-06 08:43:37 +00:00
|
|
|
foreach ( $wgVisualEditorPreferenceModules as $pref => $module ) {
|
|
|
|
$vars['wgVisualEditorConfig']['defaultUserOptions'][$pref] =
|
|
|
|
$wgDefaultUserOptions[$pref];
|
|
|
|
}
|
|
|
|
|
2012-06-01 23:26:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-07-27 23:43:27 +00:00
|
|
|
|
2013-12-05 02:28:59 +00:00
|
|
|
/**
|
|
|
|
* Conditionally register the oojs and oojs-ui modules, in case they've already been registered
|
|
|
|
* by a more recent version of MediaWiki core.
|
2013-12-05 22:45:44 +00:00
|
|
|
*
|
2013-12-05 22:08:29 +00:00
|
|
|
* Also conditionally register the jquery.uls and jquery.i18n modules, in case they've already
|
|
|
|
* been registered by the UniversalLanguageSelector extension.
|
2013-12-05 22:45:44 +00:00
|
|
|
*
|
2013-12-05 02:28:59 +00:00
|
|
|
* @param ResourceLoader $resourceLoader
|
|
|
|
* @returns boolean true
|
|
|
|
*/
|
|
|
|
public static function onResourceLoaderRegisterModules( ResourceLoader &$resourceLoader ) {
|
|
|
|
global $wgResourceModules, $wgVisualEditorResourceTemplate;
|
2013-12-09 23:00:09 +00:00
|
|
|
$modules = array();
|
2013-12-05 02:28:59 +00:00
|
|
|
if ( !isset( $wgResourceModules['oojs'] ) && !$resourceLoader->getModule( 'oojs' ) ) {
|
2013-12-09 23:00:09 +00:00
|
|
|
$modules['oojs'] = $wgVisualEditorResourceTemplate + array(
|
2013-12-05 02:28:59 +00:00
|
|
|
'scripts' => array(
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/lib/oojs/oojs.js',
|
2013-12-05 02:28:59 +00:00
|
|
|
),
|
|
|
|
'targets' => array( 'desktop', 'mobile' ),
|
2013-12-09 23:00:09 +00:00
|
|
|
);
|
2013-12-05 02:28:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( !isset( $wgResourceModules['oojs-ui'] ) && !$resourceLoader->getModule( 'oojs-ui' ) ) {
|
2013-12-09 23:00:09 +00:00
|
|
|
$modules['oojs-ui'] = $wgVisualEditorResourceTemplate + array(
|
2013-12-05 02:28:59 +00:00
|
|
|
'scripts' => array(
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/lib/oojs-ui/oojs-ui.js',
|
2013-12-05 02:28:59 +00:00
|
|
|
),
|
|
|
|
'styles' => array(
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/lib/oojs-ui/oojs-ui.svg.css',
|
2013-12-05 02:28:59 +00:00
|
|
|
),
|
|
|
|
'messages' => array(
|
|
|
|
'ooui-dialog-action-close',
|
|
|
|
'ooui-outline-control-move-down',
|
|
|
|
'ooui-outline-control-move-up',
|
|
|
|
'ooui-toolbar-more',
|
|
|
|
),
|
|
|
|
'dependencies' => array(
|
|
|
|
'oojs'
|
|
|
|
),
|
|
|
|
'targets' => array( 'desktop', 'mobile' ),
|
2013-12-09 23:00:09 +00:00
|
|
|
);
|
2013-12-05 02:28:59 +00:00
|
|
|
}
|
2013-12-05 22:45:44 +00:00
|
|
|
|
|
|
|
if ( !isset( $wgResourceModules['jquery.uls'] ) && !$resourceLoader->getModule( 'jquery.uls' ) ) {
|
2013-12-09 23:00:09 +00:00
|
|
|
$modules['jquery.uls'] = $wgVisualEditorResourceTemplate + array(
|
2013-12-05 22:45:44 +00:00
|
|
|
'scripts' => array(
|
2013-11-12 21:17:09 +00:00
|
|
|
'lib/jquery.uls/src/jquery.uls.core.js',
|
|
|
|
'lib/jquery.uls/src/jquery.uls.lcd.js',
|
|
|
|
'lib/jquery.uls/src/jquery.uls.languagefilter.js',
|
|
|
|
'lib/jquery.uls/src/jquery.uls.regionfilter.js',
|
2013-12-05 22:45:44 +00:00
|
|
|
),
|
|
|
|
'styles' => array(
|
2013-11-12 21:17:09 +00:00
|
|
|
'lib/jquery.uls/css/jquery.uls.css',
|
|
|
|
'lib/jquery.uls/css/jquery.uls.lcd.css',
|
2013-12-05 22:45:44 +00:00
|
|
|
),
|
|
|
|
'dependencies' => array(
|
|
|
|
'jquery.uls.grid',
|
|
|
|
'jquery.uls.data',
|
|
|
|
'jquery.uls.compact',
|
|
|
|
),
|
2013-12-09 23:00:09 +00:00
|
|
|
);
|
2013-12-05 22:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (
|
|
|
|
!isset( $wgResourceModules['jquery.uls.data'] ) &&
|
|
|
|
!$resourceLoader->getModule( 'jquery.uls.data' )
|
|
|
|
) {
|
2013-12-09 23:00:09 +00:00
|
|
|
$modules['jquery.uls.data'] = $wgVisualEditorResourceTemplate + array(
|
2013-12-05 22:45:44 +00:00
|
|
|
'scripts' => array(
|
2013-11-12 21:17:09 +00:00
|
|
|
'lib/jquery.uls/src/jquery.uls.data.js',
|
|
|
|
'lib/jquery.uls/src/jquery.uls.data.utils.js',
|
2013-12-05 22:45:44 +00:00
|
|
|
),
|
|
|
|
'position' => 'top',
|
2013-12-09 23:00:09 +00:00
|
|
|
);
|
2013-12-05 22:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (
|
|
|
|
!isset( $wgResourceModules['jquery.uls.grid'] ) &&
|
|
|
|
!$resourceLoader->getModule( 'jquery.uls.grid' )
|
|
|
|
) {
|
2013-12-09 23:00:09 +00:00
|
|
|
$modules['jquery.uls.grid'] = $wgVisualEditorResourceTemplate + array(
|
2013-11-12 21:17:09 +00:00
|
|
|
'styles' => 'lib/jquery.uls/css/jquery.uls.grid.css',
|
2013-12-05 22:45:44 +00:00
|
|
|
'position' => 'top',
|
2013-12-09 23:00:09 +00:00
|
|
|
);
|
2013-12-05 22:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (
|
|
|
|
!isset( $wgResourceModules['jquery.uls.compact'] ) &&
|
|
|
|
!$resourceLoader->getModule( 'jquery.uls.compact' )
|
|
|
|
) {
|
2013-12-09 23:00:09 +00:00
|
|
|
$modules['jquery.uls.compact'] = $wgVisualEditorResourceTemplate + array(
|
2013-11-12 21:17:09 +00:00
|
|
|
'styles' => 'lib/jquery.uls/css/jquery.uls.compact.css',
|
2013-12-05 22:45:44 +00:00
|
|
|
'position' => 'top',
|
2013-12-09 23:00:09 +00:00
|
|
|
);
|
2013-12-05 22:45:44 +00:00
|
|
|
}
|
|
|
|
|
2013-12-05 22:08:29 +00:00
|
|
|
if (
|
|
|
|
!isset( $wgResourceModules['jquery.i18n'] ) &&
|
|
|
|
!$resourceLoader->getModule( 'jquery.i18n' )
|
|
|
|
) {
|
2013-12-09 23:00:09 +00:00
|
|
|
$modules['jquery.i18n'] = $wgVisualEditorResourceTemplate + array(
|
2013-12-05 22:08:29 +00:00
|
|
|
'scripts' => array(
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/lib/jquery.i18n/src/jquery.i18n.js',
|
|
|
|
'lib/ve/lib/jquery.i18n/src/jquery.i18n.messagestore.js',
|
|
|
|
'lib/ve/lib/jquery.i18n/src/jquery.i18n.parser.js',
|
|
|
|
'lib/ve/lib/jquery.i18n/src/jquery.i18n.emitter.js',
|
|
|
|
'lib/ve/lib/jquery.i18n/src/jquery.i18n.language.js',
|
2013-12-05 22:08:29 +00:00
|
|
|
),
|
|
|
|
'dependencies' => 'mediawiki.libs.pluralruleparser',
|
|
|
|
'languageScripts' => array(
|
2013-12-19 23:07:19 +00:00
|
|
|
'bs' => 'lib/ve/lib/jquery.i18n/src/languages/bs.js',
|
|
|
|
'dsb' => 'lib/ve/lib/jquery.i18n/src/languages/dsb.js',
|
|
|
|
'fi' => 'lib/ve/lib/jquery.i18n/src/languages/fi.js',
|
|
|
|
'ga' => 'lib/ve/lib/jquery.i18n/src/languages/ga.js',
|
|
|
|
'he' => 'lib/ve/lib/jquery.i18n/src/languages/he.js',
|
|
|
|
'hsb' => 'lib/ve/lib/jquery.i18n/src/languages/hsb.js',
|
|
|
|
'hu' => 'lib/ve/lib/jquery.i18n/src/languages/hu.js',
|
|
|
|
'hy' => 'lib/ve/lib/jquery.i18n/src/languages/hy.js',
|
|
|
|
'la' => 'lib/ve/lib/jquery.i18n/src/languages/la.js',
|
|
|
|
'ml' => 'lib/ve/lib/jquery.i18n/src/languages/ml.js',
|
|
|
|
'os' => 'lib/ve/lib/jquery.i18n/src/languages/os.js',
|
|
|
|
'ru' => 'lib/ve/lib/jquery.i18n/src/languages/ru.js',
|
|
|
|
'sl' => 'lib/ve/lib/jquery.i18n/src/languages/sl.js',
|
|
|
|
'uk' => 'lib/ve/lib/jquery.i18n/src/languages/uk.js',
|
2013-12-05 22:08:29 +00:00
|
|
|
),
|
2013-12-09 23:00:09 +00:00
|
|
|
);
|
2013-12-05 22:08:29 +00:00
|
|
|
}
|
2013-12-09 23:00:09 +00:00
|
|
|
|
|
|
|
$resourceLoader->register( $modules );
|
2013-12-05 02:28:59 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-05-30 11:00:36 +00:00
|
|
|
public static function onResourceLoaderTestModules(
|
|
|
|
array &$testModules,
|
|
|
|
ResourceLoader &$resourceLoader
|
|
|
|
) {
|
2012-07-27 23:43:27 +00:00
|
|
|
$testModules['qunit']['ext.visualEditor.test'] = array(
|
2013-09-30 12:11:49 +00:00
|
|
|
'styles' => array(
|
|
|
|
// jsdifflib
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/lib/jsdifflib/diffview.css',
|
2013-09-30 12:11:49 +00:00
|
|
|
),
|
2012-07-27 23:43:27 +00:00
|
|
|
'scripts' => array(
|
2013-07-03 01:30:10 +00:00
|
|
|
// MW config preload
|
2013-12-19 20:28:07 +00:00
|
|
|
'modules/ve-mw/test/mw-preload.js',
|
2013-09-30 12:11:49 +00:00
|
|
|
// jsdifflib
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/lib/jsdifflib/diffview.js',
|
|
|
|
'lib/ve/lib/jsdifflib/difflib.js',
|
2012-07-27 23:43:27 +00:00
|
|
|
// QUnit plugin
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/modules/ve/test/ve.qunit.js',
|
2013-07-16 22:45:11 +00:00
|
|
|
// UnicodeJS Tests
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/modules/unicodejs/test/unicodejs.test.js',
|
|
|
|
'lib/ve/modules/unicodejs/test/unicodejs.graphemebreak.test.js',
|
|
|
|
'lib/ve/modules/unicodejs/test/unicodejs.wordbreak.test.js',
|
2012-07-27 23:43:27 +00:00
|
|
|
// VisualEditor Tests
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/modules/ve/test/ve.test.utils.js',
|
|
|
|
'lib/ve/modules/ve/test/ve.test.js',
|
|
|
|
'lib/ve/modules/ve/test/ve.Document.test.js',
|
|
|
|
'lib/ve/modules/ve/test/ve.Node.test.js',
|
|
|
|
'lib/ve/modules/ve/test/ve.BranchNode.test.js',
|
|
|
|
'lib/ve/modules/ve/test/ve.LeafNode.test.js',
|
2012-07-27 23:43:27 +00:00
|
|
|
// VisualEditor DataModel Tests
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.example.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.AnnotationSet.test.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.NodeFactory.test.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.Node.test.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.Converter.test.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.BranchNode.test.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.LeafNode.test.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.LinearData.test.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/nodes/ve.dm.TextNode.test.js',
|
2013-12-19 20:28:07 +00:00
|
|
|
'modules/ve-mw/test/dm/nodes/ve.dm.MWTransclusionNode.test.js',
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.Document.test.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.DocumentSynchronizer.test.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.IndexValueStore.test.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.InternalList.test.js',
|
2013-12-19 20:28:07 +00:00
|
|
|
'modules/ve-mw/test/dm/ve.dm.InternalList.test.js',
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.Transaction.test.js',
|
2013-12-19 20:28:07 +00:00
|
|
|
'modules/ve-mw/test/dm/ve.dm.Transaction.test.js',
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.TransactionProcessor.test.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.Surface.test.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.SurfaceFragment.test.js',
|
2013-12-19 20:28:07 +00:00
|
|
|
'modules/ve-mw/test/dm/ve.dm.SurfaceFragment.test.js',
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.ModelRegistry.test.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.MetaList.test.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/ve.dm.Model.test.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/lineardata/ve.dm.FlatLinearData.test.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/lineardata/ve.dm.ElementLinearData.test.js',
|
|
|
|
'lib/ve/modules/ve/test/dm/lineardata/ve.dm.MetaLinearData.test.js',
|
2013-12-19 20:28:07 +00:00
|
|
|
'modules/ve-mw/test/dm/ve.dm.mwExample.js',
|
|
|
|
'modules/ve-mw/test/dm/ve.dm.MWConverter.test.js',
|
2012-07-27 23:43:27 +00:00
|
|
|
// VisualEditor ContentEditable Tests
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/modules/ve/test/ce/ve.ce.test.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/ve.ce.Document.test.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/ve.ce.Surface.test.js',
|
2013-12-19 20:28:07 +00:00
|
|
|
'modules/ve-mw/test/ce/ve.ce.Document.test.js',
|
|
|
|
'modules/ve-mw/test/ce/ve.ce.Surface.test.js',
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/modules/ve/test/ce/ve.ce.NodeFactory.test.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/ve.ce.Node.test.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/ve.ce.BranchNode.test.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/ve.ce.ContentBranchNode.test.js',
|
2013-12-19 20:28:07 +00:00
|
|
|
'modules/ve-mw/test/ce/ve.ce.ContentBranchNode.test.js',
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/modules/ve/test/ce/ve.ce.LeafNode.test.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/nodes/ve.ce.TextNode.test.js',
|
2013-05-14 23:45:42 +00:00
|
|
|
// VisualEditor Actions Tests
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/modules/ve/test/ui/actions/ve.ui.FormatAction.test.js',
|
2013-12-19 20:28:07 +00:00
|
|
|
'modules/ve-mw/test/ui/actions/ve.ui.FormatAction.test.js',
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/modules/ve/test/ui/actions/ve.ui.IndentationAction.test.js',
|
|
|
|
'lib/ve/modules/ve/test/ui/actions/ve.ui.ListAction.test.js',
|
2012-12-04 06:56:41 +00:00
|
|
|
// VisualEditor initialization Tests
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/modules/ve/test/init/ve.init.Platform.test.js',
|
2013-12-19 20:28:07 +00:00
|
|
|
'modules/ve-mw/test/init/targets/ve.init.mw.ViewPageTarget.test.js',
|
2013-09-06 19:25:21 +00:00
|
|
|
// IME tests
|
2013-12-19 23:07:19 +00:00
|
|
|
'lib/ve/modules/ve/test/ce/ve.ce.TestRunner.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/ve.ce.imetests.test.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/backspace-chromium-ubuntu-none.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/backspace-firefox-ubuntu-none.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/backspace-ie-win-none.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-chrome-win-chinese-traditional-handwriting.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-chrome-win-greek.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-chrome-win-welsh.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-chromium-ubuntu-ibus-chinese-cantonese.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-chromium-ubuntu-ibus-japanese-anthy--hiraganaonly.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-chromium-ubuntu-ibus-korean-korean.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-chromium-ubuntu-ibus-malayalam-swanalekha.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-firefox-ubuntu-ibus-chinese-cantonese.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-firefox-ubuntu-ibus-japanese-anthy--hiraganaonly.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-firefox-ubuntu-ibus-korean-korean.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-firefox-ubuntu-ibus-malayalam.swanalekha.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-firefox-win-chinese-traditional-handwriting.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-firefox-win-greek.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-firefox-win-welsh.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-ie-win-chinese-traditional-handwriting.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-ie-win-greek.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-ie-win-korean.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/input-ie-win-welsh.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/leftarrow-chromium-ubuntu-none.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/leftarrow-firefox-ubuntu-none.js',
|
|
|
|
'lib/ve/modules/ve/test/ce/imetests/leftarrow-ie-win-none.js',
|
2012-07-27 23:43:27 +00:00
|
|
|
),
|
|
|
|
'dependencies' => array(
|
2013-07-16 22:45:11 +00:00
|
|
|
'unicodejs.wordbreak',
|
2013-05-14 23:45:42 +00:00
|
|
|
'ext.visualEditor.standalone',
|
2012-07-27 23:43:27 +00:00
|
|
|
'ext.visualEditor.core',
|
2013-04-16 17:31:17 +00:00
|
|
|
'ext.visualEditor.experimental',
|
2013-07-03 22:14:52 +00:00
|
|
|
'ext.visualEditor.viewPageTarget.init',
|
2012-07-27 23:43:27 +00:00
|
|
|
'ext.visualEditor.viewPageTarget',
|
|
|
|
),
|
2013-12-19 20:28:07 +00:00
|
|
|
'localBasePath' => __DIR__,
|
|
|
|
'remoteExtPath' => 'VisualEditor',
|
2012-07-27 23:43:27 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2013-09-16 21:12:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Ensures that we know whether we're running inside a parser test.
|
|
|
|
*/
|
|
|
|
public static function onParserTestGlobals( array &$settings ) {
|
|
|
|
$settings['wgVisualEditorInParserTests'] = true;
|
|
|
|
}
|
2012-05-25 19:50:48 +00:00
|
|
|
}
|