[Libreoffice-commits] online.git: loleaflet/src

Pranav Kant pranavk at collabora.co.uk
Tue Apr 25 06:12:42 UTC 2017


 loleaflet/src/layer/marker/Annotation.js |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 7486f44ee1beada574906ae31a551b8c45af370e
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Tue Apr 25 11:40:12 2017 +0530

    loleaflet: Don't send linkified comment data back to core
    
    Only use the modified markup for representation to the user.
    
    Change-Id: I50a6ea4d7411a7d0a1662430f90201b00415ccbf

diff --git a/loleaflet/src/layer/marker/Annotation.js b/loleaflet/src/layer/marker/Annotation.js
index b3075ad6..4e34651e 100644
--- a/loleaflet/src/layer/marker/Annotation.js
+++ b/loleaflet/src/layer/marker/Annotation.js
@@ -212,20 +212,21 @@ L.Annotation = L.Layer.extend({
 
 	_onCancelClick: function (e) {
 		L.DomEvent.stopPropagation(e);
-		this._nodeModifyText.value = this._contentText.innerHTML;
+		this._nodeModifyText.value = this._contentText.origText;
 		this.show();
 		this._map.fire('AnnotationCancel', {annotation: this});
 	},
 
 	_onSaveComment: function (e) {
 		L.DomEvent.stopPropagation(e);
-		this._data.text = this._contentText.innerHTML = this._nodeModifyText.value;
+		this._data.text = this._nodeModifyText.value;
+		this._updateContent();
 		this.show();
 		this._map.fire('AnnotationSave', {annotation: this});
 	},
 
 	_onLostFocus: function (e) {
-		if (this._contentText.innerHTML !== this._nodeModifyText.value) {
+		if (this._contentText.origText !== this._nodeModifyText.value) {
 			this._onSaveComment(e);
 		}
 	},
@@ -276,7 +277,9 @@ L.Annotation = L.Layer.extend({
 			this._data.dateTime = new Date(this._data.dateTime.replace(/,.*/, 'Z'));
 		}
 		var linkedText = Autolinker.link(this._data.text);
-		this._contentText.innerHTML = this._nodeModifyText.innerHTML = linkedText;
+		this._contentText.innerHTML = linkedText;
+		// Original unlinked text
+		this._contentText.origText = this._nodeModifyText.innerHTML = this._data.text;
 		this._contentAuthor.innerHTML = this._data.author;
 		this._contentDate.innerHTML = this._data.dateTime.toDateString();
 		if (this._data.trackchange) {


More information about the Libreoffice-commits mailing list