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

Mihai Varga mihai.varga at collabora.com
Thu Jul 23 07:18:40 PDT 2015


 loleaflet/debug/document/document_simple_example.html |    1 -
 loleaflet/dist/leaflet.css                            |    4 ++--
 loleaflet/spec/tilebench.html                         |    1 -
 loleaflet/spec/tilebench/TileBenchSpec.js             |    2 +-
 loleaflet/src/layer/tile/TileLayer.js                 |    4 ++--
 loleaflet/src/map/Map.js                              |    5 ++++-
 6 files changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 75155481ac5e8f8427cae505595276a2e28cc0b2
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Thu Jul 23 17:17:56 2015 +0300

    loleaflet: dynamically create the clipboard div

diff --git a/loleaflet/debug/document/document_simple_example.html b/loleaflet/debug/document/document_simple_example.html
index a8c5a43..2df9c91 100644
--- a/loleaflet/debug/document/document_simple_example.html
+++ b/loleaflet/debug/document/document_simple_example.html
@@ -37,7 +37,6 @@
     <div id="parts-preview" style="overflow: hidden">
     </div>
     <div id="document-container" style="top:100px">
-        <div id="clipboard-container"><textarea id="clipboard"></textarea></div>
         <div id="map"></div>
         <div id="scroll-container">
             <div id="mock-document">
diff --git a/loleaflet/dist/leaflet.css b/loleaflet/dist/leaflet.css
index 5cac88f..d866d45 100644
--- a/loleaflet/dist/leaflet.css
+++ b/loleaflet/dist/leaflet.css
@@ -645,7 +645,7 @@ a.leaflet-control-buttons:hover {
   }
 }
 
-#clipboard-container {
+.clipboard-container {
 	position: fixed;
 	left: 0px;
 	top: 0px;
@@ -654,7 +654,7 @@ a.leaflet-control-buttons:hover {
 	z-index: 100;
 	opacity: 0;
 }
-#clipboard {
+.clipboard {
 	width: 1px;
 	height: 1px;
 	padding: 0px;
diff --git a/loleaflet/spec/tilebench.html b/loleaflet/spec/tilebench.html
index 7f3722b..c4eccc4 100644
--- a/loleaflet/spec/tilebench.html
+++ b/loleaflet/spec/tilebench.html
@@ -37,7 +37,6 @@
 	<script type="text/javascript" src="tilebench/TileBenchSpec.js"></script>
 
 	<div id="document-container" style="top:300px">
-		<div id="clipboard-container"><textarea id="clipboard"></textarea></div>
 		<div id="map"></div>
 		<div id="scroll-container">
 			<div id="mock-document">
diff --git a/loleaflet/spec/tilebench/TileBenchSpec.js b/loleaflet/spec/tilebench/TileBenchSpec.js
index 46963e5..13b5b64 100644
--- a/loleaflet/spec/tilebench/TileBenchSpec.js
+++ b/loleaflet/spec/tilebench/TileBenchSpec.js
@@ -27,7 +27,7 @@ describe('TileBench', function () {
 		var docLayer = new L.TileLayer('', {
 			doc: 'file:///home/mihai/Desktop/test_docs/eval.odt',
 			useSocket : true,
-			edit: true,
+			edit: false,
 			readOnly: false
 		});
 		map.addLayer(docLayer);
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 24246c9..45255f7 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -91,8 +91,6 @@ L.TileLayer = L.GridLayer.extend({
 			draggable: true
 		});
 		this._emptyTilesCount = 0;
-		this._textArea = L.DomUtil.get('clipboard');
-		this._textArea.focus();
 	},
 
 	_initDocument: function () {
@@ -112,6 +110,8 @@ L.TileLayer = L.GridLayer.extend({
 		this._map.on('copy', this._onCopy, this);
 		this._startMarker.on('drag dragend', this._onSelectionHandleDrag, this);
 		this._endMarker.on('drag dragend', this._onSelectionHandleDrag, this);
+		this._textArea = this._map._textArea;
+		this._textArea.focus();
 		if (this.options.edit && !this.options.readOnly) {
 			this._map.setPermission('edit');
 		}
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index d47c8d7..b2d2999 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -468,6 +468,9 @@ L.Map = L.Evented.extend({
 			throw new Error('Mock document div not found.');
 		}
 
+		var textAreaContainer = L.DomUtil.create('div', 'clipboard-container', container.parentElement);
+		this._textArea = L.DomUtil.create('textarea', 'clipboard', textAreaContainer);
+
 		container._leaflet = true;
 	},
 
@@ -585,7 +588,7 @@ L.Map = L.Evented.extend({
 
 		L.DomEvent[onOff](this._container, 'click dblclick mousedown mouseup ' +
 			'mouseover mouseout mousemove contextmenu keydown keypress keyup', this._handleDOMEvent, this);
-		L.DomEvent[onOff](L.DomUtil.get('clipboard'), 'copy keydown keypress keyup', this._handleDOMEvent, this);
+		L.DomEvent[onOff](this._textArea, 'copy keydown keypress keyup', this._handleDOMEvent, this);
 
 		if (this.options.trackResize) {
 			L.DomEvent[onOff](window, 'resize', this._onResize, this);


More information about the Libreoffice-commits mailing list