Skip to content

Commit

Permalink
fix(editor): commands visible in top
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Nov 26, 2021
1 parent cb831dd commit a44228b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/components/editor/absolute/EditorCommands.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<div
ref="target"
v-motion
:initial="{ opacity: 0, y: 50 }"
:enter="{
Expand All @@ -11,6 +12,7 @@
},
}"
class="
relative
transform
duration-700
w-60
Expand All @@ -22,6 +24,7 @@
transition
shadow-2xl
"
:class="[visible ? '' : 'top-60']"
>
<EditorAbsoluteCommands
:title="t('editor.aside.commands.contents[0].title')"
Expand Down Expand Up @@ -250,9 +253,28 @@

<script setup lang="ts">
import { useEditorStore } from '@/store/editor'
import { useIntersectionObserver } from '@vueuse/core'
import { useI18n } from 'vue-i18n'
import { ref } from 'vue'
const EDITOR = useEditorStore()
const { t } = useI18n()
const target = ref<any>(null)
const visible = ref<boolean>(true)
const block = ref<boolean>(false)
useIntersectionObserver(
target,
([{ isIntersecting }]) => {
if (block.value) return
visible.value = isIntersecting
block.value = true
},
{
threshold: 1,
}
)
</script>
2 changes: 1 addition & 1 deletion src/components/editor/main/EditorBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
class="
flex flex-col
w-full
max-h-screen
min-h-editor
overflow-y-auto overflow-x-hidden
"
>
Expand Down

0 comments on commit a44228b

Please sign in to comment.