feat: Allow checkboxes to be toggled without going into 'edit' mode (#1349)
This commit is contained in:
parent
169ad5b025
commit
bc4806ac30
@ -181,7 +181,7 @@ class DataLoader extends React.Component<Props> {
|
|||||||
revision={revision}
|
revision={revision}
|
||||||
abilities={abilities}
|
abilities={abilities}
|
||||||
location={location}
|
location={location}
|
||||||
readOnly={!this.isEditing}
|
readOnly={!this.isEditing || !abilities.update || document.isArchived}
|
||||||
onSearchLink={this.onSearchLink}
|
onSearchLink={this.onSearchLink}
|
||||||
onCreateLink={this.onCreateLink}
|
onCreateLink={this.onCreateLink}
|
||||||
/>
|
/>
|
||||||
|
@ -294,8 +294,16 @@ class DocumentScene extends React.Component<Props> {
|
|||||||
|
|
||||||
onChange = getEditorText => {
|
onChange = getEditorText => {
|
||||||
this.getEditorText = getEditorText;
|
this.getEditorText = getEditorText;
|
||||||
|
|
||||||
|
// document change while read only is presumed to be a checkbox edit,
|
||||||
|
// in that case we don't delay in saving for a better user experience.
|
||||||
|
if (this.props.readOnly) {
|
||||||
|
this.updateIsDirty();
|
||||||
|
this.onSave({ done: false, autosave: true });
|
||||||
|
} else {
|
||||||
this.updateIsDirtyDebounced();
|
this.updateIsDirtyDebounced();
|
||||||
this.autosave();
|
this.autosave();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onChangeTitle = event => {
|
onChangeTitle = event => {
|
||||||
@ -320,6 +328,7 @@ class DocumentScene extends React.Component<Props> {
|
|||||||
revision,
|
revision,
|
||||||
readOnly,
|
readOnly,
|
||||||
location,
|
location,
|
||||||
|
abilities,
|
||||||
auth,
|
auth,
|
||||||
ui,
|
ui,
|
||||||
match,
|
match,
|
||||||
@ -443,7 +452,8 @@ class DocumentScene extends React.Component<Props> {
|
|||||||
onSave={this.onSave}
|
onSave={this.onSave}
|
||||||
onPublish={this.onPublish}
|
onPublish={this.onPublish}
|
||||||
onCancel={this.goBack}
|
onCancel={this.goBack}
|
||||||
readOnly={readOnly || document.isArchived}
|
readOnly={readOnly}
|
||||||
|
readOnlyWriteCheckboxes={readOnly && abilities.update}
|
||||||
ui={this.props.ui}
|
ui={this.props.ui}
|
||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
@ -83,6 +83,7 @@ class DocumentEditor extends React.Component<Props> {
|
|||||||
placeholder="Start with a title…"
|
placeholder="Start with a title…"
|
||||||
value={!title && readOnly ? "Untitled" : title}
|
value={!title && readOnly ? "Untitled" : title}
|
||||||
style={startsWithEmojiAndSpace ? { marginLeft: "-1.2em" } : undefined}
|
style={startsWithEmojiAndSpace ? { marginLeft: "-1.2em" } : undefined}
|
||||||
|
readOnlyWriteCheckboxes
|
||||||
readOnly={readOnly}
|
readOnly={readOnly}
|
||||||
autoFocus={!title}
|
autoFocus={!title}
|
||||||
maxLength={100}
|
maxLength={100}
|
||||||
|
Reference in New Issue
Block a user