From e8bf63da7903b125cd305a839c13812de5793fe0 Mon Sep 17 00:00:00 2001 From: yuantao Date: Thu, 16 Oct 2025 11:44:03 +0800 Subject: [PATCH] =?UTF-8?q?\"fix:=20=E4=BF=AE=E5=A4=8D=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E7=82=B9=E5=87=BB=E4=BA=8B=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=A7=A6=E6=91=B8=E4=BA=8B=E4=BB=B6=E6=94=AF?= =?UTF-8?q?=E6=8C=81\"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/RichTextEditor.vue | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/components/RichTextEditor.vue b/src/components/RichTextEditor.vue index 6ea3b1c..a78d961 100644 --- a/src/components/RichTextEditor.vue +++ b/src/components/RichTextEditor.vue @@ -94,6 +94,12 @@ onMounted(() => { container.remove(); handleInput(); }); + + deleteBtn.addEventListener('touchend', function(e) { + e.stopPropagation(); + container.remove(); + handleInput(); + }); } // 为图片容器添加短按事件以显示/隐藏删除按钮 @@ -799,13 +805,19 @@ const insertImage = () => { imgContainer.addEventListener('touchend', handleTouchEnd) imgContainer.addEventListener('touchcancel', handleTouchCancel) - // 为删除按钮添加点击事件 + // 为删除按钮添加点击事件(鼠标和触摸) deleteBtn.addEventListener('click', function(e) { e.stopPropagation(); imgContainer.remove(); handleInput(); }); + deleteBtn.addEventListener('touchend', function(e) { + e.stopPropagation(); + imgContainer.remove(); + handleInput(); + }); + // 为图片容器添加短按事件以显示/隐藏删除按钮 let touchStartTime = 0; imgContainer.addEventListener('touchstart', function(e) { @@ -1461,6 +1473,12 @@ const adjustExistingImages = () => { container.remove(); handleInput(); }); + + deleteBtn.addEventListener('touchend', function(e) { + e.stopPropagation(); + container.remove(); + handleInput(); + }); } // 为图片容器添加短按事件以显示/隐藏删除按钮 @@ -1535,6 +1553,12 @@ defineExpose({ container.remove(); handleInput(); }); + + deleteBtn.addEventListener('touchend', function(e) { + e.stopPropagation(); + container.remove(); + handleInput(); + }); } // 为图片容器添加短按事件以显示/隐藏删除按钮