fix: 修复 diffEditor disabled 状态不更新的问题 (#11078)

This commit is contained in:
liaoxuezhi 2024-10-18 17:18:01 +08:00 committed by GitHub
parent cf86d4f04e
commit 07b80316c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -24,6 +24,12 @@ export default class DiffEditor extends React.Component<DiffEditorProps> {
if (this.modifiedEditor && value !== prevProps.value) {
this.modifiedEditor.getModel().setValue(value || '');
}
if (this.props.disabled !== prevProps.disabled && this.modifiedEditor) {
this.modifiedEditor.updateOptions?.({
readOnly: this.props.disabled
});
}
}
componentWillUnmount() {