mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 03:08:42 +00:00
Merge "init.mw.Target: make getSurfaceConfig aware of modes"
This commit is contained in:
commit
12e8f5cdbb
|
@ -310,9 +310,6 @@ ve.init.mw.Target.prototype.createSurface = function ( dmDoc, config ) {
|
||||||
// Preserve empty linebreaks on paste in source editor
|
// Preserve empty linebreaks on paste in source editor
|
||||||
importRules.all.keepEmptyContentBranches = true;
|
importRules.all.keepEmptyContentBranches = true;
|
||||||
config = this.getSurfaceConfig( ve.extendObject( {}, config, {
|
config = this.getSurfaceConfig( ve.extendObject( {}, config, {
|
||||||
commandRegistry: ve.ui.wikitextCommandRegistry,
|
|
||||||
sequenceRegistry: ve.ui.wikitextSequenceRegistry,
|
|
||||||
dataTransferHandlerFactory: ve.ui.wikitextDataTransferHandlerFactory,
|
|
||||||
importRules: importRules
|
importRules: importRules
|
||||||
} ) );
|
} ) );
|
||||||
return new ve.ui.MWWikitextSurface( dmDoc, config );
|
return new ve.ui.MWWikitextSurface( dmDoc, config );
|
||||||
|
@ -341,6 +338,20 @@ ve.init.mw.Target.prototype.createSurface = function ( dmDoc, config ) {
|
||||||
return surface;
|
return surface;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
ve.init.mw.Target.prototype.getSurfaceConfig = function ( config ) {
|
||||||
|
// If we're not asking for a specific mode's config, use the default mode.
|
||||||
|
config = ve.extendObject( { mode: this.defaultMode }, config );
|
||||||
|
return ve.init.mw.Target.super.prototype.getSurfaceConfig.call( this, ve.extendObject( {
|
||||||
|
// Provide the wikitext versions of the registries, if we're using source mode
|
||||||
|
commandRegistry: config.mode === 'source' ? ve.ui.wikitextCommandRegistry : ve.ui.commandRegistry,
|
||||||
|
sequenceRegistry: config.mode === 'source' ? ve.ui.wikitextSequenceRegistry : ve.ui.sequenceRegistry,
|
||||||
|
dataTransferHandlerFactory: config.mode === 'source' ? ve.ui.wikitextDataTransferHandlerFactory : ve.ui.dataTransferHandlerFactory
|
||||||
|
}, config ) );
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Switch to editing mode.
|
* Switch to editing mode.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue