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

New commits:
commit 4db4ecd6803ba66ea5172d952db83eb2f6a50ebc
Author: Henry Castro <hcas...@collabora.com>
Date:   Mon Apr 10 20:52:41 2017 -0400

    loleaflet: save comment if exists changes
    
    Change-Id: Ided5cc2f60ae14863e6462e400735e291f1b54a5

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);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to