Permalink
Browse files

fixed image edit

  • Loading branch information...
1 parent 6fb6c51 commit c70c6710b41f90e18d5dede03573c740ec26f91f @pizzapanther committed Oct 7, 2011
Showing with 15 additions and 5 deletions.
  1. +1 −1 neutron/ide/static/ide/js/default.js
  2. +14 −4 neutron/static/ide/js/default.js
@@ -223,7 +223,7 @@ window.onbeforeunload = function() {
return 'Are you sure you wish to leave this page?';
}
-var canon = require('pilot/canon')
+var canon = require('pilot/canon');
canon.addCommand({
name: 'SaveFile',
@@ -178,10 +178,20 @@ function uploadFile(id, onComplete) {
xhr.send(fd);
}
-function file_browser () {
- $('#file_browser > div.inner').fileTree({ root: '', script: '/filetree/', expandSpeed: 200, collapseSpeed: 200 }, function(file) {
+function get_file (file) {
+ var img_patt = /\.(jpg|jpeg|png|bmp|pxd)$/i;
+
+ if (img_patt.test(file)) {
+ window.open('/external_open' + encodeURI(file), '_blank');
+ }
+
+ else {
$.post('/fileget/', {f: file}, create_tab);
- });
+ }
+}
+
+function file_browser () {
+ $('#file_browser > div.inner').fileTree({ root: '', script: '/filetree/', expandSpeed: 200, collapseSpeed: 200 }, get_file);
}
$(document).ready( function() {
@@ -213,7 +223,7 @@ window.onbeforeunload = function() {
return 'Are you sure you wish to leave this page?';
}
-var canon = require('pilot/canon')
+var canon = require('pilot/canon');
canon.addCommand({
name: 'SaveFile',

0 comments on commit c70c671

Please sign in to comment.