mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
ui: scratchpad: check model existance
This commit is contained in:
1 parent
c6837a16e7
commit
8d3d6c022e
2 files changed
+4
-4
No files matched your search
@@ -56,10 +56,10 @@ export default connect(mapStateToProps, mapDispatchToProps)(class MonacoEditor e
|
||||
const {
|
||||
value, language, mainSize, recordSize, pretestSize,
|
||||
} = this.props;
|
||||
const { editor, model } = this;
|
||||
const { monaco } = await load([language]);
|
||||
const { editor, model } = this;
|
||||
const { LF } = monaco.editor.EndOfLinePreference;
|
||||
if (this.props.value != null && this.props.value !== model.getValue(LF, false)) {
|
||||
if (model && editor && this.props.value != null && this.props.value !== model.getValue(LF, false)) {
|
||||
this.__prevent_trigger_change_event = true;
|
||||
editor.pushUndoStop();
|
||||
model.pushEditOperations(
|
||||
@@ -74,7 +74,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class MonacoEditor e
|
||||
editor.pushUndoStop();
|
||||
this.__prevent_trigger_change_event = false;
|
||||
}
|
||||
if (prevProps.language !== language) {
|
||||
if (model && editor && prevProps.language !== language) {
|
||||
const val = model.getValue(LF, false);
|
||||
model.dispose();
|
||||
const uri = monaco.Uri.parse(`hydro://${UiContext.pdoc.pid || UiContext.pdoc.docId}.${language}`);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.39.5",
|
||||
"version": "4.39.6",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
|
||||
Reference in new issue
Block a user