From 4755543d0e881a1b1b9f8048a72101119fc9abf1 Mon Sep 17 00:00:00 2001 From: Ember Date: Tue, 2 Jul 2024 20:20:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E7=89=87=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=96=AD=E7=BD=91=E5=90=8E=E9=87=8D=E4=BC=A0=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BAHTML=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- submission/index.html | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/submission/index.html b/submission/index.html index 8ff9693..3086665 100644 --- a/submission/index.html +++ b/submission/index.html @@ -634,29 +634,30 @@ markdown 基本语法教程 空格与换行 markdown 语法对于空格与换行 } catch (error) { console.error("图片上传失败:", error); alert("图片上传失败!"); + event.target.value = ''; } } -// 复制HTML标签到剪贴板 -function copyImageUrl() { - const imageTag = document.getElementById("imageUrl").innerText; - // 创建一个临时文本区域元素 - const textArea = document.createElement("textarea"); - textArea.value = imageTag; - document.body.appendChild(textArea); - textArea.select(); + // 复制HTML标签到剪贴板 + function copyImageUrl() { + const imageTag = document.getElementById("imageUrl").innerText; + // 创建一个临时文本区域元素 + const textArea = document.createElement("textarea"); + textArea.value = imageTag; + document.body.appendChild(textArea); + textArea.select(); - try { - const successful = document.execCommand('copy'); - const msg = successful ? '标签已复制到剪贴板!请直接粘贴到 markdown 编辑区中,并根据预览效果调整大小。' : '复制失败!'; - alert(msg); - } catch (err) { - alert("复制失败!", err); + try { + const successful = document.execCommand('copy'); + const msg = successful ? '标签已复制到剪贴板!请直接粘贴到 markdown 编辑区中,并根据预览效果调整大小。' : '复制失败!'; + alert(msg); + } catch (err) { + alert("复制失败!", err); + } + + document.body.removeChild(textArea); } - document.body.removeChild(textArea); -} - document.getElementById('SubmitButton').onclick = function() {