loleaflet/css/notebookbar.css | 4 ++++ loleaflet/src/control/Control.JSDialogBuilder.js | 13 +++++++++++++ loleaflet/src/layer/tile/TileLayer.js | 1 + loleaflet/src/map/Map.js | 2 ++ 4 files changed, 20 insertions(+)
New commits: commit ad4f53aa4df4bc855dbfda105e001a440dbdbd78 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Fri Jul 31 13:06:46 2020 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Fri Jul 31 14:16:58 2020 +0200 notebookar: show tabs depending on context If tab is marked with context, show it only in that context. Exception: tab with 'default' is shown always Change-Id: Id3ae82cc9188c0e5050d5e78629ce4dea98049c4 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99864 Tested-by: Jenkins Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/loleaflet/css/notebookbar.css b/loleaflet/css/notebookbar.css index 69fa813ac..07d494bed 100644 --- a/loleaflet/css/notebookbar.css +++ b/loleaflet/css/notebookbar.css @@ -20,6 +20,10 @@ padding-top: 7px; } +.ui-tab.hidden.notebookbar { + display: none; +} + .ui-tab.selected.notebookbar { border: none; border-radius: 0px; diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js index 3a99fef0d..d3b1fe202 100644 --- a/loleaflet/src/control/Control.JSDialogBuilder.js +++ b/loleaflet/src/control/Control.JSDialogBuilder.js @@ -683,8 +683,21 @@ L.Control.JSDialogBuilder = L.Control.extend({ var tab = L.DomUtil.create('div', 'ui-tab ' + builder.options.cssClass, tabsContainer); tab.id = data.tabs[tabIdx].name; tab.number = data.tabs[tabIdx].id - 1; + if (data.selected == data.tabs[tabIdx].id) $(tab).addClass('selected'); + + var tabContext = data.tabs[tabIdx].context; + if (tabContext) { + var tabHasCurrentContext = builder.map.context.context !== '' + && tabContext.indexOf(builder.map.context.context) !== -1; + var tabHasDefultContext = tabContext.indexOf('default') !== -1; + + if (!tabHasCurrentContext && !tabHasDefultContext) { + $(tab).addClass('hidden'); + } + } + tabs[tabIdx] = tab; tabIds[tabIdx] = tab.id; diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index 54e640ca9..e0f1b8d37 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -732,6 +732,7 @@ L.TileLayer = L.GridLayer.extend({ var message = textMsg.substring('context:'.length + 1); message = message.split(' '); if (message.length > 1) { + this._map.context = {context: message[1]}; this._map.fire('contextchange', {context: message[1]}); } } diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js index bc5776aaa..ac6c6da9b 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -51,6 +51,8 @@ L.Map = L.Evented.extend({ // Control.LokDialog instance, is set in Control.UIManager.js dialog: null, + context: {context: ''}, + lastActiveTime: Date.now(), initialize: function (id, options) { // (HTMLElement or String, Object) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits