loleaflet: handle annotation reply for writer documents

Change-Id: Iff95919d6f413b025ddb386150f458b9ecf2ce88
This commit is contained in:
Henry Castro 2017-03-22 21:11:53 -04:00
parent e30bcdfcd8
commit 0107e0e0d9
3 changed files with 33 additions and 0 deletions

View file

@ -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') {

View file

@ -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) {

View file

@ -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);
},