gristlabs_grist-core/app/client/widgets/CheckBoxEditor.js
Jarosław Sadziński 698c9d4e40 (core) Readonly editors
Summary:
Grist should not prevent read-only viewers from opening cell editors since they usually provide much more information than is visible in a cell.

Every editor was enhanced with a read-only mode that provides the same information available for an editor but doesn't allow to change the underlying data.

Test Plan: Browser tests

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2842
2021-06-17 19:12:16 +02:00

25 lines
733 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) {
if (typedVal === ' ') {
// This is a special case when user hits <space>. 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;