fix: 修复编辑器切换面板自动滚动到中间的问题 (#11193)

This commit is contained in:
liaoxuezhi 2024-11-13 14:28:56 +08:00 committed by GitHub
parent b319016d88
commit 1074006b88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -250,7 +250,7 @@ export default class FormulaControl extends React.Component<
this.props
);
const rawType =
utils.RAW_TYPE_MAP[rendererSchema.type as SchemaType] || 'string';
utils.RAW_TYPE_MAP[rendererSchema?.type as SchemaType] || 'string';
const filterVars = variables
.map(item => {
if (item.children && item.type !== 'quickVars') {

View File

@ -48,7 +48,8 @@ export class CodeMirrorEditor extends React.Component<CodeMirrorEditorProps> {
this.props.editorFactory?.(this.dom.current!, cm, this.props) ??
cm(this.dom.current!, {
value: this.props.value || '',
readOnly: this.props.readOnly ? 'nocursor' : false
readOnly: this.props.readOnly ? 'nocursor' : false,
autofocus: false
});
this.props.editorDidMount?.(cm, this.editor);
@ -56,7 +57,7 @@ export class CodeMirrorEditor extends React.Component<CodeMirrorEditorProps> {
this.editor.on('blur', this.handleBlur);
this.editor.on('focus', this.handleFocus);
this.setValue(this.props.value);
this.props.value && this.setValue(this.props.value);
this.toDispose.push(
resizeSensor(this.dom.current as HTMLElement, () =>