Created
July 13, 2014 14:35
-
-
Save sbruchmann/acc2e8bfc68e93c06115 to your computer and use it in GitHub Desktop.
Working with modal dialogs in Brackets extensions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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