Skip to content

Commit 6774a35

Browse files
committed
chore: input event
1 parent 5742513 commit 6774a35

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

src/components/editor/text/TextInput.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
@mouseout="hover = false"
66
>
77
<input
8+
id="main-input-define"
89
ref="input"
910
v-model="cmp"
1011
class="flex-1 rounded-none border-none shadow-2xl p-1"
@@ -30,7 +31,7 @@
3031
import { useEntity } from '@/use/entity'
3132
import { useFormat } from '@/use/format'
3233
import { useInput } from '@/use/input'
33-
import { ref, computed, watch } from 'vue'
34+
import { ref, computed, watch, onMounted } from 'vue'
3435
import { useI18n } from 'vue-i18n'
3536
import { useStore } from 'vuex'
3637
@@ -48,6 +49,10 @@
4849
const input = ref(null as any)
4950
const paste = ref<boolean>(false)
5051
52+
onMounted(() => {
53+
useInput().prevent(input.value)
54+
})
55+
5156
const cmp = computed({
5257
get() {
5358
return props.modelValue

src/use/input.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,12 @@ export const useInput: Callback<any> = () => {
77
return arr.filter((data: string) => data !== '')
88
}
99

10-
return { pasteText }
10+
const prevent = (input: HTMLInputElement) => {
11+
input.addEventListener('keydown', (event: Event) => {
12+
// TODO: Edge and IE11 insert in a / event
13+
// event.stopPropagation()
14+
})
15+
}
16+
17+
return { pasteText, prevent }
1118
}

src/use/pdf.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ export const usePDF: Callback<any> = () => {
7272

7373
const content = (store: Store<any>): Array<any> => {
7474
const pages: Array<ContextState> = store.state.project.pages
75-
console.log(pages)
7675
const arr: Array<any> = []
7776

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

96-
console.log(arr)
97-
9895
return arr
9996
}
10097

0 commit comments

Comments
 (0)