[Libreoffice-commits] online.git: 2 commits - loleaflet/css loleaflet/src
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jun 30 12:28:18 UTC 2020
loleaflet/css/notebookbar.css | 5 +
loleaflet/src/control/Control.Notebookbar.js | 29 +++++++++
loleaflet/src/control/Control.NotebookbarBuilder.js | 1
loleaflet/src/control/Control.UIManager.js | 60 ++++++++++++++++----
4 files changed, 83 insertions(+), 12 deletions(-)
New commits:
commit c623459822205d6034b061a9c9fc3eddca8c30d2
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Jun 29 16:35:00 2020 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Jun 30 14:28:11 2020 +0200
notebookbar: hidden in readonly mode
Change-Id: I2cfa4e7167f30cba252f53efea156f9e6afac98f
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97513
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/loleaflet/css/notebookbar.css b/loleaflet/css/notebookbar.css
index 12cb1af64..db4444adb 100644
--- a/loleaflet/css/notebookbar.css
+++ b/loleaflet/css/notebookbar.css
@@ -121,6 +121,11 @@ div[id*='Row'].notebookbar, div[id*='Column'].notebookbar, #SendToBack.notebookb
display: none;
}
+/* comboboxes in readonly mode on mobile devices */
+.notebookbar-scroll-wrapper .select2-container {
+ z-index: auto !important;
+}
+
/* Writer */
/* Home tab */
diff --git a/loleaflet/src/control/Control.Notebookbar.js b/loleaflet/src/control/Control.Notebookbar.js
index 71b801fca..aeebbe693 100644
--- a/loleaflet/src/control/Control.Notebookbar.js
+++ b/loleaflet/src/control/Control.Notebookbar.js
@@ -7,6 +7,7 @@
L.Control.Notebookbar = L.Control.extend({
_currentScrollPosition: 0,
+ _showNotebookbar: false,
onAdd: function (map) {
this.map = map;
@@ -19,12 +20,37 @@ L.Control.Notebookbar = L.Control.extend({
this.map.on('contextchange', this.onContextChange, this);
this.map.on('notebookbar', this.onNotebookbar, this);
+ this.map.on('updatepermission', this.onUpdatePermission, this);
+ },
+
+ onRemove: function() {
+ this.map.off('contextchange', this.onContextChange, this);
+ this.map.off('updatepermission', this.onUpdatePermission, this);
+ this.map.off('notebookbar');
+ this.clearNotebookbar();
+ },
+
+ onUpdatePermission: function(e) {
+ if (e.perm === 'edit') {
+ this._showNotebookbar = true;
+ this.showTabs();
+ }
},
onNotebookbar: function(data) {
this.loadTab(data);
},
+ showTabs: function() {
+ $('.ui-tabs.notebookbar').show();
+ $('.notebookbar-shortcuts-bar').show();
+ },
+
+ hideTabs: function() {
+ $('.ui-tabs.notebookbar').hide();
+ $('.notebookbar-shortcuts-bar').hide();
+ },
+
clearNotebookbar: function() {
$('.root-container.notebookbar').remove();
$('.ui-tabs.notebookbar').remove();
@@ -40,6 +66,9 @@ L.Control.Notebookbar = L.Control.extend({
builder.build(container, [tabJSON]);
+ if (this._showNotebookbar === false)
+ this.hideTabs();
+
this.scrollToLastPositionIfNeeded();
},
diff --git a/loleaflet/src/control/Control.UIManager.js b/loleaflet/src/control/Control.UIManager.js
index e8ae9ea4a..bf08bfa87 100644
--- a/loleaflet/src/control/Control.UIManager.js
+++ b/loleaflet/src/control/Control.UIManager.js
@@ -8,6 +8,7 @@
L.Control.UIManager = L.Control.extend({
onAdd: function (map) {
this.map = map;
+ this.notebookbar = null;
map.on('updatepermission', this.onUpdatePermission, this);
},
@@ -70,22 +71,17 @@ L.Control.UIManager = L.Control.extend({
this.map.addControl(L.control.searchBar());
} else if (enableNotebookbar) {
if (docType === 'spreadsheet') {
- this.map.addControl(L.control.notebookbarCalc());
+ var notebookbar = L.control.notebookbarCalc();
} else if (docType === 'presentation') {
- this.map.addControl(L.control.notebookbarImpress());
+ notebookbar = L.control.notebookbarImpress();
} else {
- this.map.addControl(L.control.notebookbarWriter());
+ notebookbar = L.control.notebookbarWriter();
}
- var additionalOffset = 0;
- if (docType === 'spreadsheet') {
- additionalOffset = 56;
- }
+ this.notebookbar = notebookbar;
+ this.map.addControl(notebookbar);
- this.moveObjectVertically($('#spreadsheet-row-column-frame'), 121);
- this.moveObjectVertically($('#document-container'), 84 + additionalOffset);
- this.moveObjectVertically($('#presentation-controls-wrapper'), 84);
- this.moveObjectVertically($('#sidebar-dock-wrapper'), 43);
+ // makeSpaceForNotebookbar call in onUpdatePermission
}
if (docType === 'spreadsheet') {
@@ -176,6 +172,32 @@ L.Control.UIManager = L.Control.extend({
return $('.loleaflet-ruler').is(':visible');
},
+ // Notebookbar helpers
+
+ hasNotebookbarShown: function() {
+ return $('#map').hasClass('notebookbar-opened');
+ },
+
+ makeSpaceForNotebookbar: function(docType) {
+ if (this.hasNotebookbarShown())
+ return;
+
+ var additionalOffset = 0;
+ if (docType === 'spreadsheet') {
+ if (window.mode.isTablet())
+ additionalOffset = -7;
+ else
+ additionalOffset = 53;
+ }
+
+ this.moveObjectVertically($('#spreadsheet-row-column-frame'), 36);
+ this.moveObjectVertically($('#document-container'), 43 + additionalOffset);
+ this.moveObjectVertically($('#presentation-controls-wrapper'), 43);
+ this.moveObjectVertically($('#sidebar-dock-wrapper'), 43);
+
+ $('#map').addClass('notebookbar-opened');
+ },
+
// Event handlers
onUpdatePermission: function(e) {
@@ -188,6 +210,22 @@ L.Control.UIManager = L.Control.extend({
}
}
+ var enableNotebookbar = window.userInterfaceMode === 'notebookbar';
+ if (enableNotebookbar) {
+ if (e.perm === 'edit') {
+ this.makeSpaceForNotebookbar(this.map._docLayer._docType);
+ } else if (e.perm === 'readonly' && $('#mobile-edit-button').is(':hidden')) {
+ var menubar = L.control.menubar();
+ this.map.menubar = menubar;
+ this.map.addControl(menubar);
+
+ if (this.notebookbar) {
+ this.map.removeControl(this.notebookbar);
+ this.notebookbar = null;
+ }
+ }
+ }
+
// We've resized the document container.
this.map.invalidateSize();
},
commit 8e18e60bf7b6ccbc2ad49bd21cf6b4760e98354f
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Jun 29 15:26:40 2020 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Jun 30 14:27:59 2020 +0200
remove unnecesary debug print
Change-Id: I89ced212050e2f4f79c8782539c56f6b15a89480
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97512
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/loleaflet/src/control/Control.NotebookbarBuilder.js b/loleaflet/src/control/Control.NotebookbarBuilder.js
index 306baaf3d..3c01a12aa 100644
--- a/loleaflet/src/control/Control.NotebookbarBuilder.js
+++ b/loleaflet/src/control/Control.NotebookbarBuilder.js
@@ -210,7 +210,6 @@ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({
var selected = parseInt(data.selectedEntries[0]) == index;
processedData.push({id: index, text: value, selected: selected});
});
- console.log(processedData);
$(select).select2({
data: processedData,
More information about the Libreoffice-commits
mailing list