notebookbar: correctly add and remove callbacks
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com> Change-Id: Ia798e12f06372e839ef8565d4c32626a44b44658
This commit is contained in:
parent
76540bed81
commit
be1184eef1
2 changed files with 2 additions and 1 deletions
|
@ -38,6 +38,7 @@ L.Control.Notebookbar = L.Control.extend({
|
|||
this._RTL = true;
|
||||
|
||||
this.builder = new L.control.notebookbarBuilder({windowId: -2, mobileWizard: this, map: map, cssClass: 'notebookbar', useSetTabs: true});
|
||||
this.map.on('commandstatechanged', this.builder.onCommandStateChanged, this.builder);
|
||||
|
||||
// remove old toolbar
|
||||
var toolbar = L.DomUtil.get('toolbar-up');
|
||||
|
@ -106,6 +107,7 @@ L.Control.Notebookbar = L.Control.extend({
|
|||
onRemove: function() {
|
||||
clearTimeout(this.retry);
|
||||
this.resetInCore();
|
||||
this.map.off('commandstatechanged', this.builder.onCommandStateChanged, this.builder);
|
||||
this.map.off('contextchange', this.onContextChange, this);
|
||||
this.map.off('updatepermission', this.onUpdatePermission, this);
|
||||
this.map.off('notebookbar');
|
||||
|
|
|
@ -803,6 +803,5 @@ L.control.notebookbarBuilder = function (options) {
|
|||
builder._setup(options);
|
||||
builder._overrideHandlers();
|
||||
builder._customizeOptions();
|
||||
options.map.on('commandstatechanged', builder.onCommandStateChanged, builder);
|
||||
return builder;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue