fix: add link logo, 以及跳转新窗口

This commit is contained in:
Tim
2025-08-26 10:47:02 +08:00
parent f01e8c942a
commit 6527b3790e
4 changed files with 6 additions and 9 deletions

View File

@@ -9,14 +9,12 @@
title="收起至 100px"
@click="collapseToMini"
></i>
<!-- 回弹60vh -->
<i
class="fas fa-chevron-up"
v-if="floatHeight !== DEFAULT_HEIGHT"
title="回弹至 60vh"
@click="reboundToDefault"
></i>
<!-- 全屏打开原有逻辑 -->
<i class="fas fa-expand" title="在页面中打开" @click="expand"></i>
</div>
</div>
@@ -61,7 +59,6 @@ function injectBaseTag() {
}
}
// 当浮窗重新出现时,恢复默认高度
watch(
() => floatRoute.value,
(v) => {
@@ -76,7 +73,6 @@ watch(
bottom: 0;
right: 0;
width: 400px;
/* 高度由内联样式绑定控制60vh / 100px */
max-height: 90vh;
background-color: var(--background-color);
border: 1px solid var(--normal-border-color);

View File

@@ -106,7 +106,7 @@ const md = new MarkdownIt({
md.use(mentionPlugin)
md.use(tiebaEmojiPlugin)
md.use(linkPlugin) // 添加链接插件
md.use(linkPlugin)
export function renderMarkdown(text) {
return md.render(text || '')

View File

@@ -16,6 +16,7 @@ export function createVditor(editorId, options = {}) {
const { placeholder = '', preview = {}, input, after } = options
const config = useRuntimeConfig()
const API_BASE_URL = config.public.apiBaseUrl
const WEBSITE_BASE_URL = config.public.websiteBaseUrl
const fetchMentions = async (value) => {
if (!value) {
@@ -80,7 +81,7 @@ export function createVditor(editorId, options = {}) {
}))
},
},
vditorPostCitation(API_BASE_URL),
vditorPostCitation(API_BASE_URL, WEBSITE_BASE_URL),
],
},
cdn: 'https://openisle-1307107697.cos.ap-guangzhou.myqcloud.com/assert/vditor',

View File

@@ -10,7 +10,7 @@ async function searchPost(apiBaseUrl, keyword) {
})
}
export default (apiBaseUrl) => {
export default (apiBaseUrl, websiteBaseUrl) => {
return {
key: '#',
hint: async (keyword) => {
@@ -22,8 +22,8 @@ export default (apiBaseUrl) => {
let value = ''
return (
body.map((item) => ({
value: `[${item.title}](/posts/${item.id})`,
html: `<div>${item.title}</div>`,
value: `[🔗${item.title}](${websiteBaseUrl}/posts/${item.id})`,
html: `<div><i class="fas fa-link"></i> ${item.title}</div>`,
})) ?? []
)
} else {