|
@@ -11,6 +11,7 @@
|
|
|
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
|
|
|
@input="validateInput"
|
|
|
:placeholder="$t('documentEditor.inputPageTip')"
|
|
|
+ @compositionstart="startComposition" @compositionend="endComposition"
|
|
|
>
|
|
|
|
|
|
<template #footer>
|
|
@@ -33,6 +34,7 @@ const dialogName = 'movePageSettingDialog'
|
|
|
const show = computed(() => useViewer.isElementOpen(dialogName))
|
|
|
|
|
|
const targetIndex = ref('')
|
|
|
+let composing = false
|
|
|
|
|
|
const invalidMove = computed(() => {
|
|
|
if (typeof targetIndex.value !== 'number') return true
|
|
@@ -69,15 +71,28 @@ const handleMove = async () => {
|
|
|
}
|
|
|
|
|
|
const validateInput = (e) => {
|
|
|
+ if (composing) return
|
|
|
+
|
|
|
const value = e.target.valueAsNumber
|
|
|
|
|
|
- if (value > props.totalPages) {
|
|
|
+ if (isNaN(value)) {
|
|
|
+ e.target.value = ''
|
|
|
+ }
|
|
|
+
|
|
|
+ if (value > props.totalPages) {
|
|
|
targetIndex.value = props.totalPages
|
|
|
}
|
|
|
if (value === 0) {
|
|
|
e.target.value = value.toFixed(0)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+const startComposition = () => {
|
|
|
+ composing = true
|
|
|
+}
|
|
|
+const endComposition = () => {
|
|
|
+ composing = false
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
@@ -112,6 +127,7 @@ const validateInput = (e) => {
|
|
|
font-size: 14px;
|
|
|
line-height: 16px;
|
|
|
color: var(--c-text);
|
|
|
+ -moz-appearance: textfield;
|
|
|
|
|
|
&:focus {
|
|
|
border-color: #0078D7;
|