diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2021-06-21 16:26:38 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2021-06-21 16:35:40 +0300 |
commit | 6ee8c945bb0ebc8f6cad8038f868452345157b85 (patch) | |
tree | 6750aa4a42d6b1984f3f701a4a4949ce310077fe /src/main.js | |
parent | 22b01cd5fdbc695e9a13301cc25c0129954f0ed2 (diff) |
Emit sidebar events on Nextcloud bus
The viewer expect the "files:sidebar:opened" and "files:sidebar:closed"
events to be emitted on Nextcloud bus to adjust its width based on the
sidebar.
Both events could be emitted by directly listening to AppSidebar events
on RightSidebar. However, for now only the "closed" event is listened;
the "opened" event does not seem to work reliably (it seems that
sometimes it is emitted before the sidebar has finished opening, so the
viewer ends overlapping the sidebar due to getting its width when it is
not fully opened), so for now the custom detection of when the sidebar
has finished opening is still used.
In Talk the sidebar events are currently needed only by the viewer, and
when the viewer is opened the sidebar will be opened only by the viewer
through "OCA.Talk.Sidebar.open()", so not emitting the sidebar events
directly on the RightSidebar component should not be a problem.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'src/main.js')
-rw-r--r-- | src/main.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.js b/src/main.js index 4748e0a0c..218d9ab79 100644 --- a/src/main.js +++ b/src/main.js @@ -37,6 +37,7 @@ import router from './router/router' // Utils import { generateFilePath } from '@nextcloud/router' import { getRequestToken } from '@nextcloud/auth' +import { emit } from '@nextcloud/event-bus' // Directives import VueClipboard from 'vue-clipboard2' @@ -121,6 +122,8 @@ const waitForSidebarToBeOpen = function(sidebarElement, resolve) { sidebarElement.removeEventListener('transitionend', resolveOnceSidebarWidthHasChanged) + emit('files:sidebar:opened') + resolve() } @@ -133,6 +136,8 @@ const waitForSidebarToBeOpen = function(sidebarElement, resolve) { setTimeout(() => { console.debug('ontransitionend is not supported; the sidebar should have been fully shown by now') + emit('files:sidebar:opened') + resolve() }, Number.parseInt(animationQuickValue) + 200) } @@ -141,6 +146,8 @@ const waitForSidebarToBeOpen = function(sidebarElement, resolve) { Sidebar.prototype.open = function(path) { // The sidebar is already open, so this can return immediately. if (this.state.file) { + emit('files:sidebar:opened') + return } |