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

Henry Castro hcastro at collabora.com
Tue Apr 11 10:46:41 UTC 2017


 loleaflet/src/layer/marker/Annotation.js |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit a64704ab00becf3886c2c28888ee4c2ccd389a81
Author: Henry Castro <hcastro at collabora.com>
Date:   Mon Apr 10 20:52:41 2017 -0400

    loleaflet: save comment if exists changes
    
    Change-Id: Ided5cc2f60ae14863e6462e400735e291f1b54a5
    (cherry picked from commit 4db4ecd6803ba66ea5172d952db83eb2f6a50ebc)

diff --git a/loleaflet/src/layer/marker/Annotation.js b/loleaflet/src/layer/marker/Annotation.js
index a1630a4a..a1f22f60 100644
--- a/loleaflet/src/layer/marker/Annotation.js
+++ b/loleaflet/src/layer/marker/Annotation.js
@@ -116,6 +116,7 @@ L.Annotation = L.Layer.extend({
 		var button = L.DomUtil.create('input', 'loleaflet-controls', container);
 		button.type = 'button';
 		button.value = value;
+		L.DomEvent.on(button, 'mousedown', L.DomEvent.preventDefault);
 		L.DomEvent.on(button, 'click', handler, this);
 	},
 
@@ -172,7 +173,7 @@ L.Annotation = L.Layer.extend({
 		this._nodeReplyText = L.DomUtil.create(tagTextArea, classTextArea, this._nodeReply);
 
 		buttons = L.DomUtil.create(tagDiv, empty, this._nodeModify);
-		L.DomEvent.on(this._nodeModifyText, 'blur', this._onSaveComment, this);
+		L.DomEvent.on(this._nodeModifyText, 'blur', this._onLostFocus, this);
 		this._createButton(buttons, _(' Save '), this._onSaveComment);
 		this._createButton(buttons, cancel, this._onCancelClick);
 		buttons = L.DomUtil.create(tagDiv, empty, this._nodeReply);
@@ -206,6 +207,12 @@ L.Annotation = L.Layer.extend({
 		this._map.fire('AnnotationSave', {annotation: this});
 	},
 
+	_onLostFocus: function (e) {
+		if (this._contentText.innerHTML !== this._nodeModifyText.value) {
+			this._onSaveComment(e);
+		}
+	},
+
 	_onMouseClick: function (e) {
 		var target = e.target || e.srcElement;
 		L.DomEvent.stopPropagation(e);


More information about the Libreoffice-commits mailing list