Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graph.paste()增加用户自定义参数 #3972

Closed
zzjjbbaa opened this issue Oct 13, 2023 · 3 comments
Closed

graph.paste()增加用户自定义参数 #3972

zzjjbbaa opened this issue Oct 13, 2023 · 3 comments

Comments

@zzjjbbaa
Copy link

功能描述

目前graph.on('cell:added')回调中,可以识别是stencil拖拽过来的新节点;
但是graph.on('cell:added')回调中,不能识别是paste粘贴过来的新节点;

期望解决方案

1.paste可以自定义参数:graph.paste({customerOption:{...}})
2.cell:added的回调可以获取用户自定义参数,

graph.on("cell:added",(event)=>{
myOption = event.options.customerOption
}
)
@NewByVector
Copy link
Contributor

可以这样:

graph.paste({ nodeProps: { flag: 1 } })

graph.on('cell:added', ({ cell }) => {
  const flag = cell.prop('flag')
  console.log(flag)
})

@zzjjbbaa
Copy link
Author

zzjjbbaa commented Nov 7, 2023

可以这样:

graph.paste({ nodeProps: { flag: 1 } })

graph.on('cell:added', ({ cell }) => {
  const flag = cell.prop('flag')
  console.log(flag)
})

这种方式是针对剪切板中已经复制的所有cell吧?

@NewByVector
Copy link
Contributor

是的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants