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 · 4 comments
Closed

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

zzjjbbaa opened this issue Oct 13, 2023 · 4 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

是的

@x6-bot
Copy link
Contributor

x6-bot bot commented Nov 7, 2024

This thread has been automatically locked because it has not had recent activity.

Please open a new issue for related bugs and link to relevant comments in this thread.

@x6-bot x6-bot bot locked as resolved and limited conversation to collaborators Nov 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants