Skip to content
Snippets Groups Projects
Commit 872be779 authored by Ron Lucke's avatar Ron Lucke Committed by Elmar Ludwig
Browse files

fix #266

parent 167f9f8c
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
@closeEdit="closeEdit" @closeEdit="closeEdit"
> >
<template #content> <template #content>
<section class="cw-block-content" v-html="currentText"></section> <section class="cw-block-content" v-html="currentText" ref="content"></section>
</template> </template>
<template v-if="canEdit" #edit> <template v-if="canEdit" #edit>
<studip-wysiwyg v-model="currentText"></studip-wysiwyg> <studip-wysiwyg v-model="currentText"></studip-wysiwyg>
...@@ -48,6 +48,7 @@ export default { ...@@ -48,6 +48,7 @@ export default {
}, },
mounted() { mounted() {
this.currentText = this.text; this.currentText = this.text;
this.loadMathjax();
}, },
methods: { methods: {
...mapActions({ ...mapActions({
...@@ -55,6 +56,7 @@ export default { ...@@ -55,6 +56,7 @@ export default {
}), }),
closeEdit() { closeEdit() {
this.currentText = this.text; this.currentText = this.text;
this.loadMathjax();
}, },
async storeText() { async storeText() {
let attributes = this.block.attributes; let attributes = this.block.attributes;
...@@ -65,7 +67,26 @@ export default { ...@@ -65,7 +67,26 @@ export default {
containerId: this.block.relationships.container.data.id, containerId: this.block.relationships.container.data.id,
}); });
this.$refs.defaultBlock.displayFeature(false); this.$refs.defaultBlock.displayFeature(false);
this.loadMathjax();
}, },
loadMathjax() {
let mathjaxP;
let view = this;
if (window.MathJax && window.MathJax.Hub) {
mathjaxP = Promise.resolve(window.MathJax);
} else if (window.STUDIP && window.STUDIP.loadChunk) {
mathjaxP = window.STUDIP.loadChunk('mathjax');
}
mathjaxP && mathjaxP
.then(({ Hub }) => {
Hub.Queue(['Typeset', Hub, view.$refs.content]);
})
.catch(() => {
console.log('Warning: Could not load MathJax.');
});
}
}, },
}; };
</script> </script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment