Use OOUI for confirm dialog

Would be nice to do this for the goto line prompt,
but such a OO.ui.prompt doesn't exist yet.

Change-Id: I6b24e51b5b106ece80e265ff5417878f108619b7
This commit is contained in:
Ed Sanders 2016-12-09 13:50:28 +00:00
parent 1818ed4bea
commit 6042898fcf
2 changed files with 14 additions and 5 deletions

View file

@ -51,7 +51,8 @@
"mediawiki.api.options",
"user.options",
"mediawiki.cookie",
"jquery.textSelection"
"jquery.textSelection",
"oojs-ui-windows"
],
"messages": [
"codeeditor-next-annotation",

View file

@ -1,6 +1,6 @@
/* Ace syntax-highlighting code editor extension for wikiEditor */
/* global ace, confirm, prompt */
( function ( $, mw ) {
/* global ace */
( function ( $, mw, OO ) {
$.wikiEditor.modules.codeEditor = {
/**
* Core Requirements
@ -74,11 +74,19 @@
paste: returnFalse,
ready: returnFalse,
codeEditorSubmit: function () {
var form = this;
context.evt.codeEditorSync();
if ( hasErrorsOnSave ) {
hasErrorsOnSave = false;
return confirm( mw.msg( 'codeeditor-save-with-errors' ) );
OO.ui.confirm( mw.msg( 'codeeditor-save-with-errors' ) ).done( function ( confirmed ) {
if ( confirmed ) {
// Programmatic submit doesn't retrigger this event listener
form.submit();
}
} );
return false;
}
return true;
},
codeEditorSave: function () {
var i,
@ -839,4 +847,4 @@
}
};
}( jQuery, mediaWiki ) );
}( jQuery, mediaWiki, OO ) );