Skip to content

Commit fd461a4

Browse files
fix: sync field after custom space handling
1 parent 5dc41a2 commit fd461a4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/visualBuilder/utils/handleFieldMouseDown.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export function handleFieldKeyDown(e: Event): void {
5252
element instanceof Element && element.tagName === "BUTTON"
5353
)
5454
) {
55+
// custom space handling when a button is involved
5556
handleKeyDownOnButton(event);
5657
}
5758
if (fieldType === FieldDataType.NUMBER) {
@@ -63,11 +64,12 @@ export function handleFieldKeyDown(e: Event): void {
6364

6465
// spaces do not work inside a button content-editable
6566
// this adds a space and moves the cursor ahead, the
66-
// button press event is also prevented
67+
// button press event is also prevented, finally syncs the field
6768
function handleKeyDownOnButton(e: KeyboardEvent) {
6869
if (e.code === "Space" && e.target) {
6970
e.preventDefault();
7071
insertSpaceAtCursor(e.target as HTMLElement);
72+
throttledFieldSync();
7173
}
7274
}
7375

0 commit comments

Comments
 (0)