mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Fixing DELETE and BACKSPACE keys on ChoiceList and RefList editor.
Summary: Choice/Reference List editor wasn't clearing itself when it received an empty string. It led to a bug on the Card widget where pressing those keys resulted in the same behavior as pressing Enter - it just opened the editor. Grid view has it's own implementation for those keys, so it wasn't affected. Test Plan: Added new test. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3908
This commit is contained in:
@@ -66,7 +66,7 @@ export class ChoiceListEditor extends NewBaseEditor {
|
||||
|
||||
// If starting to edit by typing in a string, ignore previous tokens.
|
||||
const cellValue = decodeObject(options.cellValue);
|
||||
const startLabels: unknown[] = options.editValue || !Array.isArray(cellValue) ? [] : cellValue;
|
||||
const startLabels: unknown[] = options.editValue !== undefined || !Array.isArray(cellValue) ? [] : cellValue;
|
||||
const startTokens = startLabels.map(label => new ChoiceItem(String(label), !choiceSet.has(String(label))));
|
||||
|
||||
this._tokenField = TokenField.ctor<ChoiceItem>().create(this, {
|
||||
|
||||
@@ -73,7 +73,7 @@ export class ReferenceListEditor extends NewBaseEditor {
|
||||
|
||||
// If starting to edit by typing in a string, ignore previous tokens.
|
||||
const cellValue = decodeObject(options.cellValue);
|
||||
const startRowIds: unknown[] = options.editValue || !Array.isArray(cellValue) ? [] : cellValue;
|
||||
const startRowIds: unknown[] = options.editValue !== undefined || !Array.isArray(cellValue) ? [] : cellValue;
|
||||
|
||||
// If referenced table hasn't loaded yet, hold off on initializing tokens.
|
||||
const needReload = (options.editValue === undefined && !this._utils.tableData.isLoaded);
|
||||
|
||||
Reference in New Issue
Block a user