2020-10-02 15:10:00 +00:00
|
|
|
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
|
2023-12-08 05:59:42 +00:00
|
|
|
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
|
2020-10-02 15:10:00 +00:00
|
|
|
// this indicate that the editor should not open.
|
|
|
|
return !cellVal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-17 16:41:07 +00:00
|
|
|
// For documentation, see NewBaseEditor.ts
|
|
|
|
CheckBoxEditor.supportsReadonly = function() { return false; }
|
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
module.exports = CheckBoxEditor;
|