[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - loleaflet/dist

Jan Holesovsky kendy at collabora.com
Wed Nov 8 20:32:26 UTC 2017


 loleaflet/dist/toolbar/toolbar.js |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 72a7b95261fbfd3aeb7fcb87c3641bbd367187c7
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Nov 8 19:36:15 2017 +0100

    Save As: Don't save the document several times.
    
    Also don't perform the save as when the document name hasn't changed.
    
    Change-Id: I4fb7e0abd73996e90107b301a09b8703b66e80f9
    Reviewed-on: https://gerrit.libreoffice.org/44504
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 1e1a89f5..663a4937 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -776,7 +776,7 @@ function onSearchKeyPress(e) {
 
 function documentNameConfirm() {
 	var value = $('#document-name-input').val();
-	if (value !== null && value != '') {
+	if (value !== null && value != '' && value != map['wopi'].BaseFileName) {
 		map.saveAs(value);
 	}
 	map._onGotFocus();
@@ -795,6 +795,11 @@ function onDocumentNameKeyPress(e) {
 	}
 }
 
+function onDocumentNameFocus() {
+	// hide the caret in the main document
+	map._onLostFocus();
+}
+
 function sortFontSizes() {
 	var oldVal = $('.fontsizes-select').val();
 	var selectList = $('.fontsizes-select option');
@@ -992,9 +997,9 @@ map.on('wopiprops', function(e) {
 		// Save As allowed
 		$('#document-name-input').prop('disabled', false);
 		$('#document-name-input').addClass('editable');
-		$('#document-name-input').on('keypress', onDocumentNameKeyPress);
-		$('#document-name-input').on('focus', function() { map._onLostFocus(); /* hide the caret in the main document */ });
-		$('#document-name-input').on('blur', documentNameCancel);
+		$('#document-name-input').off('keypress', onDocumentNameKeyPress).on('keypress', onDocumentNameKeyPress);
+		$('#document-name-input').off('focus', onDocumentNameFocus).on('focus', onDocumentNameFocus);
+		$('#document-name-input').off('blur', documentNameCancel).on('blur', documentNameCancel);
 	} else {
 		$('#document-name-input').prop('disabled', true);
 		$('#document-name-input').removeClass('editable');


More information about the Libreoffice-commits mailing list