fix: prevent history from crashing due to missing EditorView (#3257)
* put the editor into read only mode when examining history
This commit is contained in:
@@ -118,7 +118,7 @@ export type Props = {
|
|||||||
/** Callback when user uses cancel key combo */
|
/** Callback when user uses cancel key combo */
|
||||||
onCancel?: () => void;
|
onCancel?: () => void;
|
||||||
/** Callback when user changes editor content */
|
/** Callback when user changes editor content */
|
||||||
onChange?: (value: () => string) => void;
|
onChange?: (value: () => string | undefined) => void;
|
||||||
/** Callback when a file upload begins */
|
/** Callback when a file upload begins */
|
||||||
onFileUploadStart?: () => void;
|
onFileUploadStart?: () => void;
|
||||||
/** Callback when a file upload ends */
|
/** Callback when a file upload ends */
|
||||||
@@ -629,7 +629,7 @@ export class Editor extends React.PureComponent<
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.props.onChange(() => {
|
this.props.onChange(() => {
|
||||||
return this.value();
|
return this.view ? this.value() : undefined;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -272,7 +272,11 @@ class DataLoader extends React.Component<Props> {
|
|||||||
revision,
|
revision,
|
||||||
abilities,
|
abilities,
|
||||||
isEditing: this.isEditing,
|
isEditing: this.isEditing,
|
||||||
readOnly: !this.isEditing || !abilities.update || document.isArchived,
|
readOnly:
|
||||||
|
!this.isEditing ||
|
||||||
|
!abilities.update ||
|
||||||
|
document.isArchived ||
|
||||||
|
!!revisionId,
|
||||||
onSearchLink: this.onSearchLink,
|
onSearchLink: this.onSearchLink,
|
||||||
onCreateLink: this.onCreateLink,
|
onCreateLink: this.onCreateLink,
|
||||||
sharedTree: this.sharedTree,
|
sharedTree: this.sharedTree,
|
||||||
|
|||||||
Reference in New Issue
Block a user