Переглянути джерело

bugfix: don’t preselect /resources/img dir in file manager. feature: scroll auto-selected element into view

Joscha Jaeger 10 роки тому
батько
коміт
95669a61e6
1 змінених файлів з 5 додано та 1 видалено
  1. 5 1
      src/allplatforms/classes/FileManagerWindow.js

+ 5 - 1
src/allplatforms/classes/FileManagerWindow.js

@@ -101,12 +101,14 @@ SC.loadPackage({ 'FileManagerWindow': {
             comment: 'I hold the path that was given to me to auto-select a file / directory.',
             transform: function(path) {
 
-                if ( path ) {
+                if ( path && path.indexOf('/resources/img/') == -1 ) {
                     var fullPath = path;
                     var fullPathArray = fullPath.split('/');
                         fullPathArray.pop();
                     var parentDirectory = fullPathArray.join('/');
                     this.do('listDirectory', { path: parentDirectory, selectPath: path });
+                } else {
+                    this.do('listDirectory', { path: '/' });
                 }
 
                 return path;
@@ -826,6 +828,8 @@ SC.loadPackage({ 'FileManagerWindow': {
                             }
                         	
                         	self.get('directoryListing').querySelector('[data-path="'+ arg.selectPath +'"]').classList.add('active');
+
+                            self.get('directoryListing').querySelector('[data-path="'+ arg.selectPath +'"]').scrollIntoView(false);
                         	
                         	self.set({ selectedType: self.get('directoryListing').querySelector('[data-path="'+ arg.selectPath +'"]').getAttribute('data-type') });
                         	self.set({ selectedName: self.get('directoryListing').querySelector('[data-path="'+ arg.selectPath +'"]').getAttribute('data-name') });