Make texteditor fullscreen and add saving without closing action

This commit is contained in:
Johannes Zellner
2020-08-31 17:46:26 +02:00
parent b420d054ae
commit b2279c9acc
3 changed files with 57 additions and 24 deletions

View File

@@ -73,6 +73,7 @@ app.controller('FileManagerController', ['$scope', '$timeout', 'Client', functio
$scope.dropToBody = false;
$scope.sortAsc = true;
$scope.sortProperty = 'fileName';
$scope.view = 'fileTree';
$scope.owners = [
{ name: 'cloudron', value: 1000 },
@@ -443,7 +444,8 @@ app.controller('FileManagerController', ['$scope', '$timeout', 'Client', functio
// clear model if any
if ($scope.textEditor.editor && $scope.textEditor.editor.getModel()) $scope.textEditor.editor.setModel(null);
$('#textEditorModal').modal('show');
$scope.view = 'textEditor';
// document.getElementById('textEditorModal').style['display'] = 'flex';
var filePath = sanitize($scope.cwd + '/' + entry.fileName);
var language = getLanguage(entry.fileName);
@@ -465,7 +467,7 @@ app.controller('FileManagerController', ['$scope', '$timeout', 'Client', functio
});
},
submit: function () {
save: function (callback) {
$scope.textEditor.busy = true;
var newContent = $scope.textEditor.editor.getValue();
@@ -477,8 +479,18 @@ app.controller('FileManagerController', ['$scope', '$timeout', 'Client', functio
if (error) return Client.error(error);
$('#textEditorModal').modal('hide');
if (callback) callback();
});
},
saveAndClose: function () {
$scope.textEditor.save(function () {
$scope.textEditor.close();
});
},
close: function () {
$scope.view = 'fileTree';
}
};