ui: problemconfig: support delete subtask

This commit is contained in:
undefined committed 2023-03-16 03:08:52 +08:00
1 parent 4300751c26
commit 04f9be778c
3 files changed
+40 -11

No files matched your search

@@ -96,7 +96,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class MonacoEditor e
async componentDidMount() {
const { monaco } = await load(['yaml']);
const uri = monaco.Uri.parse('hydro://problem/file/config.yaml');
this.model = monaco.editor.createModel(yaml.dump(configYamlFormat(this.props.config)), 'yaml', uri);
this.model = monaco.editor.createModel(yaml.dump(configYamlFormat(this.props.config), { noArrayIndent: true }), 'yaml', uri);
this.vjEditor = Editor.getOrConstruct($(this.containerElement), {
language: 'yaml',
model: this.model,
@@ -112,7 +112,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class MonacoEditor e
componentDidUpdate(prevProps) {
if (this.__preventUpdate || !this.model || !this.props.config.__valid) return;
if (yaml.dump(prevProps.config) === yaml.dump(this.props.config)) return;
if (yaml.dump(prevProps.config, { noArrayIndent: true }) === yaml.dump(this.props.config, { noArrayIndent: true })) return;
const curValue = this.model.getValue();
const pending = configYamlFormat(this.props.config);
try {
@@ -120,7 +120,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class MonacoEditor e
if (isEqual(curConfig, pending)) return;
} catch { }
this.__preventFormat = true;
const diff = diffLines(curValue, yaml.dump(pending));
const diff = diffLines(curValue, yaml.dump(pending, { noArrayIndent: true }));
const ops = [];
let cursor = 1;
for (const line of diff) {