mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-17 21:21:35 +00:00
2f1cf65233
* Add config option $wgDiscussionToolsUseVisualEditor (default false). * Add new modules ext.discussionTools.ReplyWidgetPlain and ...ReplyWidgetVisual, replacing ...ReplyWidget. Load only one of them depending on the config. TODO: * Also add the visual mode of VisualEditor, this only uses NWE now. There is already code to support saving from it, but no mode switcher tool Co-Authored-By: Ed Sanders <esanders@wikimedia.org> Co-Authored-By: Bartosz Dziewoński <matma.rex@gmail.com> Change-Id: I9b6db865d51baf400fb715dc7aa68ccd8cdd4905
60 lines
1.4 KiB
JavaScript
60 lines
1.4 KiB
JavaScript
/**
|
|
* DiscussionTools-specific target, inheriting from the stand-alone target
|
|
*
|
|
* @class
|
|
* @extends ve.init.mw.Target
|
|
*
|
|
* @param {Object} config Configuration options
|
|
*/
|
|
function CommentTarget( config ) {
|
|
config = config || {};
|
|
|
|
// Parent constructor
|
|
CommentTarget.super.call( this, ve.extendObject( {
|
|
toolbarConfig: { actions: true, $overlay: true, position: 'bottom' }
|
|
}, config ) );
|
|
}
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( CommentTarget, ve.init.mw.Target );
|
|
|
|
/* Static methods */
|
|
|
|
CommentTarget.static.name = 'discussionTools';
|
|
|
|
CommentTarget.static.modes = [ 'visual', 'source' ];
|
|
|
|
CommentTarget.static.toolbarGroups = [
|
|
{
|
|
name: 'style',
|
|
type: 'list',
|
|
icon: 'textStyle',
|
|
title: OO.ui.deferMsg( 'visualeditor-toolbar-style-tooltip' ),
|
|
include: [ { group: 'textStyle' }, 'language', 'clear' ],
|
|
forceExpand: [ 'bold', 'italic' ],
|
|
demote: [ 'strikethrough', 'code', 'underline', 'language', 'big', 'small', 'clear' ]
|
|
},
|
|
{
|
|
name: 'link',
|
|
include: [ 'link' ]
|
|
}
|
|
// Mention?
|
|
];
|
|
|
|
// Allow pasting links
|
|
CommentTarget.static.importRules = ve.copy( CommentTarget.static.importRules );
|
|
CommentTarget.static.importRules.external.blacklist[ 'link/mwExternal' ] = false;
|
|
|
|
// TODO Add edit switcher actionGroup
|
|
|
|
CommentTarget.prototype.attachToolbar = function () {
|
|
this.$element.append( this.getToolbar().$element );
|
|
};
|
|
|
|
/* Registration */
|
|
|
|
ve.init.mw.targetFactory.register( CommentTarget );
|
|
|
|
module.exports = CommentTarget;
|