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:
authortomneedham <tom@owncloud.com>2014-02-18 12:37:01 +0400
committertomneedham <tom@owncloud.com>2014-02-18 12:37:01 +0400
commit5c57a92e4ca67acb89cd397744392c9077e6d73b (patch)
treef9ddcc4b54e043d84db4a01c6935edae2537d366 /js
parentf90357a9d314753b3d8734fbde78bf234736ada6 (diff)
Transfer diff from apps repo commit 0efd5be
Diffstat (limited to 'js')
-rw-r--r--js/editor.js23
1 files changed, 15 insertions, 8 deletions
diff --git a/js/editor.js b/js/editor.js
index 30d331d..5c9a74d 100644
--- a/js/editor.js
+++ b/js/editor.js
@@ -136,6 +136,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
@@ -153,18 +155,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');
}
}
@@ -235,8 +240,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
@@ -400,4 +407,4 @@ $(document).ready(function () {
OC.Notification.hide();
}
});
-});
+}); \ No newline at end of file