Skip to content

Commit d2af30b

Browse files
committed
添加连字问题 workaround
1 parent ce7505b commit d2af30b

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/editor/inputs/subblocks/function.vue

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
<label :class="{ lifted: !isEmpty }">{{ props.label }}</label>
44
<input
55
@focus="isFocus = true"
6-
@blur="isFocus = false"
6+
@blur="
7+
isFocus = false;
8+
refreshInput();
9+
"
710
type="text"
811
v-model="value"
12+
ref="inputRef"
913
/>
1014
</div>
1115
</template>
@@ -19,6 +23,15 @@ const props = defineProps<{
1923
}>();
2024
const isFocus = ref(false);
2125
const isEmpty = computed(() => value.value === "");
26+
27+
const inputRef = ref<HTMLInputElement | null>(null);
28+
function refreshInput() {
29+
// On Chromium browsers, ligatures over 3 characters are not displayed until force refresh
30+
// Manually setting the value won't trigger Vue's reactivity system, no performance issue
31+
if (!inputRef.value) return;
32+
inputRef.value.value = value.value + "\u200B";
33+
inputRef.value.value = value.value;
34+
}
2235
</script>
2336

2437
<style lang="scss">
@@ -48,7 +61,7 @@ const isEmpty = computed(() => value.value === "");
4861
caret-color: var(--s-color-primary);
4962
line-height: 1.2;
5063
z-index: 1;
51-
color:var(--s-color)
64+
color: var(--s-color);
5265
}
5366
label {
5467
color: var(--s-color-outline);

0 commit comments

Comments
 (0)