Demo:扩展节点图标列表

This commit is contained in:
wanglin2 2023-04-25 09:05:46 +08:00
parent 5e865a4e33
commit f5f665ec0a
3 changed files with 84 additions and 3 deletions

64
web/src/config/icon.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -48,6 +48,7 @@ import NodeImgPreview from './NodeImgPreview.vue'
import SidebarTrigger from './SidebarTrigger.vue'
import { mapState } from 'vuex'
import customThemeList from '@/customThemes'
import icon from '@/config/icon'
//
MindMap
@ -287,7 +288,8 @@ export default {
// this.$bus.$emit('hideNoteContent')
}
},
...(config || {})
...(config || {}),
iconList: icon
})
if (this.openNodeRichText) this.addRichTextPlugin()
this.mindMap.keyCommand.addShortcut('Control+s', () => {

View File

@ -12,7 +12,7 @@
class="icon"
v-for="icon in item.list"
:key="icon.name"
v-html="icon.icon"
v-html="getHtml(icon.icon)"
:class="{
selected: iconList.includes(item.type + '_' + icon.name)
}"
@ -25,6 +25,7 @@
<script>
import { nodeIconList } from 'simple-mind-map/src/svg/icons'
import icon from '@/config/icon'
/**
* @Author: 王林
@ -35,7 +36,7 @@ export default {
name: 'NodeIcon',
data() {
return {
nodeIconList,
nodeIconList: [...nodeIconList, ...icon],
dialogVisible: false,
iconList: [],
activeNodes: []
@ -56,6 +57,10 @@ export default {
})
},
methods: {
getHtml(icon) {
return /^<svg/.test(icon) ? icon : `<img src="${icon}" />`
},
/**
* @Author: 王林
* @Date: 2021-06-23 23:16:56
@ -119,6 +124,16 @@ export default {
cursor: pointer;
position: relative;
/deep/ img {
width: 100%;
height: 100%;
}
/deep/ svg {
width: 100%;
height: 100%;
}
&.selected {
&::after {
content: '';