mediawiki-extensions-Discus.../modules/CommentTarget.js
Ed Sanders cd7acc741b Move VE toolbar to top right
Change-Id: I97b322ded505df608eda73a7c6a04157e993d73b
2020-04-27 16:42:35 +01:00

75 lines
1.6 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: 'top' }
}, 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',
title: OO.ui.deferMsg( 'visualeditor-toolbar-style-tooltip' ),
include: [ 'bold', 'italic', 'moreTextStyle' ]
},
{
name: 'link',
include: [ 'link' ]
}
// Mention?
];
CommentTarget.static.importRules = ve.copy( CommentTarget.static.importRules );
CommentTarget.static.importRules.external.conversions = ve.extendObject(
{},
CommentTarget.static.importRules.external.conversions,
{
mwHeading: 'paragraph'
}
);
CommentTarget.static.importRules.external.blacklist = ve.extendObject(
{},
CommentTarget.static.importRules.external.blacklist,
{
// Annotations
// Allow pasting external links
'link/mwExternal': false,
// Strip all table structure
mwTable: true,
tableSection: true,
tableRow: true,
tableCell: true
}
);
CommentTarget.prototype.attachToolbar = function () {
this.$element.parent().parent().prepend( this.getToolbar().$element );
};
/* Registration */
ve.init.mw.targetFactory.register( CommentTarget );
module.exports = CommentTarget;