Skip to content

Instantly share code, notes, and snippets.

@sbruchmann
Created July 13, 2014 14:35
Show Gist options
  • Save sbruchmann/acc2e8bfc68e93c06115 to your computer and use it in GitHub Desktop.
Save sbruchmann/acc2e8bfc68e93c06115 to your computer and use it in GitHub Desktop.
Working with modal dialogs in Brackets extensions
define(function (require) {
"use strict";
var AppInit = brackets.getModule("utils/AppInit");
var DefaultDialogs = brackets.getModule("widgets/DefaultDialogs");
var Dialogs = brackets.getModule("widgets/Dialogs");
AppInit.appReady(function _onAppReady() {
var myDialog = Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_INFO,
"My Dialog Title",
"My dialog text.",
[
{
className: Dialogs.DIALOG_BTN_CLASS_NORMAL,
id: "cancel",
text: "Cancel"
},
{
className: Dialogs.DIALOG_BTN_CLASS_PRIMARY,
id: "save-as",
text: "Save as…"
}
]
);
myDialog.getPromise().then(function (buttonId) {
if (buttonId === "save-as") {
alert("Saving as");
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment