This commit is contained in:
zhengyi 2023-12-19 00:36:15 +08:00
parent 2acf37c827
commit 21cba5fd76
3 changed files with 6 additions and 1 deletions

View File

@ -81,6 +81,9 @@
<button onclick="window.vditor.setTheme('light', 'light', 'github');document.querySelector('body').style.backgroundColor=''">
Light Mode
</button> &nbsp; &nbsp;
<button onclick="console.log(window.vditor.getHTML());">
GetHTML
</button> &nbsp; &nbsp;
<select autocomplete="off" onchange="setLang(this.value)">
<option selected="selected" value="zh_CN">zh_CN</option>
<option value="zh_TW">zh_TW</option>

View File

@ -137,3 +137,4 @@ window.setLang = (language) => {
window.vditor.destroy()
initVditor(language)
}

View File

@ -13,7 +13,8 @@ export const haloRender = (element: (HTMLElement | Document) = document, cdn = C
addStyle(`${cdn}/dist/js/halo/index.css`, "VditorHaloRenderStyle")
addScript(`${cdn}/dist/js/halo/index.js`, "VditorHaloRender").then(() => {
haloElement.forEach(el => {
el.outerHTML = HaloJs.renderHalo(el.textContent)
// 修补code外框
el.parentElement.outerHTML = HaloJs.renderHalo(haloRenderAdapter.getCode(el))
})
})
}