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

gokaysatir (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 28 08:19:32 UTC 2020


 loleaflet/src/control/Toolbar.js |   21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

New commits:
commit 5f34991930e2805be9b11634e032579aeab78a48
Author:     gokaysatir <gokaysatir at collabora.com>
AuthorDate: Wed Jul 29 18:00:44 2020 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Fri Aug 28 10:19:12 2020 +0200

    loleaflet: Hyperlink textbox focus & content.
    
    Change-Id: I08db18c98fc43861cc8783700b28cbeb6f9b5a74
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99710
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/101501
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index e873cf2b1..80c1d3bbd 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -596,7 +596,9 @@ L.Map.include({
 			text = this.hyperlinkUnderCursor.text;
 			link = this.hyperlinkUnderCursor.link;
 		} else if (this._clip && this._clip._selectionType == 'text') {
-			text = this.extractContent(this._clip._selectionContent);
+			if (map['stateChangeHandler'].getItemValue('.uno:Copy') === 'enabled') {
+				text = this.extractContent(this._clip._selectionContent);
+			}
 		} else if (this._docLayer._selectedTextContent) {
 			text = this.extractContent(this._docLayer._selectedTextContent);
 		}
@@ -605,8 +607,8 @@ L.Map.include({
 			contentClassName: 'hyperlink-dialog',
 			message: _('Insert hyperlink'),
 			input: [
-				_('Text') + '<input name="text" type="text" value="' + text + '"/>',
-				_('Link') + '<input name="link" type="text" value="' + link + '"/>'
+				_('Text') + '<input name="text" id="hyperlink-text-box" type="text" value="' + text + '"/>',
+				_('Link') + '<input name="link" id="hyperlink-link-box" type="text" value="' + link + '"/>'
 			].join(''),
 			buttons: [
 				$.extend({}, vex.dialog.buttons.YES, { text: _('OK') }),
@@ -627,6 +629,19 @@ L.Map.include({
 					map.sendUnoCommand('.uno:SetHyperlink', command);
 					map.focus();
 				}
+				else {
+					map.focus();
+				}
+			},
+			afterOpen: function() {
+				setTimeout(function() {
+					if (document.getElementById('hyperlink-text-box').value.trim() !== '') {
+						document.getElementById('hyperlink-link-box').focus();
+					}
+					else {
+						document.getElementById('hyperlink-text-box').focus();
+					}
+				}, 0);
 			}
 		});
 	}


More information about the Libreoffice-commits mailing list