loleaflet/src/layer/AnnotationManager.js        |   11 +++++++---
 loleaflet/src/layer/AnnotationManagerImpress.js |   10 ++++++---
 loleaflet/src/layer/marker/Annotation.js        |   25 +++++++++++++++---------
 loleaflet/src/layer/tile/TileLayer.js           |    7 ++++--
 4 files changed, 36 insertions(+), 17 deletions(-)

New commits:
commit 245f797ac984c01cda85c508c44844586e9d694d
Author:     Pranam Lashkari <lpra...@collabora.com>
AuthorDate: Fri Sep 11 08:20:29 2020 +0530
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Tue Sep 15 15:48:44 2020 +0200

    leaflet: annotation: use vex dialogs for annotation reply
    
    Change-Id: I171c5712fcae54b4c1c6e2a8be7dd12bd6765f0a
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102412
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/loleaflet/src/layer/AnnotationManager.js 
b/loleaflet/src/layer/AnnotationManager.js
index 11224fd2a..e5ad6b498 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -626,9 +626,14 @@ L.AnnotationManager = L.AnnotationManagerBase.extend({
        },
 
        reply: function (annotation) {
-               annotation.reply();
-               this.select(annotation);
-               annotation.focus();
+               if (window.mode.isMobile() || window.mode.isTablet()) {
+                       this._doclayer.newAnnotationVex(annotation, 
annotation._onReplyClick,/* isMod */ true, '');
+               }
+               else {
+                       annotation.reply();
+                       this.select(annotation);
+                       annotation.focus();
+               }
        },
 
        resolve: function (annotation) {
diff --git a/loleaflet/src/layer/AnnotationManagerImpress.js 
b/loleaflet/src/layer/AnnotationManagerImpress.js
index 542f0572b..815021e9f 100644
--- a/loleaflet/src/layer/AnnotationManagerImpress.js
+++ b/loleaflet/src/layer/AnnotationManagerImpress.js
@@ -129,9 +129,13 @@ L.AnnotationManagerImpress = 
L.AnnotationManagerBase.extend({
        onAnnotationReply: function (annotation) {
                this.onAnnotationCancel();
                this._selectedAnnotation = annotation._data.id;
-               annotation.reply();
-               this.scrollUntilAnnotationIsVisible(annotation);
-               annotation.focus();
+               if (window.mode.isMobile() || window.mode.isTablet()) {
+                       this._doclayer.newAnnotationVex(annotation, 
annotation._onReplyClick,/* isMod */ true, '');
+               } else {
+                       annotation.reply();
+                       this.scrollUntilAnnotationIsVisible(annotation);
+                       annotation.focus();
+               }
        },
        onAnnotationRemove: function (id) {
                this.onAnnotationCancel();
diff --git a/loleaflet/src/layer/marker/Annotation.js 
b/loleaflet/src/layer/marker/Annotation.js
index bf1ca54d3..dc4f94633 100644
--- a/loleaflet/src/layer/marker/Annotation.js
+++ b/loleaflet/src/layer/marker/Annotation.js
@@ -361,14 +361,21 @@ L.Annotation = L.Layer.extend({
 
        _onReplyClick: function (e) {
                L.DomEvent.stopPropagation(e);
-               this._data.reply = this._nodeReplyText.value;
-               // Assigning an empty string to .innerHTML property in some 
browsers will convert it to 'null'
-               // While in browsers like Chrome and Firefox, a null value is 
automatically converted to ''
-               // Better to assign '' here instead of null to keep the 
behavior same for all
-               this._nodeReplyText.value = '';
-               this.show();
-               this._checkBounds();
-               this._map.fire('AnnotationReply', {annotation: this});
+               if (window.mode.isMobile() || window.mode.isTablet()) {
+                       e.annotation._data.reply = e.annotation.text;
+                       e.annotation.show();
+                       e.annotation._checkBounds();
+                       this._map.fire('AnnotationReply', {annotation: 
e.annotation});
+               } else {
+                       this._data.reply = this._nodeReplyText.value;
+                       // Assigning an empty string to .innerHTML property in 
some browsers will convert it to 'null'
+                       // While in browsers like Chrome and Firefox, a null 
value is automatically converted to ''
+                       // Better to assign '' here instead of null to keep the 
behavior same for all
+                       this._nodeReplyText.value = '';
+                       this.show();
+                       this._checkBounds();
+                       this._map.fire('AnnotationReply', {annotation: this});
+               }
        },
 
        _onResolveClick: function (e) {
@@ -466,7 +473,7 @@ L.Annotation = L.Layer.extend({
 
        _updateAnnotationMarker: function () {
                // Make sure to place the markers only for presentations and 
draw documents
-               if (this._map._docLayer._docType !== 'presentation') 
+               if (this._map._docLayer._docType !== 'presentation')
                        return;
                if (this._data == null)
                        return;
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index f2c0f5f15..bdd3f3486 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -381,7 +381,7 @@ L.TileLayer = L.GridLayer.extend({
                return newEvent;
        },
 
-       newAnnotationVex: function(comment, addCommentFn, isMod) {
+       newAnnotationVex: function(comment, addCommentFn, isMod, 
displayContent) {
                var that = this;
 
                var commentData = null;
@@ -392,7 +392,10 @@ L.TileLayer = L.GridLayer.extend({
                } else {
                        // Modification
                        commentData = comment._data;
-                       content = commentData.text;
+                       if (displayContent === undefined)
+                               content = commentData.text;
+                       else
+                               content = displayContent;
                }
 
                var dialog = vex.dialog.open({
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to