Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
Merge pull request #136 from TomMalbran/tom/issue-133
Browse files Browse the repository at this point in the history
Fix #133: Modal dialogs are broken on Brackets sprint 26
  • Loading branch information
iwehrman committed May 31, 2013
2 parents e75929a + a586221 commit 5662c39
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions main.js
Expand Up @@ -78,7 +78,16 @@ define(function (require, exports, module) {
var showBrowseWebFontsRegExp = /^["\'\s,]$/;
var scriptCache = {};
var closeHintOnNextKey = false;


// Rendered templates
var ewfBrowseDialogTemplate = Mustache.render(ewfBrowseDialogHtml, Strings);
var ewfIncludeDialogTemplate = Mustache.render(ewfIncludeDialogHtml, Strings);
var ewfHowtoDialogTemplate = Mustache.render(ewfHowtoDialogHtml, {Strings : Strings, Paths : Paths});

// work around a URL jQuery URL escaping issue
var howtoDiagramURL = Mustache.render("{{{Paths.ROOT}}}{{{Strings.HOWTO_DIAGRAM_IMAGE}}}", {Strings : Strings, Paths : Paths}),
howtoDiagramHiDPIURL = Mustache.render("{{{Paths.ROOT}}}{{{Strings.HOWTO_DIAGRAM_IMAGE_HIDPI}}}", {Strings : Strings, Paths : Paths});


function _supportedLanguage(language) {
var name = language.getName();
Expand Down Expand Up @@ -207,7 +216,9 @@ define(function (require, exports, module) {
}

function _showHowtoDialog() {
Dialogs.showModalDialog("edge-web-fonts-howto-dialog");
Dialogs.showModalDialogUsingTemplate(ewfHowtoDialogTemplate);

$(".edge-web-fonts-howto-diagram").css("background-image", "-webkit-image-set(url('" + howtoDiagramURL + "') 1x, url('" + howtoDiagramHiDPIURL + "') 2x)");
}

/**
Expand Down Expand Up @@ -430,7 +441,7 @@ define(function (require, exports, module) {
$(webfont).off("ewfFontChosen");
}

Dialogs.showModalDialog("edge-web-fonts-browse-dialog").done(function (id) {
var dlg = Dialogs.showModalDialogUsingTemplate(ewfBrowseDialogTemplate).done(function (id) {
if (id === Dialogs.DIALOG_BTN_OK) {
handleFontChosen();
}
Expand All @@ -439,7 +450,7 @@ define(function (require, exports, module) {
webfont.renderPicker($('.edge-web-fonts-browse-dialog.instance'));

$(webfont).on("ewfFontChosen", function () {
Dialogs.cancelModalDialogIfOpen("edge-web-fonts-browse-dialog");
dlg.close();
handleFontChosen();
editor.focus();
});
Expand Down Expand Up @@ -476,7 +487,7 @@ define(function (require, exports, module) {
_showHowtoDialog();
} else {
includeString = webfont.createInclude(fontFamilies);
Dialogs.showModalDialog("edge-web-fonts-include-dialog");
Dialogs.showModalDialogUsingTemplate(ewfIncludeDialogTemplate);
$('.instance .ewf-include-string').html(StringUtils.htmlEscape(includeString)).focus().select();
}
}
Expand All @@ -499,19 +510,6 @@ define(function (require, exports, module) {
menu.addMenuItem(Menus.DIVIDER, null, Menus.BEFORE, COMMAND_BROWSE_FONTS);
*/

// add dialogs to dom
$("body")
.append($(Mustache.render(ewfBrowseDialogHtml, Strings)))
.append($(Mustache.render(ewfIncludeDialogHtml, Strings)))
.append($(Mustache.render(ewfHowtoDialogHtml, {Strings : Strings, Paths : Paths})));

// work around a URL jQuery URL escaping issue
var howtoDiagramURL = Mustache.render("{{{Paths.ROOT}}}{{{Strings.HOWTO_DIAGRAM_IMAGE}}}", {Strings : Strings, Paths : Paths}),
howtoDiagramHiDPIURL = Mustache.render("{{{Paths.ROOT}}}{{{Strings.HOWTO_DIAGRAM_IMAGE_HIDPI}}}", {Strings : Strings, Paths : Paths});

$(".edge-web-fonts-howto-diagram").css("background-image", "-webkit-image-set(url('" + howtoDiagramURL + "') 1x, url('" + howtoDiagramHiDPIURL + "') 2x)");

// add handler to listen to selection in browse dialog
$(webfont).on("ewfFontSelected", function (event, slug) {
lastFontSelected = slug;
});
Expand Down

0 comments on commit 5662c39

Please sign in to comment.