Skip to content

Commit

Permalink
chore: input event
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Sep 24, 2021
1 parent 5742513 commit 6774a35
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/components/editor/text/TextInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
@mouseout="hover = false"
>
<input
id="main-input-define"
ref="input"
v-model="cmp"
class="flex-1 rounded-none border-none shadow-2xl p-1"
Expand All @@ -30,7 +31,7 @@
import { useEntity } from '@/use/entity'
import { useFormat } from '@/use/format'
import { useInput } from '@/use/input'
import { ref, computed, watch } from 'vue'
import { ref, computed, watch, onMounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { useStore } from 'vuex'
Expand All @@ -48,6 +49,10 @@
const input = ref(null as any)
const paste = ref<boolean>(false)
onMounted(() => {
useInput().prevent(input.value)
})
const cmp = computed({
get() {
return props.modelValue
Expand Down
9 changes: 8 additions & 1 deletion src/use/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,12 @@ export const useInput: Callback<any> = () => {
return arr.filter((data: string) => data !== '')
}

return { pasteText }
const prevent = (input: HTMLInputElement) => {
input.addEventListener('keydown', (event: Event) => {
// TODO: Edge and IE11 insert in a / event
// event.stopPropagation()
})
}

return { pasteText, prevent }
}
3 changes: 0 additions & 3 deletions src/use/pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export const usePDF: Callback<any> = () => {

const content = (store: Store<any>): Array<any> => {
const pages: Array<ContextState> = store.state.project.pages
console.log(pages)
const arr: Array<any> = []

pages.forEach((page: ContextState) => {
Expand All @@ -93,8 +92,6 @@ export const usePDF: Callback<any> = () => {
})
})

console.log(arr)

return arr
}

Expand Down

0 comments on commit 6774a35

Please sign in to comment.