|
|
|
@ -1,3 +1,4 @@ |
|
|
|
|
/* global FileReader */ |
|
|
|
|
var async = require('async') |
|
|
|
|
var $ = require('jquery') |
|
|
|
|
var yo = require('yo-yo') |
|
|
|
@ -143,7 +144,30 @@ function filepanel (appAPI, filesProvider) { |
|
|
|
|
// the files module. Please ask the user here if they want to overwrite
|
|
|
|
|
// a file and then just use `files.add`. The file explorer will
|
|
|
|
|
// pick that up via the 'fileAdded' event from the files module.
|
|
|
|
|
;[...this.files].forEach(fileExplorer.api.addFile) |
|
|
|
|
|
|
|
|
|
;[...this.files].forEach((file) => { |
|
|
|
|
var files = fileExplorer.files |
|
|
|
|
function loadFile () { |
|
|
|
|
var fileReader = new FileReader() |
|
|
|
|
fileReader.onload = function (event) { |
|
|
|
|
if (helper.checkSpecialChars(file.name)) { |
|
|
|
|
modalDialogCustom.alert('Special characters are not allowed') |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
var success = files.set(name, event.target.result) |
|
|
|
|
if (!success) modalDialogCustom.alert('Failed to create file ' + name) |
|
|
|
|
else self.events.trigger('focus', [name]) |
|
|
|
|
} |
|
|
|
|
fileReader.readAsText(file) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var name = files.type + '/' + file.name |
|
|
|
|
if (!files.exists(name)) { |
|
|
|
|
loadFile() |
|
|
|
|
} else { |
|
|
|
|
modalDialogCustom.confirm(null, `The file ${name} already exists! Would you like to overwrite it?`, () => { loadFile() }) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ----------------- resizeable ui ---------------
|
|
|
|
|