summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-11-16 18:31:25 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-11-16 18:31:25 +0900
commitcc7de853b4f37a72d21cf7c664bcb6c0ec85341c (patch)
tree59fd747131497c5994f24266fd87fab6d3b44a52 /src/client
parentRevert "[Client] Load katex async to reduce bundle size" (diff)
downloadsharkey-cc7de853b4f37a72d21cf7c664bcb6c0ec85341c.tar.gz
sharkey-cc7de853b4f37a72d21cf7c664bcb6c0ec85341c.tar.bz2
sharkey-cc7de853b4f37a72d21cf7c664bcb6c0ec85341c.zip
[Client] Wrap formula component to split code
Diffstat (limited to 'src/client')
-rw-r--r--src/client/app/common/views/components/formula-core.vue26
-rw-r--r--src/client/app/common/views/components/formula.vue16
2 files changed, 31 insertions, 11 deletions
diff --git a/src/client/app/common/views/components/formula-core.vue b/src/client/app/common/views/components/formula-core.vue
new file mode 100644
index 0000000000..930f16b471
--- /dev/null
+++ b/src/client/app/common/views/components/formula-core.vue
@@ -0,0 +1,26 @@
+<template>
+<span v-html="compiledFormula"></span>
+</template>
+
+<script lang="ts">
+import Vue from 'vue';
+import * as katex from 'katex';
+
+export default Vue.extend({
+ props: {
+ formula: {
+ type: String,
+ required: true
+ }
+ },
+ computed: {
+ compiledFormula(): any {
+ return katex.renderToString(this.formula);
+ }
+ }
+});
+</script>
+
+<style>
+@import "../../../../../../node_modules/katex/dist/katex.min.css";
+</style>
diff --git a/src/client/app/common/views/components/formula.vue b/src/client/app/common/views/components/formula.vue
index 930f16b471..02ed96daac 100644
--- a/src/client/app/common/views/components/formula.vue
+++ b/src/client/app/common/views/components/formula.vue
@@ -1,26 +1,20 @@
<template>
-<span v-html="compiledFormula"></span>
+<x-formula :formula="formula"/>
</template>
<script lang="ts">
import Vue from 'vue';
-import * as katex from 'katex';
export default Vue.extend({
+ components: {
+ XFormula: () => import('./formula-core.vue').then(m => m.default)
+ },
+
props: {
formula: {
type: String,
required: true
}
- },
- computed: {
- compiledFormula(): any {
- return katex.renderToString(this.formula);
- }
}
});
</script>
-
-<style>
-@import "../../../../../../node_modules/katex/dist/katex.min.css";
-</style>