Commit d4b65960 authored by Eduardo Sanz García's avatar Eduardo Sanz García Committed by Eduardo

Move RPC listener together with the rest of listeners

I moved a guest RPC listener with the rest of the listeners in the
`Sidebar#_setupGuestEvents` method. This helps to quickly see which
events from the `Guest` the `Sidebar` listens to.
parent 62f30d3f
......@@ -114,11 +114,9 @@ export default class Sidebar {
if (config.theme === 'clean') {
this.iframeContainer.classList.add('annotator-frame--theme-clean');
} else {
const bucketBar = new BucketBar(this.iframeContainer, guest, {
this.bucketBar = new BucketBar(this.iframeContainer, guest, {
contentContainer: guest.contentContainer(),
});
this._guestRPC.on('anchorsChanged', () => bucketBar.update());
this.bucketBar = bucketBar;
}
this.iframeContainer.appendChild(this.iframe);
......@@ -283,6 +281,12 @@ export default class Sidebar {
this._guestRPC.call('clearSelectionExceptIn', frameIdentifier);
}
);
// The listener will do nothing if the sidebar doesn't have a bucket bar
// (clean theme), but it is still actively listening.
this._guestRPC.on('anchorsChanged', () => {
this.bucketBar?.update();
});
}
_setupSidebarEvents() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment