Feat:取消调用defenseXSS函数,对性能影响太大

This commit is contained in:
街角小林 2024-05-31 14:52:07 +08:00
parent c967be2bc2
commit 6a45ff2221
2 changed files with 5 additions and 7 deletions

View File

@ -10,7 +10,6 @@ import {
import { Image as SVGImage, SVG, A, G, Rect, Text } from '@svgdotjs/svg.js' import { Image as SVGImage, SVG, A, G, Rect, Text } from '@svgdotjs/svg.js'
import iconsSvg from '../../../svg/icons' import iconsSvg from '../../../svg/icons'
import { CONSTANTS } from '../../../constants/constant' import { CONSTANTS } from '../../../constants/constant'
import { defenseXSS } from '../../../utils/xss'
// 创建图片节点 // 创建图片节点
function createImgNode() { function createImgNode() {
@ -142,7 +141,7 @@ function createRichTextNode() {
text: text text: text
}) })
} }
let html = `<div>${defenseXSS(this.getData('text'))}</div>` let html = `<div>${this.getData('text')}</div>`
if (!this.mindMap.commonCaches.measureRichtextNodeTextSizeEl) { if (!this.mindMap.commonCaches.measureRichtextNodeTextSizeEl) {
this.mindMap.commonCaches.measureRichtextNodeTextSizeEl = this.mindMap.commonCaches.measureRichtextNodeTextSizeEl =
document.createElement('div') document.createElement('div')

View File

@ -12,8 +12,7 @@
</template> </template>
<script> <script>
import {mapState} from 'vuex' import { mapState } from 'vuex'
import {defenseXSS} from 'simple-mind-map/src/utils/xss'
/** /**
* @Author: 王林 * @Author: 王林
@ -39,7 +38,7 @@ export default {
computed: { computed: {
...mapState({ ...mapState({
isDark: state => state.localConfig.isDark isDark: state => state.localConfig.isDark
}), })
}, },
created() { created() {
this.$bus.$on('data_change', this.onDataChange) this.$bus.$on('data_change', this.onDataChange)
@ -61,7 +60,7 @@ export default {
this.words = 0 this.words = 0
this.num = 0 this.num = 0
this.walk(data) this.walk(data)
countEl.innerHTML = defenseXSS(this.textStr) countEl.innerHTML = this.textStr
this.words = countEl.textContent.length this.words = countEl.textContent.length
}, },
@ -102,7 +101,7 @@ export default {
background: #262a2e; background: #262a2e;
.item { .item {
color: hsla(0, 0%, 100%, .6); color: hsla(0, 0%, 100%, 0.6);
} }
} }