[Libreoffice-commits] online.git: loleaflet/src

Henry Castro hcastro at collabora.com
Tue Nov 22 02:42:22 UTC 2016


 loleaflet/src/control/Control.CharacterMap.js |   42 +++++++++++++++++---------
 1 file changed, 28 insertions(+), 14 deletions(-)

New commits:
commit 1c1ecf20f64561ead3f10a7b36da1309d9cf5eaa
Author: Henry Castro <hcastro at collabora.com>
Date:   Mon Nov 21 22:43:21 2016 -0400

    loleaflet: add double click to insert the symbol

diff --git a/loleaflet/src/control/Control.CharacterMap.js b/loleaflet/src/control/Control.CharacterMap.js
index 52089e5..58f15e8 100644
--- a/loleaflet/src/control/Control.CharacterMap.js
+++ b/loleaflet/src/control/Control.CharacterMap.js
@@ -289,6 +289,7 @@ L.Control.CharacterMap = L.Control.extend({
 			td.innerHTML = '&#x' + start.toString(16);
 			td.data = start;
 			L.DomEvent.on(td, 'click', this._onSymbolClick, this);
+			L.DomEvent.on(td, 'dblclick', this._onSymbolDblClick, this);
 			start++;
 			it++;
 		}
@@ -425,20 +426,8 @@ L.Control.CharacterMap = L.Control.extend({
 	},
 
 	_onInsertClick: function (e) {
-		if (this._hexa.data) {
-			var command = {
-				Symbols: {
-					type: 'string',
-					value: String.fromCharCode(this._hexa.data)
-				},
-				FontName: {
-					type: 'string',
-					value: this._fontNames.options[this._fontNames.selectedIndex].value
-				}
-			};
-			this._map.sendUnoCommand('.uno:InsertSymbol', command);
-			this._onCloseClick(e);
-		}
+		this._sendSymbol();
+		this._onCloseClick(e);
 	},
 
 	_onRenderFontPreview: function (e) {
@@ -454,6 +443,31 @@ L.Control.CharacterMap = L.Control.extend({
 			' char=' + String.fromCharCode(this._hexa.data));
 	},
 
+	_onSymbolDblClick: function (e) {
+		var target = e.target || e.srcElement;
+		this._hexa.data = target.data;
+		this._sendSymbol();
+		setTimeout(L.bind(function () {
+			this._onCloseClick();
+		}, this), 0);
+	},
+
+	_sendSymbol: function () {
+		if (this._hexa.data) {
+			var command = {
+				Symbols: {
+					type: 'string',
+					value: String.fromCharCode(this._hexa.data)
+				},
+				FontName: {
+					type: 'string',
+					value: this._fontNames.options[this._fontNames.selectedIndex].value
+				}
+			};
+			this._map.sendUnoCommand('.uno:InsertSymbol', command);
+		}
+	},
+
 	_onUnicodeSubsetChange: function (e) {
 		this.fillCharacters(this._unicodeSubset.options[this._unicodeSubset.selectedIndex].tag);
 	}


More information about the Libreoffice-commits mailing list