Skip to content

Commit

Permalink
fix(editor): event listener in save unmount
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Mar 20, 2022
1 parent c491fe1 commit b5aebbf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/better-write-app/src/use/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { useEntity } from '@/use/entity'
import { useEnv } from '@/use/env'
import { useProject } from '@/use/project'
import { useLocalStorage } from '@/use/storage/local'
import { useFullscreen } from '@vueuse/core'
import { useEventListener, useFullscreen } from '@vueuse/core'
import { useHead } from '@vueuse/head'
import { usePlugin } from 'better-write-plugin-core'
import { computed, onBeforeUnmount, onMounted } from 'vue'
import { computed, onMounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { onBeforeRouteLeave } from 'vue-router'
import { useListener } from './listener'
Expand All @@ -34,8 +34,8 @@ export const useEditor = () => {
await local.onSaveProject()
})

onBeforeUnmount(async () => {
await local.onSaveProject()
useEventListener('beforeunload', () => {
local.onSaveProject()
})

listener.keyboard().add()
Expand Down

0 comments on commit b5aebbf

Please sign in to comment.