2011-11-28 20:28:28 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* VisualEditor extension
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @ingroup Extensions
|
|
|
|
*
|
|
|
|
* @author Trevor Parscal <trevor@wikimedia.org>
|
|
|
|
* @author Inez Korczyński <inez@wikia-inc.com>
|
|
|
|
* @author Roan Kattouw <roan.kattouw@gmail.com>
|
|
|
|
* @author Neil Kandalgaonkar <neilk@wikimedia.org>
|
|
|
|
* @author Gabriel Wicke <gwicke@wikimedia.org>
|
|
|
|
* @author Brion Vibber <brion@wikimedia.org>
|
|
|
|
* @license GPL v2 or later
|
|
|
|
* @version 0.1.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Setup */
|
|
|
|
|
|
|
|
$wgExtensionCredits['other'][] = array(
|
|
|
|
'path' => __FILE__,
|
|
|
|
'name' => 'VisualEditor',
|
|
|
|
'author' => array(
|
|
|
|
'Trevor Parscal',
|
|
|
|
'Inez Korczyński',
|
|
|
|
'Roan Kattouw',
|
|
|
|
'Neil Kandalgaonkar',
|
|
|
|
'Gabriel Wicke',
|
|
|
|
'Brion Vibber',
|
|
|
|
),
|
|
|
|
'version' => '0.1.0',
|
2011-12-13 23:49:33 +00:00
|
|
|
'url' => 'https://www.mediawiki.org/wiki/Extension:VisualEditor',
|
2011-11-28 20:28:28 +00:00
|
|
|
'descriptionmsg' => 'visualeditor-desc',
|
|
|
|
);
|
|
|
|
$dir = dirname( __FILE__ ) . '/';
|
|
|
|
$wgExtensionMessagesFiles['VisualEditor'] = $dir . 'VisualEditor.i18n.php';
|
2011-12-02 07:01:35 +00:00
|
|
|
$wgExtensionMessagesFiles['VisualEditorAliases'] = $dir . 'VisualEditor.alias.php';
|
2011-11-28 20:28:28 +00:00
|
|
|
$wgAutoloadClasses['SpecialVisualEditorSandbox'] = $dir . 'SpecialVisualEditorSandbox.php';
|
|
|
|
$wgSpecialPages['VisualEditorSandbox'] = 'SpecialVisualEditorSandbox';
|
|
|
|
$wgSpecialPageGroups['VisualEditorSandbox'] = 'other';
|
|
|
|
|
|
|
|
$wgVisualEditorResourceTemplate = array(
|
|
|
|
'localBasePath' => dirname( __FILE__ ) . '/modules',
|
|
|
|
'remoteExtPath' => 'VisualEditor/modules',
|
|
|
|
'group' => 'ext.visualEditor',
|
|
|
|
);
|
|
|
|
|
|
|
|
$wgResourceModules += array(
|
2012-03-29 21:05:25 +00:00
|
|
|
'rangy' => $wgVisualEditorResourceTemplate + array(
|
|
|
|
'scripts' => array(
|
|
|
|
'rangy/rangy-core.js',
|
|
|
|
'rangy/rangy-position.js',
|
|
|
|
),
|
|
|
|
),
|
2011-12-13 02:46:31 +00:00
|
|
|
'ext.visualEditor.special.sandbox' => $wgVisualEditorResourceTemplate + array(
|
|
|
|
'scripts' => array(
|
|
|
|
'sandbox/special.js',
|
|
|
|
),
|
|
|
|
'messages' => array(
|
|
|
|
'visualeditor-feedback-prompt',
|
|
|
|
'visualeditor-feedback-dialog-title',
|
2012-02-07 16:37:08 +00:00
|
|
|
'visualeditor-sandbox-title',
|
2011-12-13 02:46:31 +00:00
|
|
|
),
|
|
|
|
'dependencies' => array(
|
|
|
|
'ext.visualEditor.sandbox',
|
|
|
|
'mediawiki.feedback',
|
2011-12-14 01:32:07 +00:00
|
|
|
'mediawiki.Uri',
|
2011-12-13 02:46:31 +00:00
|
|
|
)
|
|
|
|
),
|
2011-11-28 20:28:28 +00:00
|
|
|
'ext.visualEditor.sandbox' => $wgVisualEditorResourceTemplate + array(
|
|
|
|
'scripts' => array(
|
|
|
|
'sandbox/sandbox.js',
|
|
|
|
),
|
2012-02-07 16:37:08 +00:00
|
|
|
'messages' => array(
|
|
|
|
'visualeditorsandbox',
|
|
|
|
),
|
2011-11-28 20:28:28 +00:00
|
|
|
'styles' => 'sandbox/sandbox.css',
|
|
|
|
'dependencies' => array(
|
2012-02-06 23:50:56 +00:00
|
|
|
'ext.visualEditor.ve',
|
2011-11-28 20:28:28 +00:00
|
|
|
),
|
|
|
|
),
|
2012-05-25 19:50:48 +00:00
|
|
|
'ext.visualEditor.core' => $wgVisualEditorResourceTemplate + array(
|
|
|
|
'scripts' => array(
|
|
|
|
'core/ve.Core.js',
|
|
|
|
),
|
|
|
|
'messages' => array(
|
|
|
|
'',
|
|
|
|
),
|
|
|
|
'styles' => 'core/ve.Core.css',
|
|
|
|
'dependencies' => array(
|
|
|
|
'jquery',
|
|
|
|
'mediawiki.util'
|
|
|
|
),
|
|
|
|
),
|
2012-02-06 23:50:56 +00:00
|
|
|
'ext.visualEditor.ve' => $wgVisualEditorResourceTemplate + array(
|
2011-11-28 20:28:28 +00:00
|
|
|
'scripts' => array(
|
2012-05-24 22:15:11 +00:00
|
|
|
// ve
|
2012-05-21 19:49:14 +00:00
|
|
|
'jquery/jquery.json.js',
|
2012-05-21 19:37:30 +00:00
|
|
|
've2/ve.js',
|
|
|
|
've2/ve.NodeFactory.js',
|
|
|
|
've2/ve.Position.js',
|
|
|
|
've2/ve.Range.js',
|
|
|
|
've2/ve.EventEmitter.js',
|
|
|
|
've2/ve.Node.js',
|
|
|
|
've2/ve.BranchNode.js',
|
|
|
|
've2/ve.LeafNode.js',
|
|
|
|
've2/ve.Surface.js',
|
|
|
|
've2/ve.Document.js',
|
|
|
|
|
2012-02-06 23:50:56 +00:00
|
|
|
// dm
|
2012-05-21 19:37:30 +00:00
|
|
|
've2/dm/ve.dm.js',
|
|
|
|
've2/dm/ve.dm.NodeFactory.js',
|
|
|
|
've2/dm/ve.dm.Node.js',
|
|
|
|
've2/dm/ve.dm.BranchNode.js',
|
|
|
|
've2/dm/ve.dm.LeafNode.js',
|
|
|
|
've2/dm/ve.dm.TransactionProcessor.js',
|
|
|
|
've2/dm/ve.dm.Transaction.js',
|
|
|
|
've2/dm/ve.dm.Surface.js',
|
|
|
|
've2/dm/ve.dm.Document.js',
|
|
|
|
've2/dm/ve.dm.HTMLConverter.js',
|
|
|
|
|
2012-05-22 00:39:03 +00:00
|
|
|
've2/dm/nodes/ve.dm.AlienInlineNode.js',
|
|
|
|
've2/dm/nodes/ve.dm.AlienBlockNode.js',
|
2012-05-21 19:37:30 +00:00
|
|
|
've2/dm/nodes/ve.dm.DefinitionListItemNode.js',
|
|
|
|
've2/dm/nodes/ve.dm.DefinitionListNode.js',
|
|
|
|
've2/dm/nodes/ve.dm.DocumentNode.js',
|
|
|
|
've2/dm/nodes/ve.dm.HeadingNode.js',
|
|
|
|
've2/dm/nodes/ve.dm.ImageNode.js',
|
|
|
|
've2/dm/nodes/ve.dm.ListItemNode.js',
|
|
|
|
've2/dm/nodes/ve.dm.ListNode.js',
|
|
|
|
've2/dm/nodes/ve.dm.ParagraphNode.js',
|
|
|
|
've2/dm/nodes/ve.dm.PreformattedNode.js',
|
|
|
|
've2/dm/nodes/ve.dm.TableCellNode.js',
|
|
|
|
've2/dm/nodes/ve.dm.TableNode.js',
|
|
|
|
've2/dm/nodes/ve.dm.TableRowNode.js',
|
|
|
|
've2/dm/nodes/ve.dm.TextNode.js',
|
|
|
|
|
2012-02-06 23:50:56 +00:00
|
|
|
've/dm/serializers/ve.dm.AnnotationSerializer.js',
|
|
|
|
've/dm/serializers/ve.dm.HtmlSerializer.js',
|
|
|
|
've/dm/serializers/ve.dm.JsonSerializer.js',
|
|
|
|
've/dm/serializers/ve.dm.WikitextSerializer.js',
|
2012-05-21 19:37:30 +00:00
|
|
|
|
2012-03-29 21:05:25 +00:00
|
|
|
// ce
|
2012-05-21 19:37:30 +00:00
|
|
|
've2/ce/ve.ce.js',
|
|
|
|
've2/ce/ve.ce.NodeFactory.js',
|
|
|
|
've2/ce/ve.ce.Document.js',
|
|
|
|
've2/ce/ve.ce.Node.js',
|
|
|
|
've2/ce/ve.ce.BranchNode.js',
|
|
|
|
've2/ce/ve.ce.LeafNode.js',
|
|
|
|
've2/ce/ve.ce.Surface.js',
|
|
|
|
|
2012-05-22 00:39:03 +00:00
|
|
|
've2/ce/nodes/ve.ce.AlienInlineNode.js',
|
|
|
|
've2/ce/nodes/ve.ce.AlienBlockNode.js',
|
2012-05-21 19:37:30 +00:00
|
|
|
've2/ce/nodes/ve.ce.DefinitionListItemNode.js',
|
|
|
|
've2/ce/nodes/ve.ce.DefinitionListNode.js',
|
|
|
|
've2/ce/nodes/ve.ce.DocumentNode.js',
|
|
|
|
've2/ce/nodes/ve.ce.HeadingNode.js',
|
|
|
|
've2/ce/nodes/ve.ce.ImageNode.js',
|
|
|
|
've2/ce/nodes/ve.ce.ListItemNode.js',
|
|
|
|
've2/ce/nodes/ve.ce.ListNode.js',
|
|
|
|
've2/ce/nodes/ve.ce.ParagraphNode.js',
|
|
|
|
've2/ce/nodes/ve.ce.PreformattedNode.js',
|
|
|
|
've2/ce/nodes/ve.ce.TableCellNode.js',
|
|
|
|
've2/ce/nodes/ve.ce.TableNode.js',
|
|
|
|
've2/ce/nodes/ve.ce.TableRowNode.js',
|
|
|
|
've2/ce/nodes/ve.ce.TextNode.js',
|
|
|
|
|
2012-02-06 23:50:56 +00:00
|
|
|
// ui
|
2012-05-21 19:37:30 +00:00
|
|
|
've2/ui/ve.ui.js',
|
|
|
|
've2/ui/ve.ui.Inspector.js',
|
|
|
|
've2/ui/ve.ui.Tool.js',
|
|
|
|
've2/ui/ve.ui.Toolbar.js',
|
|
|
|
've2/ui/ve.ui.Context.js',
|
|
|
|
've2/ui/ve.ui.Menu.js',
|
|
|
|
|
|
|
|
've2/ui/inspectors/ve.ui.LinkInspector.js',
|
|
|
|
|
|
|
|
've2/ui/tools/ve.ui.ButtonTool.js',
|
|
|
|
've2/ui/tools/ve.ui.AnnotationButtonTool.js',
|
|
|
|
've2/ui/tools/ve.ui.ClearButtonTool.js',
|
|
|
|
've2/ui/tools/ve.ui.HistoryButtonTool.js',
|
|
|
|
've2/ui/tools/ve.ui.ListButtonTool.js',
|
|
|
|
've2/ui/tools/ve.ui.IndentationButtonTool.js',
|
|
|
|
've2/ui/tools/ve.ui.DropdownTool.js',
|
|
|
|
've2/ui/tools/ve.ui.FormatDropdownTool.js'
|
2011-11-28 20:28:28 +00:00
|
|
|
),
|
2011-11-30 20:45:24 +00:00
|
|
|
'styles' => array(
|
2012-05-24 22:15:11 +00:00
|
|
|
// ce
|
|
|
|
've2/ce/styles/ve.ce.Surface.css',
|
|
|
|
've2/ce/styles/ve.ce.Content.css',
|
|
|
|
've2/ce/styles/ve.ce.Document.css',
|
2012-02-06 23:50:56 +00:00
|
|
|
// ui
|
2012-05-25 19:50:48 +00:00
|
|
|
've2/ui/styles/ve.ui.Surface.css',
|
2012-05-21 19:37:30 +00:00
|
|
|
've2/ui/styles/ve.ui.Context.css',
|
|
|
|
've2/ui/styles/ve.ui.Inspector.css',
|
|
|
|
've2/ui/styles/ve.ui.Toolbar.css',
|
|
|
|
've2/ui/styles/ve.ui.Menu.css',
|
2011-11-30 20:45:24 +00:00
|
|
|
),
|
2011-11-28 20:28:28 +00:00
|
|
|
'dependencies' => array(
|
|
|
|
'jquery',
|
2012-03-29 21:05:25 +00:00
|
|
|
'rangy',
|
2011-11-28 20:28:28 +00:00
|
|
|
),
|
2012-02-07 16:37:08 +00:00
|
|
|
'messages' => array(
|
|
|
|
'visualeditor-tooltip-wikitext',
|
|
|
|
'visualeditor-tooltip-json',
|
|
|
|
'visualeditor-tooltip-html',
|
|
|
|
'visualeditor-tooltip-render',
|
|
|
|
'visualeditor-tooltip-history',
|
|
|
|
'visualeditor-tooltip-help',
|
|
|
|
'visualeditor',
|
|
|
|
),
|
2011-11-28 20:28:28 +00:00
|
|
|
)
|
|
|
|
);
|
2012-01-31 00:02:48 +00:00
|
|
|
|
2012-05-25 19:50:48 +00:00
|
|
|
/*
|
|
|
|
VisualEditor Namespace
|
|
|
|
Using 2500 range as it appears available in
|
|
|
|
MW Extension_namespace_registration
|
|
|
|
*/
|
2012-05-25 23:33:39 +00:00
|
|
|
define("NS_VISUALEDITOR", 2500);
|
|
|
|
define("NS_VISUALEDITOR_TALK", 2501);
|
|
|
|
$wgExtraNamespaces[NS_VISUALEDITOR] = "VisualEditor";
|
|
|
|
$wgExtraNamespaces[NS_VISUALEDITOR_TALK] = "VisualEditor_talk";
|
|
|
|
$wgContentNamespaces[] = NS_VISUALEDITOR;
|
|
|
|
$wgContentNamespaces[] = NS_VISUALEDITOR_TALK;
|
2012-05-25 19:50:48 +00:00
|
|
|
|
2012-05-25 22:23:40 +00:00
|
|
|
// Parsoid Wrapper API
|
2012-05-25 19:50:48 +00:00
|
|
|
$wgAutoloadClasses['ApiVisualEditor'] = $dir . 'ApiVisualEditor.php';
|
|
|
|
$wgAPIModules['ve-parsoid'] = 'ApiVisualEditor';
|
|
|
|
|
|
|
|
// Integration Hooks
|
|
|
|
$wgAutoloadClasses['VisualEditorHooks'] = $dir . 'VisualEditor.hooks.php';
|
|
|
|
$wgHooks['BeforePageDisplay'][] = 'VisualEditorHooks::onPageDisplay';
|
2012-01-31 00:02:48 +00:00
|
|
|
|
|
|
|
// API for retrieving wikidom parse results
|
|
|
|
$wgAutoloadClasses['ApiQueryParseTree'] = $dir . 'api/ApiQueryParseTree.php';
|
|
|
|
$wgAPIPropModules['parsetree'] = 'ApiQueryParseTree';
|
|
|
|
|
|
|
|
// external cmd, accepts wikitext and returns parse tree in JSON. Also set environment variables needed by script here.
|
|
|
|
putenv('NODE_PATH=/usr/local/bin/node_modules' );
|
|
|
|
$wgVisualEditorParserCmd = '/usr/local/bin/node ' . $dir . 'modules/parser/parse.js';
|
2012-05-25 19:50:48 +00:00
|
|
|
|
|
|
|
|