forked from 2sys/phonograph
handle backspace input from table selection
This commit is contained in:
parent
b701270d88
commit
d575c058ee
2 changed files with 13 additions and 1 deletions
|
|
@ -145,6 +145,17 @@ example within the `<TableViewer />` or `<ExpressionEditor />`.
|
||||||
// Cancel edit before blurring, or else the table will try to commit it.
|
// Cancel edit before blurring, or else the table will try to commit it.
|
||||||
on_cancel_edit?.();
|
on_cancel_edit?.();
|
||||||
on_restore_focus?.();
|
on_restore_focus?.();
|
||||||
|
} else if (ev.key === "Backspace") {
|
||||||
|
if (
|
||||||
|
editor_state &&
|
||||||
|
["Dropdown", "Numeric", "Text", "Uuid"].includes(
|
||||||
|
current_presentation.t ?? "",
|
||||||
|
) &&
|
||||||
|
editor_state.text_value === ""
|
||||||
|
) {
|
||||||
|
editor_state.is_null = !editor_state.is_null;
|
||||||
|
handle_input();
|
||||||
|
}
|
||||||
} else if (
|
} else if (
|
||||||
current_presentation.t === "Dropdown" &&
|
current_presentation.t === "Dropdown" &&
|
||||||
filtered_dropdown_options.length > 0
|
filtered_dropdown_options.length > 0
|
||||||
|
|
|
||||||
|
|
@ -393,7 +393,7 @@
|
||||||
!ev.altKey &&
|
!ev.altKey &&
|
||||||
!ev.ctrlKey &&
|
!ev.ctrlKey &&
|
||||||
!ev.metaKey &&
|
!ev.metaKey &&
|
||||||
/^[a-zA-Z0-9`~!@#$%^&*()_=+[\]{}\\|;:'",<.>/?-]$/.test(ev.key)
|
/^([a-zA-Z0-9`~!@#$%^&*()_=+[\]{}\\|;:'",<.>/?-]|Backspace)$/.test(ev.key)
|
||||||
) {
|
) {
|
||||||
const sel = selections[0];
|
const sel = selections[0];
|
||||||
if (sel) {
|
if (sel) {
|
||||||
|
|
@ -401,6 +401,7 @@
|
||||||
lazy_data.fields[sel.coords.field_idx].field.presentation,
|
lazy_data.fields[sel.coords.field_idx].field.presentation,
|
||||||
);
|
);
|
||||||
datum_editor?.focus();
|
datum_editor?.focus();
|
||||||
|
try_sync_edit_to_cells();
|
||||||
}
|
}
|
||||||
} else if (ev.key === "Enter") {
|
} else if (ev.key === "Enter") {
|
||||||
if (ev.shiftKey) {
|
if (ev.shiftKey) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue