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

复制粘贴父节点,父节点的children只有一个 #3876

Open
blank-peas opened this issue Aug 28, 2023 · 2 comments
Open

复制粘贴父节点,父节点的children只有一个 #3876

blank-peas opened this issue Aug 28, 2023 · 2 comments
Labels
resolution: needs demos 需要复现 Issues that need minimal demos to reproduce any problems

Comments

@blank-peas
Copy link

Describe the bug

如下图可看:两个子节点的parentID都指向一个父id,但是父节点的children数组只有一个节点
image

Your Example Website or App

内部系统

Steps to Reproduce the Bug or Issue

// 复制
graph.bindKey(['ctrl+c', 'command+c'], () => {
  const cells = graph.getSelectedCells();
  if (cells.length) {
    for (let i = 0; i < cells.length; i++) {
      const parentId = cells[i].parent?.id;
      if (parentId && parentId !== 'wrapper-node') {
        const parent = graph.getCellById(parentId);
        cells.push(parent);
      }
    }
    graph.copy(cells, {
      deep: true,
    });
  }
  return false;
});

graph.bindKey(['ctrl+v', 'command+v'], () => {
  if (!graph.isClipboardEmpty()) {
    const cells = graph.paste({ offset: 32 });
    graph.cleanSelection();
    graph.select(cells);
  }
  return false;
});

Expected behavior

期待复制父节点后,对应的children数组可以全部对应

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Chrome
  • Version: [e.g. 2.11.1]

Additional context

No response

@x6-bot
Copy link
Contributor

x6-bot bot commented Aug 28, 2023

👋 @blank-peas

Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@qiufeihong2018
Copy link
Contributor

@blank-peas 有没有可以复现的demo?

@NewByVector NewByVector added the resolution: needs demos 需要复现 Issues that need minimal demos to reproduce any problems label Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: needs demos 需要复现 Issues that need minimal demos to reproduce any problems
Projects
None yet
Development

No branches or pull requests

3 participants