Add math block
This commit is contained in:
parent
540333d431
commit
91b7922464
17407
dist/block-renderer.common.js
vendored
17407
dist/block-renderer.common.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/block-renderer.common.js.map
vendored
2
dist/block-renderer.common.js.map
vendored
File diff suppressed because one or more lines are too long
1
dist/block-renderer.css
vendored
Normal file
1
dist/block-renderer.css
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.katex-html[data-v-59e6cee5]{display:none}
|
17407
dist/block-renderer.umd.js
vendored
17407
dist/block-renderer.umd.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/block-renderer.umd.js.map
vendored
2
dist/block-renderer.umd.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/block-renderer.umd.min.js
vendored
2
dist/block-renderer.umd.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/block-renderer.umd.min.js.map
vendored
2
dist/block-renderer.umd.min.js.map
vendored
File diff suppressed because one or more lines are too long
13
package-lock.json
generated
13
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "block-renderer",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.16",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -3550,8 +3550,7 @@
|
|||
"commander": {
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"dev": true
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="
|
||||
},
|
||||
"commondir": {
|
||||
"version": "1.0.1",
|
||||
|
@ -6903,6 +6902,14 @@
|
|||
"verror": "1.10.0"
|
||||
}
|
||||
},
|
||||
"katex": {
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/katex/-/katex-0.12.0.tgz",
|
||||
"integrity": "sha512-y+8btoc/CK70XqcHqjxiGWBOeIL8upbS0peTPXTvgrh21n1RiWWcIpSWM+4uXq+IAgNh9YYQWdc7LVDPDAEEAg==",
|
||||
"requires": {
|
||||
"commander": "^2.19.0"
|
||||
}
|
||||
},
|
||||
"killable": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "block-renderer",
|
||||
"description": "Content renderer for JSON blocks from Editor.js",
|
||||
"version": "0.1.16",
|
||||
"version": "0.1.20",
|
||||
"author": "KingOfDog <info@kingofdog.de>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -17,6 +17,7 @@
|
|||
"main": "./dist/block-renderer.common.js",
|
||||
"dependencies": {
|
||||
"core-js": "^3.6.5",
|
||||
"katex": "^0.12.0",
|
||||
"vue": "^2.6.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -17,6 +17,7 @@ import HeaderBlock from "./HeaderBlock";
|
|||
import ImageBlock from "./ImageBlock";
|
||||
import LinkBlock from "./LinkBlock";
|
||||
import ListBlock from "./ListBlock";
|
||||
import MathBlock from "./MathBlock";
|
||||
import ParagraphBlock from "./ParagraphBlock";
|
||||
import QuoteBlock from "./QuoteBlock";
|
||||
import WarningBlock from "./WarningBlock";
|
||||
|
@ -29,6 +30,7 @@ const componentTypes = {
|
|||
image: ImageBlock,
|
||||
link: LinkBlock,
|
||||
list: ListBlock,
|
||||
math: MathBlock,
|
||||
paragraph: ParagraphBlock,
|
||||
quote: QuoteBlock,
|
||||
warning: WarningBlock
|
||||
|
|
29
src/components/MathBlock.vue
Normal file
29
src/components/MathBlock.vue
Normal file
|
@ -0,0 +1,29 @@
|
|||
<template>
|
||||
<figure>
|
||||
<div v-html="content"></div>
|
||||
</figure>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import katex from "katex";
|
||||
|
||||
export default {
|
||||
props: ["data"],
|
||||
data() {
|
||||
return {
|
||||
content: ""
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.content = katex.renderToString(this.data.text, {
|
||||
throwOnError: false
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.katex-html {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user