mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +00:00
Visual: Use createModelFromDom when setting document
Ensures that MW target sets the correct dir and lang on the document. We should consider upstreaming this. Bug: T253258 Change-Id: Ibc9ae7b4b105055291c941ce932f499bd6e13657
This commit is contained in:
parent
d0dd4cf036
commit
ade5f7cb6c
|
@ -53,10 +53,12 @@ CommentTargetWidget.prototype.createTarget = function () {
|
|||
* @inheritdoc
|
||||
*/
|
||||
CommentTargetWidget.prototype.setDocument = function ( docOrHtml ) {
|
||||
docOrHtml = typeof docOrHtml === 'string' ? this.target.parseDocument( docOrHtml ) : docOrHtml;
|
||||
var doc = typeof docOrHtml === 'string' ? this.target.parseDocument( docOrHtml ) : docOrHtml,
|
||||
// TODO: This could be upstreamed:
|
||||
dmDoc = this.target.constructor.static.createModelFromDom( doc, this.target.getDefaultMode() );
|
||||
|
||||
// Parent method
|
||||
CommentTargetWidget.super.prototype.setDocument.call( this, docOrHtml );
|
||||
CommentTargetWidget.super.prototype.setDocument.call( this, dmDoc );
|
||||
|
||||
// Remove MW specific classes as the widget is already inside the content area
|
||||
this.getSurface().getView().$element.removeClass( 'mw-body-content' );
|
||||
|
|
Loading…
Reference in a new issue