Skip to content

Commit

Permalink
fix(keyboard): correct Keyboard#bind and config signature
Browse files Browse the repository at this point in the history
Related to bpmn-io#662
  • Loading branch information
torge-hmn authored and nikku committed Nov 14, 2024
1 parent f5be55e commit 3a8434a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/features/keyboard/Keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var compatMessage = 'Keyboard binding is now implicit; explicit binding to an el
* `keyboard.bind=true|false` configuration option.
*
* @param {Object} config
* @param {EventTarget} [config.bindTo]
* @param {boolean} [config.bind]
* @param {EventBus} eventBus
*/
export default function Keyboard(config, eventBus) {
Expand Down Expand Up @@ -125,10 +125,17 @@ Keyboard.prototype._isEventIgnored = function(event) {
/**
* Bind keyboard events to the given DOM node.
*
* @overlord
* @deprecated
*
* @param {EventTarget} node
*/
/**
* Bind keyboard events to the canvas node.
*/
Keyboard.prototype.bind = function(node) {

// legacy <node> argument provided
if (node) {
console.error('unsupported argument <node>', new Error(compatMessage));
}
Expand Down
12 changes: 12 additions & 0 deletions lib/features/keyboard/Keyboard.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Diagram from '../../Diagram';
import Keyboard from './Keyboard';

const diagram = new Diagram();

let keyboard = diagram.get<Keyboard>('keyboard');

keyboard.bind();

keyboard.unbind();

keyboard.bind(document);

0 comments on commit 3a8434a

Please sign in to comment.