Skip to content

Commit e39dfce

Browse files
committed
修复公式框横向滚动异常
1 parent 01b9b9f commit e39dfce

File tree

3 files changed

+43
-24
lines changed

3 files changed

+43
-24
lines changed

src/editor/inputs/subblocks/derivatePane.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ watchEffect(() => {
226226

227227
<style lang="scss">
228228
.derivate-pane {
229-
width: 25em;
229+
width: 28em;
230230
s-tab {
231231
background-color: var(--s-color-surface-container-low);
232232
border-top-left-radius: 3px;

src/editor/inputs/subblocks/function.vue

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
<template>
22
<div class="filled-textfield" :class="{ focus: isFocus }">
3-
<label :class="{ lifted: !isEmpty }" class="function-label">
4-
<component v-for="item in labelContent" :is="item"></component>
5-
</label>
6-
<input
7-
@focus="isFocus = true"
8-
@blur="isFocus = false"
9-
type="text"
10-
v-model="value"
11-
ref="inputRef"
12-
/>
3+
<div class="filled-textfield-inner">
4+
<label :class="{ lifted: !isEmpty }" class="function-label">
5+
<component v-for="item in labelContent" :is="item"></component>
6+
</label>
7+
<input
8+
@focus="isFocus = true"
9+
@blur="isFocus = false"
10+
type="text"
11+
v-model="value"
12+
ref="inputRef"
13+
/>
14+
</div>
1315
</div>
1416
</template>
1517

@@ -68,39 +70,55 @@ const labelContent = computed(() =>
6870
background-color 0.2s,
6971
border-bottom-color 0.2s;
7072
padding: 0;
71-
display: flex;
7273
font-family: var(--font-math);
73-
position: relative;
74+
overflow-x: scroll;
75+
cursor: text;
7476
&.focus {
7577
background-color: var(--s-color-surface-container-highest);
7678
border-bottom-color: var(--s-color-primary);
7779
}
80+
&::-webkit-scrollbar {
81+
width: 0;
82+
height: 0;
83+
background: transparent;
84+
}
85+
.filled-textfield-inner {
86+
width: fit-content;
87+
position: relative;
88+
min-width: 100%;
89+
overflow-y: hidden;
90+
}
91+
.filled-textfield-inner::-webkit-scrollbar {
92+
display: none;
93+
height: 0;
94+
width: 0;
95+
}
96+
label {
97+
color: var(--s-color-outline);
98+
white-space: pre;
99+
width: fit-content;
100+
}
78101
input {
79102
background-color: transparent;
80103
border: none;
81104
outline: none;
82105
font-size: inherit;
83106
font-family: inherit;
84-
display: block;
85-
width: 0;
86-
flex-grow: 1;
87107
caret-color: var(--s-color-primary);
88-
z-index: 1;
89108
color: transparent;
90-
}
91-
label {
92-
display: block;
93-
color: var(--s-color-outline);
94109
position: absolute;
95-
white-space: pre;
96-
max-width: 100%;
110+
top: 0;
111+
left: 0;
112+
bottom: 0;
113+
width: 100%;
97114
box-sizing: border-box;
98115
}
116+
99117
input,
100118
label {
119+
display: block;
101120
padding: 0.2em 0.45em 0.1em 0.45em;
102121
line-height: 1.6;
103-
overflow: hidden;
104122
}
105123
&.styled label {
106124
transform: translateY(-0.05em);

src/public.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ input[type="number"] {
108108
}
109109
}
110110

111+
111112
s-page {
112113
--s-color-scrim: #000000;
113114
--s-color-primary: #00639a;

0 commit comments

Comments
 (0)