From 07b80316c9773da78c39645acdc2d1307fac994b Mon Sep 17 00:00:00 2001 From: liaoxuezhi <2698393+2betop@users.noreply.github.com> Date: Fri, 18 Oct 2024 17:18:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20diffEditor=20disabl?= =?UTF-8?q?ed=20=E7=8A=B6=E6=80=81=E4=B8=8D=E6=9B=B4=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#11078)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-ui/src/components/DiffEditor.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/amis-ui/src/components/DiffEditor.tsx b/packages/amis-ui/src/components/DiffEditor.tsx index b793d634d5e..4435f3fc477 100644 --- a/packages/amis-ui/src/components/DiffEditor.tsx +++ b/packages/amis-ui/src/components/DiffEditor.tsx @@ -24,6 +24,12 @@ export default class DiffEditor extends React.Component { 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() {