mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-28 18:21:50 +00:00
74560f216e
The footer was already laid out using flexbox and just required some CSS tweaks to enable wrapping. The header required some DOM changes, now also uses flexbox, and wraps in a similar manner. Bug: T259320 Change-Id: I6f6a86932a108037bf1d70f077c372654318be26
90 lines
2.1 KiB
JavaScript
90 lines
2.1 KiB
JavaScript
var
|
|
registries = require( './dt.ui.registries.js' );
|
|
|
|
/**
|
|
* 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' ]
|
|
},
|
|
{
|
|
name: 'other',
|
|
include: [ 'usernameCompletion' ]
|
|
}
|
|
];
|
|
|
|
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().children().first().prepend( this.getToolbar().$element );
|
|
};
|
|
|
|
CommentTarget.prototype.getSurfaceConfig = function ( config ) {
|
|
return CommentTarget.super.prototype.getSurfaceConfig.call( this, ve.extendObject( {
|
|
commandRegistry: registries.commandRegistry,
|
|
sequenceRegistry: registries.sequenceRegistry,
|
|
// eslint-disable-next-line no-jquery/no-global-selector
|
|
$overlayContainer: $( '#content' )
|
|
}, config ) );
|
|
};
|
|
|
|
/* Registration */
|
|
|
|
ve.init.mw.targetFactory.register( CommentTarget );
|
|
|
|
module.exports = CommentTarget;
|