|
@@ -28,6 +28,7 @@ import { isEnable } from '@/views/book/courseware/data/common';
|
|
|
import ModuleMixin from '../../common/ModuleMixin';
|
|
|
import RichText from '@/components/RichText.vue';
|
|
|
import PinyinText from '@/components/PinyinText.vue';
|
|
|
+import DOMPurify from 'dompurify';
|
|
|
|
|
|
export default {
|
|
|
name: 'StemPage',
|
|
@@ -54,6 +55,10 @@ export default {
|
|
|
},
|
|
|
deep: true,
|
|
|
},
|
|
|
+ 'data.content': {
|
|
|
+ handler: 'handlerMindMap',
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
showSetting() {
|
|
@@ -89,6 +94,23 @@ export default {
|
|
|
});
|
|
|
this.data.paragraph_list[i][j][k].pinyin = tonePinyin;
|
|
|
},
|
|
|
+ // 思维导图
|
|
|
+ handlerMindMap() {
|
|
|
+ this.$set(this.data.mind_map, 'node_list', [
|
|
|
+ {
|
|
|
+ name: `描述:${this.sanitizeHTML(this.data.content)}`,
|
|
|
+ },
|
|
|
+ ]);
|
|
|
+ // console.log(this.data.mind_map);
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 过滤 html,防止 xss 攻击
|
|
|
+ * @param {string} html 需要过滤的html
|
|
|
+ * @returns {string} 过滤后的html
|
|
|
+ */
|
|
|
+ sanitizeHTML(html) {
|
|
|
+ return DOMPurify.sanitize(html, { ALLOWED_TAGS: [] });
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|