Skip to content

Commit cfff743

Browse files
[update] the set-edit event (v2.0)
1 parent 7bba001 commit cfff743

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

docs/api/events/js_kanban_setedit_event.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ description: You can learn about the set-edit event in the documentation of the
1313
### Usage
1414

1515
~~~jsx {}
16-
"set-edit": ({ cardId: string | number } | null) => void;
16+
"set-edit": ({ cardId: string | number, eventSource: "select-card" } | null) => void;
1717
~~~
1818

1919
### Parameters
2020

2121
The callback of the **set-edit** event can take the *null* value or an object with the following parameter:
2222

2323
- `cardId` - (required) the ID of the card to be edited
24+
- `eventSource` - (required) the ***"select-card"*** action that invokes the ***set-edit*** event
2425

2526
:::note
2627
The ***null*** value is used when closing editor
@@ -38,10 +39,12 @@ const board = new kanban.Kanban("#root", {
3839
columns,
3940
cards
4041
});
41-
// subscribe on the "set-edit" event
42-
board.api.on("set-edit", (obj) => {
43-
console.log(obj);
42+
// prevent editing card when a user click the card once
43+
board.api.intercept("set-edit", ({ eventSource }) => {
44+
return eventSource != "select-card";
4445
});
4546
~~~
4647

47-
**Change log:** The event was added in v1.2
48+
**Change log:**
49+
- The event was added in v1.2
50+
- The ***eventSource*** parameter was added in v2.0

0 commit comments

Comments
 (0)