Skip to content

Commit

Permalink
Avoid using deprecated API on Brackets 32+ (but remain compatible wit…
Browse files Browse the repository at this point in the history
…h 31-

as well)
  • Loading branch information
peterflynn committed Oct 3, 2013
1 parent a726da6 commit b40b39b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,25 @@ define(function (require, exports, module) {
}
}

var isSVG;
if (FileUtils.getFileExtension) { // Sprint 32+
isSVG = function (fullPath) {
return FileUtils.getFileExtension(fullPath).toLowerCase() === "svg";
};
} else { // Sprint 31 & earlier
isSVG = function (fullPath) {
return FileUtils.getFilenameExtension(fullPath).toLowerCase() === ".svg";
};
}

/**
*/
function handleCurrentEditorChange() {
detachFromLastEditor();

var newEditor = EditorManager.getCurrentFullEditor();
if (newEditor) {
var ext = FileUtils.getFilenameExtension(newEditor.document.file.fullPath);
if (ext.toLowerCase() === ".svg") {
if (isSVG(newEditor.document.file.fullPath)) {
showSVGPanel(newEditor);
} else {
hideSVGPanel();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"title": "SVG Preview",
"homepage": "https://github.com/peterflynn/svg-preview",
"author": "Peter Flynn",
"version": "1.1.1",
"version": "1.1.2",
"engines": { "brackets": ">=0.14" },
"description": "Live preview SVG files in an inline panel while you edit them."
}

0 comments on commit b40b39b

Please sign in to comment.