Skip to content

Commit c295bde

Browse files
committed
Resolve an issue that failed to execute 'insertNode' on 'Node' (resolves #19)
1 parent b6b3e24 commit c295bde

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/index.jsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,23 @@ module.exports = class extends React.Component {
2525
const options = { ...this.props.options };
2626

2727
[
28+
'onChoose',
2829
'onStart',
2930
'onEnd',
3031
'onAdd',
31-
'onSort',
3232
'onUpdate',
33+
'onSort',
3334
'onRemove',
3435
'onFilter',
35-
'onMove'
36+
'onMove',
37+
'onClone'
3638
].forEach((name) => {
3739
const eventHandler = options[name];
3840

39-
options[name] = (evt) => {
40-
if (name === 'onStart') {
41+
options[name] = (...params) => {
42+
const [evt] = params;
43+
44+
if (name === 'onChoose') {
4145
store.nextSibling = evt.item.nextElementSibling;
4246
store.activeComponent = this;
4347
} else if ((name === 'onAdd' || name === 'onUpdate') && this.props.onChange) {
@@ -62,7 +66,8 @@ module.exports = class extends React.Component {
6266
}
6367

6468
if (evt.type === 'move') {
65-
const canMove = eventHandler ? eventHandler(evt) : true;
69+
const [evt, originalEvent] = params;
70+
const canMove = eventHandler ? eventHandler(evt, originalEvent) : true;
6671
return canMove;
6772
}
6873

0 commit comments

Comments
 (0)