mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 00:00:49 +00:00
Display JSON configuration options in NS_MEDIAWIKI as JSON
Change-Id: Ie033b8bd42beda769dd499a9d02d488bfffb0fa0
This commit is contained in:
parent
70fe9aac4d
commit
0121c68b50
|
@ -35,6 +35,28 @@ class VisualEditorHooks {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the content model of messages that are actually JSON to JSON.
|
||||
* This only affects validation and UI when saving and editing, not
|
||||
* loading the content.
|
||||
*
|
||||
* @param Title $title
|
||||
* @param string $model
|
||||
* @return bool
|
||||
*/
|
||||
public static function onContentHandlerDefaultModelFor( Title $title, &$model ) {
|
||||
$messages = array(
|
||||
'Visualeditor-cite-tool-definition.json',
|
||||
'Visualeditor-specialcharinspector-characterlist-insert'
|
||||
);
|
||||
|
||||
if ( $title->inNamespace( NS_MEDIAWIKI ) && in_array( $title->getText(), $messages ) ) {
|
||||
$model = CONTENT_MODEL_JSON;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the Edit tab and adds the VisualEditor tab.
|
||||
*
|
||||
|
|
|
@ -74,6 +74,7 @@ $wgConfigRegistry['visualeditor'] = 'GlobalVarConfig::newInstance';
|
|||
|
||||
// Register Hooks
|
||||
$wgHooks['BeforePageDisplay'][] = 'VisualEditorHooks::onBeforePageDisplay';
|
||||
$wgHooks['ContentHandlerDefaultModelFor'][] = 'VisualEditorHooks::onContentHandlerDefaultModelFor';
|
||||
$wgHooks['DoEditSectionLink'][] = 'VisualEditorHooks::onDoEditSectionLink';
|
||||
$wgHooks['GetBetaFeaturePreferences'][] = 'VisualEditorHooks::onGetBetaPreferences';
|
||||
$wgHooks['GetPreferences'][] = 'VisualEditorHooks::onGetPreferences';
|
||||
|
|
Loading…
Reference in a new issue