Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/files_texteditor.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJan-Christoph Borchardt <hey@jancborchardt.net>2014-07-03 00:58:14 +0400
committerJan-Christoph Borchardt <hey@jancborchardt.net>2014-07-03 00:58:14 +0400
commite89c1f71de80efb1f741b054a4c49ced3a09c381 (patch)
tree5aef2ab95cf04a4ec6c74c9a092a034f4dab7834 /js
parent9d9cf1fd6a8d929d6b2191f8db1441a43acf97fe (diff)
parent724155b81d51c13c2dc5d9893e7ae49f5bd8e18e (diff)
Merge pull request #8 from owncloud/fix-1654-from-apps
Recognise file changes during the saving process
Diffstat (limited to 'js')
-rw-r--r--js/editor.js25
1 files changed, 17 insertions, 8 deletions
diff --git a/js/editor.js b/js/editor.js
index df40d47..85b47dc 100644
--- a/js/editor.js
+++ b/js/editor.js
@@ -138,6 +138,8 @@ function doFileSave() {
if (editorIsShown()) {
// Changed contents?
if ($('#editor').attr('data-edited') == 'true') {
+ $('#editor').attr('data-edited', 'false');
+ $('#editor').attr('data-saving', 'true');
// Get file path
var path = $('#editor').attr('data-dir') + '/' + $('#editor').attr('data-filename');
// Get original mtime
@@ -155,18 +157,21 @@ function doFileSave() {
$('#editor_save').text(t('files_texteditor', 'Save'));
$('#notification').html(t('files_texteditor', 'Failed to save file'));
$('#notification').fadeIn();
- $('#editor_save').live('click', doFileSave);
+ $('#editor').attr('data-edited', 'true');
+ $('#editor').attr('data-saving', 'false');
} else {
// Save OK
// Update mtime
$('#editor').attr('data-mtime', jsondata.data.mtime);
$('#editor_save').text(t('files_texteditor', 'Save'));
- $("#editor_save").live('click', doFileSave);
// Update titles
- $('#editor').attr('data-edited', 'false');
- $('.crumb.last a').text($('#editor').attr('data-filename'));
- document.title = $('#editor').attr('data-filename') + ' - ownCloud';
+ if($('#editor').attr('data-edited') != 'true') {
+ $('.crumb.last a').text($('#editor').attr('data-filename'));
+ document.title = $('#editor').attr('data-filename') + ' - ownCloud';
+ }
+ $('#editor').attr('data-saving', 'false');
}
+ $('#editor_save').live('click', doFileSave);
}, 'json');
}
}
@@ -237,8 +242,10 @@ function showFileEditor(dir, filename) {
window.aceEditor.getSession().on('change', function () {
if ($('#editor').attr('data-edited') != 'true') {
$('#editor').attr('data-edited', 'true');
- $('.crumb.last a').text($('.crumb.last a').text() + ' *');
- document.title = $('#editor').attr('data-filename') + ' * - ownCloud';
+ if($('#editor').attr('data-saving') != 'true') {
+ $('.crumb.last a').text($('.crumb.last a').text() + ' *');
+ document.title = $('#editor').attr('data-filename') + ' * - ownCloud';
+ }
}
});
// Add the ctrl+s event
@@ -250,7 +257,9 @@ function showFileEditor(dir, filename) {
sender: "editor"
},
exec: function () {
- doFileSave();
+ if(!$('#editor').attr('data-saving')){
+ doFileSave();
+ }
}
});
giveEditorFocus();