From 6ac1b460bb1d1a26c837ba749e70b2b8595a49dc Mon Sep 17 00:00:00 2001
From: MoonLeeeaf <150461955+MoonLeeeaf@users.noreply.github.com>
Date: Wed, 12 Jun 2024 21:48:39 +0800
Subject: [PATCH] feat: Markdown Code Dialog
---
ling_chair_http/finally.js | 17 +++++++++++------
ling_chair_http/handler.js | 15 ++++++++-------
2 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/ling_chair_http/finally.js b/ling_chair_http/finally.js
index 28c4d57..91295f5 100644
--- a/ling_chair_http/finally.js
+++ b/ling_chair_http/finally.js
@@ -53,9 +53,11 @@ ChatMsgAdapter.initMsgElementEvents()
ChatMsgAdapter.initInputResizer()
-const showLinkDialog = (link) => mdui.alert(decodeURI(link) + "
如果你确认此链接是安全的, 那么请点我", '链接', () => { }, { confirmText: "关闭" })
+const showLinkDialog = (link) => mdui.alert(decodeURIComponent(link) + "
如果你确认此链接是安全的, 那么请点我", '链接', () => { }, { confirmText: "关闭" })
-const showImageDialog = (link, id, alt) => mdui.alert(`此图片链接来源未知: ${decodeURI(link)}
如果你希望加载, 请点我`, '外部图片', () => { }, { confirmText: "关闭" })
+const showImageDialog = (link, id, alt) => mdui.alert(`此图片链接来源未知: ${decodeURIComponent(link)}
如果你希望加载, 请点我`, '外部图片', () => { }, { confirmText: "关闭" })
+
+const showCodeDialog = (code) => mdui.alert(`
${decodeURIComponent(code)}`, '代码块', () => { }, { confirmText: "关闭" })
const renderer = {
heading(text, level) {
@@ -68,15 +70,18 @@ const renderer = {
return text
},
link(href, title, text) {
- return `${text}`
+ return `[链接] ${text}`
},
image(href, title, text) {
let h = Hash.sha256(href)
if (new URL(href).hostname === new URL(location.href))
- return `