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

Henry Castro hcastro at collabora.com
Thu Mar 23 01:12:23 UTC 2017


 loleaflet/src/layer/AnnotationManager.js    |   23 +++++++++++++++++++++++
 loleaflet/src/layer/tile/TileLayer.js       |    6 ++++++
 loleaflet/src/layer/tile/WriterTileLayer.js |    4 ++++
 3 files changed, 33 insertions(+)

New commits:
commit 0107e0e0d9ebfa9a622a3aefc5541ad90485b154
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed Mar 22 21:11:53 2017 -0400

    loleaflet: handle annotation reply for writer documents
    
    Change-Id: Iff95919d6f413b025ddb386150f458b9ecf2ce88

diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index a21bf121..8933f6e5 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -14,6 +14,7 @@ L.AnnotationManager = L.Class.extend({
 		this._selected = {};
 		this._map.on('AnnotationCancel', this._onAnnotationCancel, this);
 		this._map.on('AnnotationClick', this._onAnnotationClick, this);
+		this._map.on('AnnotationReply', this._onAnnotationReply, this);
 		this._map.on('AnnotationSave', this._onAnnotationSave, this);
 	},
 
@@ -204,6 +205,12 @@ L.AnnotationManager = L.Class.extend({
 		annotation.focus();
 	},
 
+	reply: function (annotation) {
+		annotation.reply();
+		this.select(annotation);
+		annotation.focus();
+	},
+
 	remove: function (id) {
 		var comment = {
 			Id: {
@@ -301,6 +308,22 @@ L.AnnotationManager = L.Class.extend({
 		this.select(e.annotation);
 	},
 
+	_onAnnotationReply: function (e) {
+		var comment = {
+			Id: {
+				type: 'string',
+				value: e.annotation._data.id
+			},
+			Text: {
+				type: 'string',
+				value: e.annotation._data.reply
+			}
+		};
+		this._map.sendUnoCommand('.uno:ReplyComment', comment);
+		this.unselect();
+		this._map.focus();
+	},
+
 	_onAnnotationSave: function (e) {
 		var comment;
 		if (e.annotation._data.id === 'new') {
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 7c0d282f..89031dd6 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -184,6 +184,12 @@ L.TileLayer = L.GridLayer.extend({
 						that.onAnnotationModify.call(that, options.$trigger.get(0).annotation);
 					}
 				},
+				reply: {
+					name:_('Reply'),
+					callback: function (key, options) {
+						that.onAnnotationReply.call(that, options.$trigger.get(0).annotation);
+					}
+				},
 				remove: {
 					name: _('Remove'),
 					callback: function (key, options) {
diff --git a/loleaflet/src/layer/tile/WriterTileLayer.js b/loleaflet/src/layer/tile/WriterTileLayer.js
index 7be1d873..b13c6df1 100644
--- a/loleaflet/src/layer/tile/WriterTileLayer.js
+++ b/loleaflet/src/layer/tile/WriterTileLayer.js
@@ -28,6 +28,10 @@ L.WriterTileLayer = L.TileLayer.extend({
 		this._annotations.remove(id);
 	},
 
+	onAnnotationReply: function (annotation) {
+		this._annotations.reply(annotation);
+	},
+
 	onChangeAccept: function(id) {
 		this._annotations.acceptChange(id);
 	},


More information about the Libreoffice-commits mailing list