From a5a221b74e1409419df980ba9860ed1fc2c039a9 Mon Sep 17 00:00:00 2001 From: Alex Brausewetter Date: Sat, 25 Jul 2015 14:51:43 -0700 Subject: [PATCH] Open SVG files in image previewer by default SVG images were opened in the XML text editor by default. This change opens them in the image previewer instead. Assuming that most SVG images will be created and exported from graphics software like Adobe Illustrator or Inkscape, previewing the file content is the better default. Also changes the behaviour of `editors#register()` in that the latest registered editor is used with the highest instead of lowest priority. --- package.json | 1 + plugins/c9.ide.editors/editors.js | 4 ++-- plugins/c9.ide.editors/imgview.js | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 557c322c..7a9cc1a7 100644 --- a/package.json +++ b/package.json @@ -106,6 +106,7 @@ "c9.ide.run.build": "#ad45874c88", "c9.ide.run.debug.xdebug": "#3b1520f83d", "c9.ide.save": "#58b8616a88", + "c9.ide.scm": "#undefined", "c9.ide.terminal.monitor": "#b0b4d03280", "c9.ide.theme.flat": "#2de8414db7", "c9.ide.threewaymerge": "#229382aa0b", diff --git a/plugins/c9.ide.editors/editors.js b/plugins/c9.ide.editors/editors.js index cc082351..4068104d 100644 --- a/plugins/c9.ide.editors/editors.js +++ b/plugins/c9.ide.editors/editors.js @@ -91,7 +91,7 @@ define(function(require, module, exports) { extensions.forEach(function(ext) { // force lower-case, to account for other LowerCase checks below ext = ext.toLowerCase(); - (fileExtensions[ext] || (fileExtensions[ext] = [])).push(editor); + (fileExtensions[ext] || (fileExtensions[ext] = [])).unshift(editor); }); if (editor.type == options.defaultEditor) @@ -257,4 +257,4 @@ define(function(require, module, exports) { editors: plugin }); } -}); \ No newline at end of file +}); diff --git a/plugins/c9.ide.editors/imgview.js b/plugins/c9.ide.editors/imgview.js index c75f09ac..c3ffd614 100644 --- a/plugins/c9.ide.editors/imgview.js +++ b/plugins/c9.ide.editors/imgview.js @@ -12,7 +12,7 @@ define(function(require, exports, module) { /***** Initialization *****/ - var extensions = ["gif", "ico"]; + var extensions = ["gif", "ico", "svg"]; function ImageEditor(){ var plugin = new Editor("Ajax.org", main.consumes, extensions); @@ -135,4 +135,4 @@ define(function(require, exports, module) { ImageEditor, extensions) }); } -}); \ No newline at end of file +});