gristlabs_grist-core/app/client/widgets/CheckBoxEditor.js
George Gevoian 7e05284cf2 (core) Add shortcut for opening Record Card
Summary: Also adds tests for previously untested Record Card behavior.

Test Plan: Browser tests.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4136
2023-12-08 11:32:45 -05:00

26 lines
832 B
JavaScript

var dispose = require('../lib/dispose');
var _ = require('underscore');
var TextEditor = require('./TextEditor');
function CheckBoxEditor(options) {
TextEditor.call(this, options);
}
dispose.makeDisposable(CheckBoxEditor);
_.extend(CheckBoxEditor.prototype, TextEditor.prototype);
// For documentation, see NewBaseEditor.ts
CheckBoxEditor.skipEditor = function(typedVal, cellVal, {event}) {
// eslint-disable-next-line no-undef
if (typedVal === '<enter>' || (event && event instanceof KeyboardEvent)) {
// This is a special case when user hits <enter>. We return the toggled value to save, and by
// this indicate that the editor should not open.
return !cellVal;
}
}
// For documentation, see NewBaseEditor.ts
CheckBoxEditor.supportsReadonly = function() { return false; }
module.exports = CheckBoxEditor;