mirror of
https://github.com/xevidos/codiad.git
synced 2024-12-22 22:02:15 +01:00
Fixed spelling mistake in filemanager, Updated active file save for new promise return value, Started drag and drop upload on filemanager
This commit is contained in:
parent
cefb309df1
commit
57f39ec8bf
2 changed files with 79 additions and 13 deletions
|
@ -500,11 +500,11 @@
|
||||||
.getSession();
|
.getSession();
|
||||||
var content = session.getValue();
|
var content = session.getValue();
|
||||||
var path = session.path;
|
var path = session.path;
|
||||||
var handleSuccess = function( mtime ) {
|
var handleSuccess = function( result ) {
|
||||||
var session = codiad.active.sessions[path];
|
var session = codiad.active.sessions[path];
|
||||||
if( typeof session != 'undefined' ) {
|
if( typeof session != 'undefined' ) {
|
||||||
session.untainted = newContent;
|
session.untainted = newContent;
|
||||||
session.serverMTime = mtime;
|
session.serverMTime = result.data.mtime;
|
||||||
if( session.listThumb ) session.listThumb.removeClass( 'changed' );
|
if( session.listThumb ) session.listThumb.removeClass( 'changed' );
|
||||||
if( session.tabThumb ) session.tabThumb.removeClass( 'changed' );
|
if( session.tabThumb ) session.tabThumb.removeClass( 'changed' );
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
clipboard: '',
|
clipboard: '',
|
||||||
controller: 'components/filemanager/controller.php',
|
controller: 'components/filemanager/controller.php',
|
||||||
dialog: 'components/filemanager/dialog.php',
|
dialog: 'components/filemanager/dialog.php',
|
||||||
file_previewlist: {
|
file_preview_list: {
|
||||||
|
|
||||||
audio: [
|
audio: [
|
||||||
'aac',
|
'aac',
|
||||||
|
@ -65,6 +65,11 @@
|
||||||
|
|
||||||
$( drop ).removeClass( "drag_over" );
|
$( drop ).removeClass( "drag_over" );
|
||||||
|
|
||||||
|
if( ! $( drop ).attr( "data-path" ) ) {
|
||||||
|
|
||||||
|
drop = $( drop ).children( 'a' );
|
||||||
|
}
|
||||||
|
|
||||||
console.log( drop );
|
console.log( drop );
|
||||||
console.log( drag );
|
console.log( drag );
|
||||||
|
|
||||||
|
@ -144,8 +149,42 @@
|
||||||
connections and a more stable upload for slower connections.
|
connections and a more stable upload for slower connections.
|
||||||
*/
|
*/
|
||||||
_this.calculate_upload_variables();
|
_this.calculate_upload_variables();
|
||||||
|
|
||||||
_this.node_listeners();
|
_this.node_listeners();
|
||||||
|
|
||||||
|
$( document ).on( 'dragenter', function( e ) {
|
||||||
|
|
||||||
|
console.log( e );
|
||||||
|
console.log( e.originalEvent.dataTransfer );
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$( document ).on( 'drag dragstart dragend dragover dragenter dragleave drop', function( e ) {
|
||||||
|
|
||||||
|
//e.preventDefault();
|
||||||
|
//e.stopPropagation();
|
||||||
|
console.log( 'drag dragstart dragend dragover dragenter dragleave drop', e );
|
||||||
|
console.log( e.originalEvent.dataTransfer );
|
||||||
|
})
|
||||||
|
.on( 'dragover dragenter', function( e ) {
|
||||||
|
|
||||||
|
console.log( 'dragover dragenter', e );
|
||||||
|
console.log( e.originalEvent.dataTransfer );
|
||||||
|
})
|
||||||
|
.on( 'dragleave dragend drop', function( e ) {
|
||||||
|
|
||||||
|
//$( '.drop-overlay' ).css( 'display', 'none' );
|
||||||
|
console.log( 'dragleave dragend drop', e );
|
||||||
|
console.log( e.originalEvent.dataTransfer );
|
||||||
|
})
|
||||||
|
.on( 'drop', function( e ) {
|
||||||
|
|
||||||
|
//e.preventDefault();
|
||||||
|
//e.stopPropagation();
|
||||||
|
//codiad.filemanager.upload_drop( e );
|
||||||
|
console.log( 'drop', e );
|
||||||
|
console.log( e.originalEvent.dataTransfer );
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
archive: function( path ) {
|
archive: function( path ) {
|
||||||
|
@ -491,7 +530,10 @@
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if( files[i].children !== undefined ) {
|
if( files[i].children !== undefined && files[i].children !== null ) {
|
||||||
|
|
||||||
|
console.log( path );
|
||||||
|
console.log( files[i] );
|
||||||
|
|
||||||
index = await _this.get_index( path, files[i].children );
|
index = await _this.get_index( path, files[i].children );
|
||||||
|
|
||||||
|
@ -598,6 +640,16 @@
|
||||||
let parentNode = node.parent();
|
let parentNode = node.parent();
|
||||||
let span = node.prev();
|
let span = node.prev();
|
||||||
|
|
||||||
|
if( node.attr( 'data-type' ) == "root" ) {
|
||||||
|
|
||||||
|
node.droppable({
|
||||||
|
accept: _this.node.accept,
|
||||||
|
drop: _this.node.drop,
|
||||||
|
over: _this.node.over,
|
||||||
|
out: _this.node.out
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if( ! callbacks.directory ) {
|
if( ! callbacks.directory ) {
|
||||||
|
|
||||||
callbacks.directory = [_this.index_directory_callback];
|
callbacks.directory = [_this.index_directory_callback];
|
||||||
|
@ -668,7 +720,10 @@
|
||||||
accept: _this.node.accept,
|
accept: _this.node.accept,
|
||||||
drop: _this.node.drop,
|
drop: _this.node.drop,
|
||||||
over: _this.node.over,
|
over: _this.node.over,
|
||||||
out: _this.node.out
|
out: _this.node.out,
|
||||||
|
|
||||||
|
start: _this.node.start,
|
||||||
|
stop: _this.node.stop,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -680,7 +735,7 @@
|
||||||
revert: true,
|
revert: true,
|
||||||
start: _this.node.start,
|
start: _this.node.start,
|
||||||
stop: _this.node.stop,
|
stop: _this.node.stop,
|
||||||
zIndex: 100
|
zIndex: 100,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -868,8 +923,16 @@
|
||||||
let _this = codiad.filemanager;
|
let _this = codiad.filemanager;
|
||||||
let node = $( '#file-manager a[data-path="' + path + '"]' );
|
let node = $( '#file-manager a[data-path="' + path + '"]' );
|
||||||
let ext = _this.get_extension( path );
|
let ext = _this.get_extension( path );
|
||||||
|
let preview = [];
|
||||||
|
|
||||||
if( $.inArray( ext.toLowerCase(), _this.noOpen ) < 0 ) {
|
$.each( _this.file_preview_list, function( id, value ) {
|
||||||
|
|
||||||
|
preview.concat( value );
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log( ext, preview );
|
||||||
|
|
||||||
|
if( $.inArray( ext.toLowerCase(), preview ) < 0 ) {
|
||||||
|
|
||||||
node.addClass( 'loading' );
|
node.addClass( 'loading' );
|
||||||
$.get( _this.controller + '?action=open&path=' + encodeURIComponent( path ), function( data ) {
|
$.get( _this.controller + '?action=open&path=' + encodeURIComponent( path ), function( data ) {
|
||||||
|
@ -885,7 +948,10 @@
|
||||||
|
|
||||||
if( ! codiad.project.isAbsPath( path ) ) {
|
if( ! codiad.project.isAbsPath( path ) ) {
|
||||||
|
|
||||||
if( $.inArray( ext.toLowerCase(), _this.noBrowser ) < 0 ) {
|
let download = [];
|
||||||
|
download.concat( files );
|
||||||
|
|
||||||
|
if( $.inArray( ext.toLowerCase(), download ) < 0 ) {
|
||||||
|
|
||||||
_this.download( path );
|
_this.download( path );
|
||||||
} else {
|
} else {
|
||||||
|
@ -969,10 +1035,10 @@
|
||||||
let type = "";
|
let type = "";
|
||||||
let ext = this.getExtension( path ).toLowerCase();
|
let ext = this.getExtension( path ).toLowerCase();
|
||||||
|
|
||||||
if( this.file_previewlist.images.includes( ext ) ) {
|
if( this.file_preview_list.images.includes( ext ) ) {
|
||||||
|
|
||||||
type = 'music_preview';
|
type = 'music_preview';
|
||||||
} else if( this.file_previewlist.images.includes( ext ) ) {
|
} else if( this.file_preview_list.images.includes( ext ) ) {
|
||||||
|
|
||||||
type = 'preview';
|
type = 'preview';
|
||||||
}
|
}
|
||||||
|
@ -1296,7 +1362,7 @@
|
||||||
|
|
||||||
codiad.message.success( i18n( 'File saved' ) );
|
codiad.message.success( i18n( 'File saved' ) );
|
||||||
}
|
}
|
||||||
resolve( data );
|
resolve( r );
|
||||||
} else if( r.message == 'Client is out of sync' ) {
|
} else if( r.message == 'Client is out of sync' ) {
|
||||||
|
|
||||||
let reload = confirm(
|
let reload = confirm(
|
||||||
|
@ -1316,7 +1382,7 @@
|
||||||
session.serverMTime = null;
|
session.serverMTime = null;
|
||||||
session.untainted = null;
|
session.untainted = null;
|
||||||
}
|
}
|
||||||
resolve( data );
|
resolve( r );
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
codiad.message.error( i18n( r.message ) );
|
codiad.message.error( i18n( r.message ) );
|
||||||
|
|
Loading…
Reference in a new issue