notebookbar: reinitialize only once

Change-Id: Ie931a5d443505fe5d60637cb4a6f24c1a22fbfa4
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
This commit is contained in:
Szymon Kłos 2021-04-13 09:42:25 +02:00 committed by Szymon Kłos
parent d3c9e07ff3
commit 77821e49ed

View file

@ -58,9 +58,7 @@ L.Control.Notebookbar = L.Control.extend({
var retryNotebookbarInit = function() {
if (!that.map._isNotebookbarLoadedOnCore) {
console.error('notebookbar is not initialized, retrying');
that.map.sendUnoCommand('.uno:Notebookbar?File:string=notebookbar.ui');
that.map.sendUnoCommand('.uno:ToolbarMode?Mode:string=notebookbar.ui');
that.retry = setTimeout(retryNotebookbarInit, 10000);
that.map.sendUnoCommand('.uno:ToolbarMode?Mode:string=notebookbar_online.ui');
}
};
@ -69,6 +67,7 @@ L.Control.Notebookbar = L.Control.extend({
onRemove: function() {
clearTimeout(this.retry);
this.map.sendUnoCommand('.uno:ToolbarMode?Mode:string=Default');
this.map.off('contextchange', this.onContextChange, this);
this.map.off('updatepermission', this.onUpdatePermission, this);
this.map.off('notebookbar');