[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2' - loleaflet/src
Pranam Lashkari (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 15 13:49:22 UTC 2020
loleaflet/src/layer/AnnotationManager.js | 11 ++++++++---
loleaflet/src/layer/marker/Annotation.js | 23 +++++++++++++++--------
loleaflet/src/layer/tile/ImpressTileLayer.js | 10 +++++++---
loleaflet/src/layer/tile/TileLayer.js | 7 +++++--
4 files changed, 35 insertions(+), 16 deletions(-)
New commits:
commit d89fc4147f23e7031d5b58f4f533187a0dc22600
Author: Pranam Lashkari <lpranam at collabora.com>
AuthorDate: Fri Sep 11 08:53:19 2020 +0530
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Sep 15 15:49:03 2020 +0200
leaflet: annotation: use vex dialogs for annotation reply
Change-Id: I171c5712fcae54b4c1c6e2a8be7dd12bd6765f0a
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102413
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index 59d7ce867..d5d9f2264 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -627,9 +627,14 @@ L.AnnotationManager = L.Class.extend({
},
reply: function (annotation) {
- annotation.reply();
- this.select(annotation);
- annotation.focus();
+ if (window.mode.isMobile() || window.mode.isTablet()) {
+ this._map._docLayer.newAnnotationVex(annotation, annotation._onReplyClick,/* isMod */ true, '');
+ }
+ else {
+ annotation.reply();
+ this.select(annotation);
+ annotation.focus();
+ }
},
resolve: function (annotation) {
diff --git a/loleaflet/src/layer/marker/Annotation.js b/loleaflet/src/layer/marker/Annotation.js
index 2d1986ef6..b5c7f3069 100644
--- a/loleaflet/src/layer/marker/Annotation.js
+++ b/loleaflet/src/layer/marker/Annotation.js
@@ -343,14 +343,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) {
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js b/loleaflet/src/layer/tile/ImpressTileLayer.js
index 9f9a3389f..22a310bc5 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -161,9 +161,13 @@ L.ImpressTileLayer = L.TileLayer.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._map._docLayer.newAnnotationVex(annotation, annotation._onReplyClick,/* isMod */ true, '');
+ } else {
+ annotation.reply();
+ this.scrollUntilAnnotationIsVisible(annotation);
+ annotation.focus();
+ }
},
onAnnotationRemove: function (id) {
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 79b936ada..b5e4c0740 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({
More information about the Libreoffice-commits
mailing list