feat: 新增 Mermaid 圖表功能的選項,支持在新標籤頁中打開和縮放平移互動

fix: 更新插件版本以修正相容性問題
refactor: 優化代碼結構,提升可讀性
This commit is contained in:
Jerry
2026-01-26 22:48:18 +08:00
parent 954598b45c
commit e3e1d9e6ce
7 changed files with 82 additions and 69 deletions

View File

@@ -70,46 +70,49 @@ if hexo-config('mermaid.enable')
background: var(--card-bg)
text-align: center
.mermaid-open-btn
position: absolute
top: 8px
right: 8px
z-index: 2
display: flex
justify-content: center
align-items: center
padding: 0
width: 34px
height: 25px
border: none
border-radius: 20%
background: #D3D3D3
box-shadow: 0 4px 10px rgba(0, 0, 0, .15)
color: #fff
font-size: 0
line-height: 1
cursor: pointer
transition: background .2s ease, transform .2s ease
i
font-size: 16px
if hexo-config('mermaid.open_in_new_tab')
.mermaid-open-btn
position: absolute
top: 8px
right: 8px
z-index: 2
display: flex
justify-content: center
align-items: center
padding: 0
width: 34px
height: 25px
border: none
border-radius: 20%
background: #D3D3D3
box-shadow: 0 4px 10px rgba(0, 0, 0, .15)
color: #fff
font-size: 0
line-height: 1
cursor: pointer
transition: background .2s ease, transform .2s ease
&:hover,
&:focus-visible
outline: none
background: #C0C0C0
transform: translateY(-1px)
i
font-size: 16px
line-height: 1
&:hover,
&:focus-visible
outline: none
background: #C0C0C0
transform: translateY(-1px)
& > svg
max-width: 100%
height: 100%
cursor: grab
user-select: none
touch-action: none
&:active
cursor: grabbing
if hexo-config('mermaid.zoom_pan')
cursor: grab
user-select: none
touch-action: none
&:active
cursor: grabbing
if hexo-config('mermaid.code_write')
pre > code.mermaid