Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function _handleGenerateInclude() {
var editor = EditorManager.getFocusedEditor() || EditorManager.getCurrentFullEditor();
var parser = _getParserForContext(editor);
var fonts = parser.parseCurrentEditor(false);
var fontFamilies = [], allFvds = [];
var i, j, f;
var includeString = "";
for (i = 0; i < fonts.length; i++) {
f = webfont.getFontBySlug(fonts[i]);
if (f) {
allFvds = [];
for (j = 0; j < f.variations.length; j++) {
allFvds.push(f.variations[j].fvd);
}
fontFamilies.push({slug: f.slug, fvds: allFvds, subset: "all"});
}
}
if (fontFamilies.length === 0) { // no EWF in this css file
_showHowtoDialog();
} else {
includeString = webfont.createInclude(fontFamilies);
var dlg = Dialogs.showModalDialogUsingTemplate(ewfIncludeDialogTemplate);
$('.instance .ewf-include-string').html(_.escape(includeString)).focus().select();
}
slugs.forEach(function (slug) {
var font = webfont.getFontBySlug(slug),
script;
if (!(scriptCache.hasOwnProperty(slug)) && window.navigator.onLine) {
script = webfont.createInclude([font]);
$(script).appendTo("head");
scriptCache[slug] = true;
}
});