[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2' - loleaflet/src

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 14 11:48:42 UTC 2020


 loleaflet/src/control/Control.LokDialog.js |   14 ++++++++++++++
 loleaflet/src/control/Toolbar.js           |   10 +++-------
 2 files changed, 17 insertions(+), 7 deletions(-)

New commits:
commit c93a1caf3d8afd5d158bf6a71515e119fee47088
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Aug 12 15:49:43 2020 +0200
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Aug 14 13:48:22 2020 +0200

    Make dialogs modal, block sidebar actions when opened
    
    This change prevents user from creating multiple instances
    of dialogs eg. by using sidebar. Dialogs are modal now.
    Child dialogs still can be created from existing dialog and used.
    
    Change-Id: I388006d8857d0196d2884598e150f7bf5948ed47
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100598
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index b69c0e446..57b5fdc95 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -144,6 +144,14 @@ L.Control.LokDialog = L.Control.extend({
 		return Object.keys(this._dialogs).length > nonDialogEntries;
 	},
 
+	// method used to warn user about dialog modality
+	blinkOpenDialog: function() {
+		$('.lokdialog_container').addClass('lokblink');
+		setTimeout(function () {
+			$('.lokdialog_container').removeClass('lokblink');
+		}, 600);
+	},
+
 	_docLoaded: function(e) {
 		if (!e.status) {
 			$('.lokdialog_container').remove();
@@ -1159,6 +1167,12 @@ L.Control.LokDialog = L.Control.extend({
 
 		L.DomEvent.on(canvas, 'mousedown mouseup', function(e) {
 			L.DomEvent.stop(e);
+
+			if ((this._isSidebar(id) || this.isCalcInputBar(id)) && this.hasOpenedDialog()) {
+				this.blinkOpenDialog();
+				return;
+			}
+
 			if (this._isSelectionHandleDragged() && e.type === 'mouseup') {
 				this._onSelectionHandleDrag(e);
 				return;
diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index 4bf98dc0e..e873cf2b1 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -170,13 +170,9 @@ L.Map.include({
 	sendUnoCommand: function (command, json) {
 		var isAllowedInReadOnly = command == '.uno:WordCountDialog';
 
-		var hasOpenedDialog = this.dialog.hasOpenedDialog();
-		if (hasOpenedDialog) {
-			$('.lokdialog_container').addClass('lokblink');
-			setTimeout(function () {
-				$('.lokdialog_container').removeClass('lokblink');
-			}, 600);
-		} else if (this.isPermissionEdit() || isAllowedInReadOnly) {
+		if (this.dialog.hasOpenedDialog())
+			this.dialog.blinkOpenDialog();
+		else if (this.isPermissionEdit() || isAllowedInReadOnly) {
 			if (!this.messageNeedsToBeRedirected(command))
 				this._socket.sendMessage('uno ' + command + (json ? ' ' + JSON.stringify(json) : ''));
 		}


More information about the Libreoffice-commits mailing list