mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-17 14:04:47 +08:00
Feat:节点实例新增获取图片真实url的方法
This commit is contained in:
@@ -32,9 +32,16 @@ const defaultTagStyle = {
|
|||||||
//width: 30 // 标签矩形的宽度,如果不设置,默认以文字的宽度+paddingX*2为宽度
|
//width: 30 // 标签矩形的宽度,如果不设置,默认以文字的宽度+paddingX*2为宽度
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取图片的真实url
|
||||||
|
// 因为如果注册了NodeBase64ImageStorage插件,那么节点图片字段保存的实际是一个id,所以如果要获取图片真实的url可以通过该方法
|
||||||
|
function getImageUrl() {
|
||||||
|
const img = this.getData('image')
|
||||||
|
return (this.mindMap.renderer.renderTree.data.imgMap || {})[img] || img
|
||||||
|
}
|
||||||
|
|
||||||
// 创建图片节点
|
// 创建图片节点
|
||||||
function createImgNode() {
|
function createImgNode() {
|
||||||
let img = this.getData('image')
|
const img = this.getImageUrl()
|
||||||
if (!img) {
|
if (!img) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -570,6 +577,7 @@ function isUseCustomNodeContent() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
getImageUrl,
|
||||||
createImgNode,
|
createImgNode,
|
||||||
getImgShowSize,
|
getImgShowSize,
|
||||||
createIconNode,
|
createIconNode,
|
||||||
|
|||||||
Reference in New Issue
Block a user