ui: scratchpad: handle duplicate click event

This commit is contained in:
undefined committed 2022-10-16 21:51:48 +08:00
1 parent f030c32813
commit e964eec099
3 files changed
+11 -3

No files matched your search

@@ -26,7 +26,7 @@ export default connect((state: any) => ({
}); });
}, },
}))(class MonacoEditor extends React.PureComponent<ScratchpadOptions> { }))(class MonacoEditor extends React.PureComponent<ScratchpadOptions> {
disposable = []; disposable: monaco.IDisposable[] = [];
__prevent_trigger_change_event = false; __prevent_trigger_change_event = false;
model: monaco.editor.ITextModel; model: monaco.editor.ITextModel;
editor: monaco.editor.IStandaloneCodeEditor; editor: monaco.editor.IStandaloneCodeEditor;
@@ -78,7 +78,7 @@ export default connect((state: any) => ({
[ [
{ {
range: model.getFullModelRange(), range: model.getFullModelRange(),
text: value, text: value!,
}, },
], ],
() => null, () => null,
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/ui-default", "name": "@hydrooj/ui-default",
"version": "4.41.15", "version": "4.41.16",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "index.ts", "main": "index.ts",
@@ -163,18 +163,26 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
$('.loader-container').hide(); $('.loader-container').hide();
} }
let progress = false;
async function enterScratchpadMode() { async function enterScratchpadMode() {
if (progress) return;
progress = true;
await extender.extend(); await extender.extend();
await loadReact(); await loadReact();
renderReact(); renderReact();
await scratchpadFadeIn(); await scratchpadFadeIn();
progress = false;
} }
async function leaveScratchpadMode() { async function leaveScratchpadMode() {
if (progress) return;
progress = true;
await scratchpadFadeOut(); await scratchpadFadeOut();
$('.problem-content-container').append($('.problem-content')); $('.problem-content-container').append($('.problem-content'));
await extender.collapse(); await extender.collapse();
unmountReact(); unmountReact();
progress = false;
} }
async function loadObjective() { async function loadObjective() {