guozhaolong/wfd

TypeError: Cannot read property 'getContainer' of undefined

zhuifeng00001 opened this issue · 6 comments

TypeError: Cannot read property 'getContainer' of undefined

1633 | var group = subProcess.getContainer();
652 | cmdPlugin._deleteSubProcessNode(graph, i);
646 | selectedItems.forEach(function (i) {
528 | this.method && (isString(this.method) ? graphthis.method : this.method(graph));
557 | cmd.execute(graph);
503 | _this.execute(name, graph, cfg);
910 | graph.commandEnable(cmdName) && graph.executeCommand(cmdName);

1.这错误是模块原有的吗 ?(删除节点时出现)

2.图片改文字可行,只是拖拽时默认是选中文字,如果先选中文字,再拖动是可以的,如下图GIF:

demo3

1、你每次删除的时候都这样吗?把错误信息粘全一些,你用了子节点吗?
2、你把css的属性设置上user-select:none就选不中文字了,

user-select:none
1.是的,每次都会崩溃。代码在下面。
2.加上这个样式,文字是不能被选中了,但同时,也不能拖拽了。我像蚂蚁啃骨头啊,哈哈

`
Command._deleteSubProcessNode
http://localhost:8000/umi.js:1633:30
1630 | return false;
1631 | }
1632 | });

1633 | var group = subProcess.getContainer();
| ^ 1634 | var resultModel = group.removeItem(subProcess, itemId);
1635 | graph.updateItem(subProcess, resultModel);
1636 | }
View source
(anonymous function)
../dist/index.js:652
649 | if (node) {
650 | graph.remove(i);
651 | } else {
652 | cmdPlugin._deleteSubProcessNode(graph, i);
| ^ 653 | }
654 | });
655 | }
View compiled
method
../dist/index.js:646
643 | });
644 |
645 | if (selectedItems && selectedItems.length > 0) {
646 | selectedItems.forEach(function (i) {
| ^ 647 | var node = graph.findById(i);
648 |
649 | if (node) {
View compiled
execute
../dist/index.js:528
525 | execute: function execute(graph) {
526 | this.snapShot = graph.save();
527 | this.selectedItems = graph.get('selectedItems');
528 | this.method && (isString(this.method) ? graphthis.method : this.method(graph));
| ^ 529 | },
530 | back: function back(graph) {
531 | graph.read(this.snapShot);
View compiled
Command.execute
../dist/index.js:557
554 | graph.emit('beforecommandexecute', {
555 | command: cmd
556 | });
557 | cmd.execute(graph);
| ^ 558 | graph.emit('aftercommandexecute', {
559 | command: cmd
560 | });
View compiled
Graph.graph.executeCommand
../dist/index.js:503
500 | };
501 |
502 | graph.executeCommand = function (name, cfg) {
503 | _this.execute(name, graph, cfg);
| ^ 504 | };
505 |
506 | graph.commandEnable = function (name) {
View compiled
HTMLSpanElement.
../dist/index.js:910
907 | each(children, function (child, i) {
908 | var cmdName = child.getAttribute('data-command');
909 | child.addEventListener('click', function (e) {
910 | graph.commandEnable(cmdName) && graph.executeCommand(cmdName);
| ^ 911 | });
912 | });
913 | }

`

你是删除的子流程节点吗?

你是删除的子流程节点吗?

如果与删除顺序有关,那可能就是了。
从后向前删除,随意删除,都操作过。错误提示也一样。

这个问题我也遇到过!
在错误那行添加个if判断下子节点是否存在;这个是重复删除了

本来想在新版本一起修复,目前新版本g6还存在拖拽bug,只能先简单改一下这个bug了