From e198fa343353cef51e87b3ded99c1ad9033e33f0 Mon Sep 17 00:00:00 2001
From: renxiaodong <1344903914@qq.com>
Date: Sat, 13 Sep 2025 14:05:39 +0800
Subject: [PATCH] =?UTF-8?q?style(highlight-textarea):=20=E4=BC=98=E5=8C=96?=
=?UTF-8?q?=E6=96=87=E6=9C=AC=E5=9F=9F=E6=A0=B7=E5=BC=8F=E5=92=8C=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../content-card/highlight-textarea.vue | 22 ++++---
.../content-card/highlight-textarea.vue | 59 ++++++++++---------
2 files changed, 44 insertions(+), 37 deletions(-)
diff --git a/src/views/material-center/components/finished-products/manuscript/check/components/content-card/highlight-textarea.vue b/src/views/material-center/components/finished-products/manuscript/check/components/content-card/highlight-textarea.vue
index 42ed9c4..12b7254 100644
--- a/src/views/material-center/components/finished-products/manuscript/check/components/content-card/highlight-textarea.vue
+++ b/src/views/material-center/components/finished-products/manuscript/check/components/content-card/highlight-textarea.vue
@@ -110,7 +110,7 @@ const generateHighlightedHtml = (): string => {
const levelStyle = props.levelMap?.get(wordInfo.risk_level);
const color = levelStyle?.color || '#F64B31';
- return `${escapeHtml(match)}`;
+ return `${escapeHtml(match)}`;
});
};
@@ -174,6 +174,7 @@ const handleCompositionUpdate = () => {
font-size: 14px;
line-height: 22px;
font-weight: 400;
+ font-family: $font-family-regular;
//border: 1px solid #d7d7d9;
border-radius: 4px;
resize: none;
@@ -209,15 +210,20 @@ const handleCompositionUpdate = () => {
resize: none;
@include textarea-padding;
overflow-y: auto;
- }
+ &.ant-input-disabled {
+ background: #f2f3f5 !important;
+ -webkit-text-fill-color: rgba(0, 0, 0, 0.25) !important;
+ }
- .arco-textarea-word-limit {
- z-index: 2;
}
-
- &.arco-textarea-disabled {
- .arco-textarea {
- background: #f2f3f5;
+ &.ant-input-textarea-show-count {
+ &::after {
+ position: absolute;
+ z-index: 2;
+ font-size: 12px;
+ right: 10px;
+ bottom: 6px;
+ user-select: none;
}
}
}
diff --git a/src/views/writer-material-center/components/finished-products/manuscript/check/components/content-card/highlight-textarea.vue b/src/views/writer-material-center/components/finished-products/manuscript/check/components/content-card/highlight-textarea.vue
index 3c6dd1d..12b7254 100644
--- a/src/views/writer-material-center/components/finished-products/manuscript/check/components/content-card/highlight-textarea.vue
+++ b/src/views/writer-material-center/components/finished-products/manuscript/check/components/content-card/highlight-textarea.vue
@@ -1,12 +1,12 @@
-
import { Input } from 'ant-design-vue';
-const {TextArea} = Input
+
+const { TextArea } = Input;
import { ref, computed, watch, defineProps, defineEmits, onMounted, onUnmounted } from 'vue';
import { escapeRegExp } from './constants';
@@ -69,8 +70,8 @@ watch(
);
// 处理输入事件
-const handleInput = (value: string) => {
- emit('update:modelValue', value);
+const handleInput = (e) => {
+ emit('update:modelValue', e.currentTarget.value);
};
const escapeHtml = (str: string): string => {
@@ -109,14 +110,12 @@ const generateHighlightedHtml = (): string => {
const levelStyle = props.levelMap?.get(wordInfo.risk_level);
const color = levelStyle?.color || '#F64B31';
- return `${escapeHtml(match)}`;
+ return `${escapeHtml(match)}`;
});
};
onMounted(() => {
- nativeTextarea =
- (textareaWrapRef.value?.$el || textareaWrapRef.value)?.querySelector?.('textarea.arco-textarea') ||
- document.querySelector('.textarea-input .arco-textarea');
+ nativeTextarea = textareaWrapRef.value?.$el?.querySelector?.('textarea.ant-input');
if (nativeTextarea) {
nativeTextarea.addEventListener('scroll', handleTextareaScroll);
@@ -146,6 +145,7 @@ const handleTextareaScroll = (e: Event) => {
const handleCompositionUpdate = () => {
if (!nativeTextarea) return;
+ console.log('handleCompositionUpdate', nativeTextarea.value);
// 使用 rAF 等待浏览器把最新字符写入 textarea.value 再读取
requestAnimationFrame(() => {
if (!nativeTextarea) return;
@@ -173,8 +173,9 @@ const handleCompositionUpdate = () => {
height: 100%;
font-size: 14px;
line-height: 22px;
- font-weight: 400px;
- border: 1px solid #d7d7d9;
+ font-weight: 400;
+ font-family: $font-family-regular;
+ //border: 1px solid #d7d7d9;
border-radius: 4px;
resize: none;
white-space: pre-wrap;
@@ -192,43 +193,43 @@ const handleCompositionUpdate = () => {
background: #fff;
overflow: hidden;
@include textarea-padding;
-
- &.focus {
- border-color: rgb(var(--primary-6)) !important;
- box-shadow: 0 0 0 0 var(--color-primary-light-2) !important;
- }
}
- :deep(.arco-textarea-wrapper) {
+ :deep(.ant-input-textarea) {
@include textarea-style;
- .arco-textarea {
+ textarea {
padding: 0;
overflow: hidden;
position: absolute;
z-index: 1;
width: 100%;
- background: transparent;
+ background-color: transparent !important;
color: transparent;
caret-color: #211f24 !important;
resize: none;
@include textarea-padding;
overflow-y: auto;
- }
+ &.ant-input-disabled {
+ background: #f2f3f5 !important;
+ -webkit-text-fill-color: rgba(0, 0, 0, 0.25) !important;
+ }
- .arco-textarea-word-limit {
- z-index: 2;
}
-
- &.arco-textarea-disabled {
- .arco-textarea {
- background: #f2f3f5;
+ &.ant-input-textarea-show-count {
+ &::after {
+ position: absolute;
+ z-index: 2;
+ font-size: 12px;
+ right: 10px;
+ bottom: 6px;
+ user-select: none;
}
}
}
// 处于中文输入法合成态时,显示真实文本并隐藏高亮层
- :deep(.textarea-input.composing .arco-textarea) {
+ :deep(.ant-input-textarea.composing textarea) {
color: #211f24 !important;
-webkit-text-fill-color: #211f24 !important;
}