-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<script setup lang="ts"> | ||
import { onMounted } from 'vue' | ||
import FluentEditor from '@opentiny/fluent-editor' | ||
import katex from 'katex' | ||
import 'katex/dist/katex.min.css' | ||
window.katex = katex | ||
let editor | ||
const TOOLBAR_CONFIG = [ | ||
[{ header: [] }], | ||
['bold', 'italic', 'underline', 'link'], | ||
[{ list: 'ordered' }, { list: 'bullet' }], | ||
['clean'], | ||
['formula'], | ||
] | ||
onMounted(() => { | ||
// ssr compat, reference: https://vitepress.dev/guide/ssr-compat#importing-in-mounted-hook | ||
import('@opentiny/fluent-editor').then((module) => { | ||
const FluentEditor = module.default | ||
editor = new FluentEditor('#editor', { | ||
theme: 'snow', | ||
modules: { | ||
toolbar: TOOLBAR_CONFIG, | ||
formula: true, | ||
}, | ||
}) | ||
}) | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div id="editor" /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# 公式 | ||
|
||
通过配置 `formula` 为 true,并配置工具栏按钮 `formula`,可以开启插入公式功能。 | ||
|
||
由于插入公式依赖 `KaTeX`,需要安装 `katex` 依赖包,并引入对应的样式。 | ||
|
||
:::demo src=demos/formula.vue | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.