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",
|
"name": "block-renderer",
|
||||||
"version": "0.1.0",
|
"version": "0.1.16",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -3550,8 +3550,7 @@
|
||||||
"commander": {
|
"commander": {
|
||||||
"version": "2.20.3",
|
"version": "2.20.3",
|
||||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"commondir": {
|
"commondir": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
|
@ -6903,6 +6902,14 @@
|
||||||
"verror": "1.10.0"
|
"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": {
|
"killable": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "block-renderer",
|
"name": "block-renderer",
|
||||||
"description": "Content renderer for JSON blocks from Editor.js",
|
"description": "Content renderer for JSON blocks from Editor.js",
|
||||||
"version": "0.1.16",
|
"version": "0.1.20",
|
||||||
"author": "KingOfDog <info@kingofdog.de>",
|
"author": "KingOfDog <info@kingofdog.de>",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -17,6 +17,7 @@
|
||||||
"main": "./dist/block-renderer.common.js",
|
"main": "./dist/block-renderer.common.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"core-js": "^3.6.5",
|
"core-js": "^3.6.5",
|
||||||
|
"katex": "^0.12.0",
|
||||||
"vue": "^2.6.11"
|
"vue": "^2.6.11"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -17,6 +17,7 @@ import HeaderBlock from "./HeaderBlock";
|
||||||
import ImageBlock from "./ImageBlock";
|
import ImageBlock from "./ImageBlock";
|
||||||
import LinkBlock from "./LinkBlock";
|
import LinkBlock from "./LinkBlock";
|
||||||
import ListBlock from "./ListBlock";
|
import ListBlock from "./ListBlock";
|
||||||
|
import MathBlock from "./MathBlock";
|
||||||
import ParagraphBlock from "./ParagraphBlock";
|
import ParagraphBlock from "./ParagraphBlock";
|
||||||
import QuoteBlock from "./QuoteBlock";
|
import QuoteBlock from "./QuoteBlock";
|
||||||
import WarningBlock from "./WarningBlock";
|
import WarningBlock from "./WarningBlock";
|
||||||
|
@ -29,6 +30,7 @@ const componentTypes = {
|
||||||
image: ImageBlock,
|
image: ImageBlock,
|
||||||
link: LinkBlock,
|
link: LinkBlock,
|
||||||
list: ListBlock,
|
list: ListBlock,
|
||||||
|
math: MathBlock,
|
||||||
paragraph: ParagraphBlock,
|
paragraph: ParagraphBlock,
|
||||||
quote: QuoteBlock,
|
quote: QuoteBlock,
|
||||||
warning: WarningBlock
|
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