mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
ui: fix problem_edit
This commit is contained in:
1 parent
23880f11fa
commit
d77d7d9ade
2 files changed
+10
-6
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.6.19",
|
||||
"version": "4.6.20",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
@@ -28,7 +28,7 @@
|
||||
"babel-loader": "^8.2.2",
|
||||
"babel-plugin-lodash": "^3.3.4",
|
||||
"babel-plugin-prismjs": "^2.0.1",
|
||||
"chalk": "^4.1.0",
|
||||
"chalk": "^4.1.1",
|
||||
"classnames": "^2.3.1",
|
||||
"clipboard": "^2.0.8",
|
||||
"copy-webpack-plugin": "^6.1.1",
|
||||
@@ -71,7 +71,7 @@
|
||||
"prop-types": "^15.7.2",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-redux": "^7.2.3",
|
||||
"react-redux": "^7.2.4",
|
||||
"react-split-pane": "^0.1.92",
|
||||
"redux": "^4.0.5",
|
||||
"redux-logger": "^3.0.6",
|
||||
|
||||
@@ -236,19 +236,23 @@ export default new NamedPage(['problem_create', 'problem_edit'], (pagename) => {
|
||||
if (isObject) {
|
||||
if (content[i]) c = content[i];
|
||||
else {
|
||||
const list = Object.keys(content).filter(l => l.startsWith(i));
|
||||
const list = Object.keys(content).filter((l) => l.startsWith(i));
|
||||
if (list.length) c = content[list[0]];
|
||||
i = list[0];
|
||||
[i] = list;
|
||||
}
|
||||
} else c = content;
|
||||
if (typeof c !== 'string') c = JSON.stringify(c);
|
||||
$dom.val(c);
|
||||
function onChange(val) {
|
||||
if (!isObject) {
|
||||
content = { [i]: val };
|
||||
isObject = true;
|
||||
}
|
||||
const empty = /^\s*$/g.test(val);
|
||||
if (empty) delete content[i];
|
||||
else content[i] = val;
|
||||
$main.val(JSON.stringify(content));
|
||||
}
|
||||
CmEditor.getOrConstruct($dom, { upload, onChange });
|
||||
})
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user