Skip to content

Commit eb9b683

Browse files
committed
fix: placeholders
1 parent c3be180 commit eb9b683

3 files changed

Lines changed: 3 additions & 12 deletions

File tree

app/components/SyntaxHighlightedTextArea.vue

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div
55
class="syntax-highlight-layer"
66
:class="{ 'is-placeholder': !modelValue }"
7-
v-html="highlightedCode || placeholderHtml"
7+
v-html="highlightedCode || props.placeholder"
88
/>
99

1010
<!-- 可编辑文本框层 -->
@@ -41,7 +41,6 @@ const emit = defineEmits<{
4141
const colorMode = useColorMode()
4242
const textareaRef = ref<HTMLTextAreaElement>()
4343
const highlightedCode = ref('')
44-
const placeholderHtml = ref('')
4544
4645
// 根据主题获取花括号颜色
4746
const braceColor = computed(() => {
@@ -50,16 +49,9 @@ const braceColor = computed(() => {
5049
5150
// 初始化
5251
onMounted(() => {
53-
updatePlaceholder()
5452
highlightCode(props.modelValue)
5553
})
5654
57-
// 更新占位符样式
58-
const updatePlaceholder = () => {
59-
const color = colorMode.value === 'dark' ? '#9ca3af' : '#6b7280'
60-
placeholderHtml.value = `<span style="color: ${color};">${props.placeholder}</span>`
61-
}
62-
6355
const highlightCode = (code: string) => {
6456
if (!code) {
6557
highlightedCode.value = ''
@@ -107,7 +99,6 @@ watch(() => props.modelValue, (newValue) => {
10799
108100
// 监听 colorMode 变化
109101
watch(() => colorMode.value, () => {
110-
updatePlaceholder()
111102
highlightCode(props.modelValue)
112103
})
113104
</script>

i18n/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"model_title": "Model",
99
"upload_title": "Upload",
1010
"uploader_label": "Paste, drop or click to upload your LaTeX image",
11-
"uploader_description": "Resolution no less than 384×384\nLess margin better performance\nExtreme height-width ratio may lead to illusion",
11+
"uploader_description": "Resolution no less than 384×384\nBlack text, white background, minimal margin\nExtreme height-width ratio may lead to illusion",
1212
"upload_button": "Click to upload",
1313
"upload_example": "Example image",
1414
"preview_title": "Preview",

i18n/locales/zh-CN.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"model_title": "模型",
99
"upload_title": "上传",
1010
"uploader_label": "粘贴、拖拽或点击上传公式图片",
11-
"uploader_description": "分辨率不小于384×384\n白边越少效果越好\n长宽比过于悬殊可能使模型产生幻觉",
11+
"uploader_description": "分辨率不小于384×384\n白底黑字,白边尽可能少\n长宽比过于悬殊可能使模型产生幻觉",
1212
"upload_button": "点击上传",
1313
"upload_example": "示例图片",
1414
"preview_title": "预览",

0 commit comments

Comments
 (0)