mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-12 09:09:25 +00:00
Hide wikitext warning notification when the user removes the markup
Bug: 51701 Change-Id: I2b24b91175768334c5111bf8e550be9c34c12f69
This commit is contained in:
parent
4c3da1b017
commit
9a38ccfe12
|
@ -657,13 +657,16 @@ ve.init.mw.ViewPageTarget.prototype.recordLastTransactionTime = function () {
|
|||
ve.init.mw.ViewPageTarget.prototype.checkForWikitextWarning = function () {
|
||||
var text, doc = this.surface.getView().getDocument(),
|
||||
selection = this.surface.getModel().getSelection(),
|
||||
node = doc.getNodeFromOffset( selection.start );
|
||||
node = doc.getNodeFromOffset( selection.start ),
|
||||
textMatches,
|
||||
viewPageTarget = this;
|
||||
if ( !( node instanceof ve.ce.ContentBranchNode ) ) {
|
||||
return;
|
||||
}
|
||||
text = ve.ce.getDomText( node.$element[0] );
|
||||
textMatches = text.match( /\[\[|\{\{|''|<nowiki|<ref|~~~|^==|^\*|^\#/ );
|
||||
|
||||
if ( text.match( /\[\[|\{\{|''|<nowiki|<ref|~~~|^==|^\*|^\#/ ) ) {
|
||||
if ( textMatches && !this.wikitextWarning ) {
|
||||
mw.notify(
|
||||
$( $.parseHTML( ve.init.platform.getParsedMessage( 'visualeditor-wikitext-warning' ) ) )
|
||||
.filter( 'a' ).attr( 'target', '_blank' ).end(),
|
||||
|
@ -672,10 +675,12 @@ ve.init.mw.ViewPageTarget.prototype.checkForWikitextWarning = function () {
|
|||
'tag': 'visualeditor-wikitext-warning',
|
||||
'autoHide': false
|
||||
}
|
||||
);
|
||||
this.surface.getModel().disconnect(
|
||||
this, { 'documentUpdate': 'checkForWikitextWarning' }
|
||||
);
|
||||
).done( function ( notif ) {
|
||||
viewPageTarget.wikitextWarning = notif;
|
||||
} );
|
||||
} else if ( !textMatches && this.wikitextWarning ) {
|
||||
this.wikitextWarning.close();
|
||||
this.wikitextWarning = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue