2019-11-05 14:07:50 +00:00
|
|
|
/**
|
|
|
|
* 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( {
|
2020-04-27 15:42:35 +00:00
|
|
|
toolbarConfig: { actions: true, $overlay: true, position: 'top' }
|
2019-11-05 14:07:50 +00:00
|
|
|
}, 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' ),
|
2020-04-27 15:42:35 +00:00
|
|
|
include: [ 'bold', 'italic', 'moreTextStyle' ]
|
2019-11-05 14:07:50 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'link',
|
|
|
|
include: [ 'link' ]
|
|
|
|
}
|
|
|
|
// Mention?
|
|
|
|
];
|
|
|
|
|
|
|
|
CommentTarget.static.importRules = ve.copy( CommentTarget.static.importRules );
|
2020-02-06 23:48:26 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
);
|
2019-11-05 14:07:50 +00:00
|
|
|
|
|
|
|
CommentTarget.prototype.attachToolbar = function () {
|
2020-04-27 15:42:35 +00:00
|
|
|
this.$element.parent().parent().prepend( this.getToolbar().$element );
|
2019-11-05 14:07:50 +00:00
|
|
|
};
|
|
|
|
|
2020-04-30 13:06:57 +00:00
|
|
|
CommentTarget.prototype.getSurfaceConfig = function ( config ) {
|
|
|
|
return CommentTarget.super.prototype.getSurfaceConfig.call( this, ve.extendObject( {
|
|
|
|
// eslint-disable-next-line no-jquery/no-global-selector
|
|
|
|
$overlayContainer: $( '#content' )
|
|
|
|
}, config ) );
|
|
|
|
};
|
|
|
|
|
2019-11-05 14:07:50 +00:00
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
ve.init.mw.targetFactory.register( CommentTarget );
|
|
|
|
|
|
|
|
module.exports = CommentTarget;
|