mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-28 10:11:45 +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
53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
var CommentTarget = require( './CommentTarget.js' );
|
|
|
|
/**
|
|
* DiscussionTools TargetWidget class
|
|
*
|
|
* @class
|
|
* @extends ve.ui.MWTargetWidget
|
|
*
|
|
* @constructor
|
|
* @param {Object} [config] Configuration options
|
|
*/
|
|
function CommentTargetWidget() {
|
|
// Parent constructor
|
|
CommentTargetWidget.super.apply( this, arguments );
|
|
|
|
// Initialization
|
|
this.$element.addClass( 'dt-ui-targetWidget' );
|
|
}
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( CommentTargetWidget, ve.ui.MWTargetWidget );
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
CommentTargetWidget.prototype.createTarget = function () {
|
|
return new CommentTarget( {
|
|
// A lot of places expect ve.init.target to exist...
|
|
register: true,
|
|
toolbarGroups: this.toolbarGroups,
|
|
inTargetWidget: true,
|
|
modes: this.modes,
|
|
defaultMode: this.defaultMode
|
|
} );
|
|
};
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
CommentTargetWidget.prototype.setDocument = function ( docOrHtml ) {
|
|
docOrHtml = typeof docOrHtml === 'string' ? this.target.parseDocument( docOrHtml ) : docOrHtml;
|
|
|
|
// Parent method
|
|
CommentTargetWidget.super.prototype.setDocument.call( this, docOrHtml );
|
|
|
|
// Remove MW specific classes as the widget is already inside the content area
|
|
this.getSurface().getView().$element.removeClass( 'mw-body-content' );
|
|
this.getSurface().$placeholder.removeClass( 'mw-body-content' );
|
|
};
|
|
|
|
module.exports = CommentTargetWidget;
|