mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeEditor
synced 2024-11-27 16:40:07 +00:00
81ba498314
When off, we restore the regular textarea and its behavior. State is saved as a cookie, like other WikiEditor settings.
60 lines
1.5 KiB
PHP
60 lines
1.5 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Helper to load syntax-highlighting editor for JavaScript and CSS pages
|
|
* on-wiki.
|
|
*
|
|
* Extends and requires WikiEditor extension.
|
|
*
|
|
* Extension code is GPLv2 following MediaWiki base.
|
|
* Ace editor JS code follows its own license, see in the 'ace' subdir.
|
|
*/
|
|
|
|
$wgExtensionCredits['other'][] = array(
|
|
'path' => __FILE__,
|
|
'name' => 'CodeEditor',
|
|
'url' => 'http://www.mediawiki.org/wiki/Extension:CodeEditor',
|
|
'author' => array( 'Brion Vibber', 'authors of Ace (ajax.org)' ),
|
|
'descriptionmsg' => 'codeeditor-desc',
|
|
);
|
|
|
|
$dir = dirname( __FILE__ );
|
|
$wgAutoloadClasses['CodeEditorHooks'] = $dir . '/CodeEditor.hooks.php';
|
|
$wgExtensionMessagesFiles['CodeEditor'] = $dir . '/CodeEditor.i18n.php';
|
|
|
|
$wgHooks['EditPage::showEditForm:initial'][] = 'CodeEditorHooks::editPageShowEditFormInitial';
|
|
|
|
$tpl = array(
|
|
'localBasePath' => dirname( __FILE__ ) . '/modules',
|
|
'remoteExtPath' => 'CodeEditor/modules',
|
|
'group' => 'ext.wikiEditor',
|
|
);
|
|
|
|
$wgResourceModules['ext.codeEditor'] = array(
|
|
'scripts' => 'ext.codeEditor.js',
|
|
'dependencies' => array(
|
|
'ext.wikiEditor',
|
|
'jquery.codeEditor'
|
|
),
|
|
) + $tpl;
|
|
|
|
$wgResourceModules['jquery.codeEditor'] = array(
|
|
'scripts' => 'jquery.codeEditor.js',
|
|
'dependencies' => array(
|
|
'jquery.wikiEditor',
|
|
'ext.codeEditor.ace',
|
|
),
|
|
'messages' => array(
|
|
'codeeditor-toolbar-toggle'
|
|
)
|
|
) + $tpl;
|
|
|
|
// Minimal bundling of a couple bits of Ace
|
|
$wgResourceModules['ext.codeEditor.ace'] = array(
|
|
'scripts' => array(
|
|
'ace/ace-uncompressed.js',
|
|
'ace/mode-javascript.js',
|
|
'ace/mode-css.js',
|
|
),
|
|
) + $tpl;
|