loleaflet/debug/document/document_simple_example.html |    3 ++-
 loleaflet/reference.html                              |    8 ++++++++
 loleaflet/src/control/Control.ColumnHeader.js         |    1 -
 loleaflet/src/control/Control.Dialog.js               |    1 -
 loleaflet/src/control/Control.PartsPreview.js         |    1 -
 loleaflet/src/control/Control.RowHeader.js            |    1 -
 loleaflet/src/control/Control.Scroll.js               |    1 -
 loleaflet/src/control/Control.Tabs.js                 |    1 -
 loleaflet/src/control/Control.js                      |    9 ++++++---
 9 files changed, 16 insertions(+), 10 deletions(-)

New commits:
commit f789928419845145ebe334db0e3ad153ece8e8ac
Author: Mihai Varga <mihai.va...@collabora.com>
Date:   Wed Dec 16 19:50:59 2015 +0200

    loleaflet: specify the toolbar container + don't add empty controls

diff --git a/loleaflet/debug/document/document_simple_example.html 
b/loleaflet/debug/document/document_simple_example.html
index f42eb48..861b05f 100644
--- a/loleaflet/debug/document/document_simple_example.html
+++ b/loleaflet/debug/document/document_simple_example.html
@@ -77,7 +77,8 @@
             server: host,
             permission: permission,
             timestamp: timestamp,
-            documentContainer: 'document-container'
+            documentContainer: 'document-container',
+            toolbarContainer: 'toolbar'
         });
 
     ////// Controls /////
diff --git a/loleaflet/reference.html b/loleaflet/reference.html
index a151044..5409c99 100644
--- a/loleaflet/reference.html
+++ b/loleaflet/reference.html
@@ -1465,6 +1465,14 @@ unexpected behaviour.</h4>
                <td>An outer div, containing the map div, that is used 
internally for the creation of the toolbar.</td>
        </tr>
        <tr>
+               <td><code><b>toolbarContainer</b></code></td>
+               <td><code>String / DOM element</code></td>
+               <td><code><span class="literal">undefined</span></code></td>
+               <td>A div used by the default toolbar elements (bold, italic, 
search, etc.) in loleaflet. If you implement
+           your own toolbar and use controls that do not require a toolbar 
(like the dialog or scroll control) you
+          can ignore this.</td>
+       </tr>
+       <tr>
                <td><code><b>renderingOptions</b></code></td>
                <td><code>Object</code></td>
                <td><code><span class="literal">undefined</span></code></td>
diff --git a/loleaflet/src/control/Control.ColumnHeader.js 
b/loleaflet/src/control/Control.ColumnHeader.js
index f8a406a..fcd8064 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -6,7 +6,6 @@ L.Control.ColumnHeader = L.Control.extend({
        onAdd: function (map) {
                map.on('updatepermission', this._onUpdatePermission, this);
                this._initialized = false;
-               return document.createElement('div');
        },
 
        _initialize: function () {
diff --git a/loleaflet/src/control/Control.Dialog.js 
b/loleaflet/src/control/Control.Dialog.js
index bcd9024..4907107 100644
--- a/loleaflet/src/control/Control.Dialog.js
+++ b/loleaflet/src/control/Control.Dialog.js
@@ -7,7 +7,6 @@ L.Control.Dialog = L.Control.extend({
        onAdd: function (map) {
                map.on('error', this._onError, this);
                map.on('print', this._onPrint, this);
-               return document.createElement('div');
        },
 
        _onError: function (e) {
diff --git a/loleaflet/src/control/Control.PartsPreview.js 
b/loleaflet/src/control/Control.PartsPreview.js
index 30989e3..9630373 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -17,7 +17,6 @@ L.Control.PartsPreview = L.Control.extend({
                map.on('updateparts', this._updateDisabled, this);
                map.on('updatepart', this._updatePart, this);
                map.on('tilepreview', this._updatePreview, this);
-               return document.createElement('div');
        },
 
        _updateDisabled: function (e) {
diff --git a/loleaflet/src/control/Control.RowHeader.js 
b/loleaflet/src/control/Control.RowHeader.js
index 1484958..42f45fd 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -6,7 +6,6 @@ L.Control.RowHeader = L.Control.extend({
        onAdd: function (map) {
                map.on('updatepermission', this._onUpdatePermission, this);
                this._initialized = false;
-               return document.createElement('div');
        },
 
        _initialize: function () {
diff --git a/loleaflet/src/control/Control.Scroll.js 
b/loleaflet/src/control/Control.Scroll.js
index 5cde0c4..f251ca4 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -32,7 +32,6 @@ L.Control.Scroll = L.Control.extend({
                                alwaysTriggerOffsets: false
                        }
                });
-               return document.createElement('div');
        },
 
        _onScroll: function (e) {
diff --git a/loleaflet/src/control/Control.Tabs.js 
b/loleaflet/src/control/Control.Tabs.js
index 685ce4f..33df796 100644
--- a/loleaflet/src/control/Control.Tabs.js
+++ b/loleaflet/src/control/Control.Tabs.js
@@ -11,7 +11,6 @@ L.Control.Tabs = L.Control.extend({
                this._tabsCont = L.DomUtil.create('div', 'spreadsheet-tab', 
docContainer.parentElement);
 
                map.on('updateparts', this._updateDisabled, this);
-               return document.createElement('div');
        },
 
        _updateDisabled: function (e) {
diff --git a/loleaflet/src/control/Control.js b/loleaflet/src/control/Control.js
index fe6021c..aa7f9c1 100644
--- a/loleaflet/src/control/Control.js
+++ b/loleaflet/src/control/Control.js
@@ -87,12 +87,15 @@ L.Map.include({
        addControl: function (control) {
                control._map = this;
                var controlDiv = control.onAdd(this);
-               var controlContainer = L.DomUtil.get('toolbar');
-               controlContainer.appendChild(controlDiv);
+               var controlContainer = 
L.DomUtil.get(this.options.toolbarContainer);
                if (!this._controls) {
                        this._controls = [];
                }
-               this._controls.push({div: controlDiv});
+
+               if (controlContainer && controlDiv) {
+                       controlContainer.appendChild(controlDiv);
+                       this._controls.push({div: controlDiv});
+               }
                return this;
        },
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to