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

Commit cd86e0f

Browse files
committed
Merge pull request #7201 from SAPlayer/image-viewer-ico
Enable image viewer for .ico files
2 parents 7e3c330 + d19f266 commit cd86e0f

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/editor/ImageViewer.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ define(function (require, exports, module) {
3434
ProjectManager = require("project/ProjectManager"),
3535
Strings = require("strings"),
3636
StringUtils = require("utils/StringUtils"),
37-
FileSystem = require("filesystem/FileSystem");
37+
FileSystem = require("filesystem/FileSystem"),
38+
FileUtils = require("file/FileUtils");
3839

3940
var _naturalWidth = 0,
4041
_scale = 100,
@@ -312,7 +313,11 @@ define(function (require, exports, module) {
312313
$("#img-preview").on("load", function () {
313314
// add dimensions and size
314315
_naturalWidth = this.naturalWidth;
316+
var ext = FileUtils.getFileExtension(fullPath);
315317
var dimensionString = _naturalWidth + " × " + this.naturalHeight + " " + Strings.UNIT_PIXELS;
318+
if (ext === "ico") {
319+
dimensionString += " (" + Strings.IMAGE_VIEWER_LARGEST_ICON + ")";
320+
}
316321
// get image size
317322
var file = FileSystem.getFileForPath(fullPath);
318323
var minimumPixels = 20; // for showing crosshair cursor

src/language/languages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233

234234
"image": {
235235
"name": "Image",
236-
"fileExtensions": ["gif", "png", "jpe", "jpeg", "jpg"],
236+
"fileExtensions": ["gif", "png", "jpe", "jpeg", "jpg", "ico"],
237237
"isBinary": true
238238
},
239239

src/nls/root/strings.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,9 @@ define({
457457
"INLINE_EDITOR_NO_MATCHES" : "No matches available.",
458458
"CSS_QUICK_EDIT_NO_MATCHES" : "There are no existing CSS rules that match your selection.<br> Click \"New Rule\" to create one.",
459459
"CSS_QUICK_EDIT_NO_STYLESHEETS" : "There are no stylesheets in your project.<br>Create one to add CSS rules.",
460+
461+
// Custom Viewers
462+
"IMAGE_VIEWER_LARGEST_ICON" : "largest",
460463

461464
/**
462465
* Unit names

0 commit comments

Comments
 (0)