feat: DEMO 模式支持展示嵌入的表格

This commit is contained in:
purocean
2021-07-16 19:00:23 +08:00
parent b51653ac87
commit 7d80d84947
3 changed files with 17 additions and 2 deletions
+1 -1
View File
@@ -333,7 +333,7 @@ xml 代码块 第一行注释需要有 `--drawio--` 文字
链接属性 `link-type` 值需要是 `luckysheet` 字符串。使用链接的形式也不会影响其他 Markdown 解析器解析。
```markdown
[drawio](./test.luckysheet){link-type="luckysheet"}
[luckysheet](./test.luckysheet){link-type="luckysheet"}
```
## 快捷键
@@ -13,6 +13,7 @@ import * as api from '@fe/support/api'
import { refreshTree } from '@fe/context/tree'
import { buildSrc, IFrame } from '@fe/context/embed'
import Mask from '@fe/components/Mask.vue'
import { FLAG_DEMO } from '@fe/support/global-args'
const logger = getLogger('plugin-markdown-luckysheet')
@@ -239,6 +240,20 @@ const LuckyComponent = defineComponent({
watch(props, update, { immediate: true })
if (FLAG_DEMO) {
watch([refFullIFrame, refIFrame], () => {
if (refIFrame.value) {
refIFrame.value.reload = () => {
useToast().show('warning', 'DEMO 模式该功能不可用')
}
}
document.querySelectorAll('iframe.lucky-sheet').forEach(x => {
(x as any).contentWindow.fetch = window.fetch
})
})
}
const button = (text: string, onClick: any) => h('button', {
style: 'margin-left: 5px;font-size: 14px;background: #cacaca; border: 0; padding: 0 6px; color: #2c2b2b; cursor: pointer; border-radius: 2px; transition: all .1s ease-in-out; line-height: 24px;',
onClick
+1 -1
View File
@@ -143,7 +143,7 @@ if (FLAG_DEMO) {
}
return xFetch(path).then(res => res.text()).then(md => {
cache[path] = md
cache[path] = md.replace(/```markdown\n(\[luckysheet\].+)\n```/, '$1')
data.data.content = message + md
return data
})