Skip to content

Commit 7d172ff

Browse files
committed
chore: emit canvas.init event to initialize keyboard
1 parent 10a469b commit 7d172ff

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

packages/form-js-editor/src/render/Renderer.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ export default class Renderer {
2626
compact = false
2727
} = renderConfig;
2828

29+
eventBus.on('form.init', function() {
30+
31+
// emit <canvas.init> so dependent components can hook in
32+
// this is required to register keyboard bindings
33+
eventBus.fire('canvas.init', {
34+
svg: container,
35+
viewport: null
36+
});
37+
});
38+
2939
const App = () => {
3040
const [ state, setState ] = useState(formEditor._getState());
3141

packages/form-js-editor/test/spec/FormEditor.spec.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@ describe('FormEditor', function() {
5656
// when
5757
formEditor = await createFormEditor({
5858
container,
59-
schema,
60-
keyboard: {
61-
bindTo: document
62-
}
59+
schema
6360
});
6461

6562
formEditor.on('changed', event => {
@@ -80,9 +77,6 @@ describe('FormEditor', function() {
8077
debounce: true,
8178
renderer: {
8279
compact: true
83-
},
84-
keyboard: {
85-
bindTo: document
8680
}
8781
});
8882

0 commit comments

Comments
 (0)