Skip to content

Commit

Permalink
Cleanup basic generic dropdown code
Browse files Browse the repository at this point in the history
  • Loading branch information
lookacat committed May 3, 2023
1 parent 6150809 commit 1efaeba
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
<template>
<oc-button
:id="`context-menu-trigger-generic`"
v-oc-tooltip="contextMenuLabel"
:aria-label="contextMenuLabel"
appearance="raw"
>
<oc-icon name="more-2" />
<oc-button id="context-menu-trigger-generic" appearance="raw">
<oc-drop
:ref="`context-menu-drop-ref-generic`"
:drop-id="`context-menu-drop-generic`"
:toggle="`#context-menu-trigger-generic`"
class="generic-dropdown"
drop-id="context-menu-drop-generic"
toggle="#context-menu-trigger-generic"
position="bottom-end"
mode="click"
close-on-click
Expand All @@ -23,16 +15,22 @@

<script lang="ts">
import { computed, defineComponent } from 'vue'
import { extractDomSelector } from 'web-client/src/helpers'
import { useGettext } from 'vue3-gettext'
export default defineComponent({
name: 'ContextMenuQuickAction',
props: {},
name: 'SpaceGenericContextMenu',
setup() {
const { $gettext } = useGettext()
const contextMenuLabel = computed(() => $gettext('Show context menu'))
return { contextMenuLabel }
}
})
</script>

<style lang="scss">
#context-menu-trigger-generic {
visibility: hidden;
width: 0;
height: 0;
}
</style>
19 changes: 6 additions & 13 deletions packages/web-app-files/src/views/spaces/GenericSpace.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<template>
<div class="oc-flex oc-width-1-1" :class="{ 'space-frontpage': isSpaceFrontpage }">
<!--<space-generic-context-menu ref="genericContextMenu" class="resource-table-btn-action-dropdown" />-->
<space-generic-context-menu
ref="genericContextMenu"
class="oc-position-fixed generic"
style="z-index: var(--oc-z-index-modal); top: 200px"
>
</space-generic-context-menu>
<space-generic-context-menu ref="genericContextMenu" />
<keyboard-actions :paginated-resources="paginatedResources" :space="space" />
<files-view-wrapper>
<app-bar
Expand Down Expand Up @@ -423,12 +417,11 @@ export default defineComponent({
const genericContextMenu = ref(null)
const showContextMenu = (event) => {
console.log(genericContextMenu.value.$el)
const instance = (document.getElementsByClassName('generic') as unknown)[0]
if (instance === undefined) {
return
}
displayPositionedDropdown(instance._tippy, event, genericContextMenu.value)
displayPositionedDropdown(
genericContextMenu.value.$el._tippy,
event,
genericContextMenu.value
)
}
return {
Expand Down

0 comments on commit 1efaeba

Please sign in to comment.