mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +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",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.6.19",
|
"version": "4.6.20",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
"babel-loader": "^8.2.2",
|
"babel-loader": "^8.2.2",
|
||||||
"babel-plugin-lodash": "^3.3.4",
|
"babel-plugin-lodash": "^3.3.4",
|
||||||
"babel-plugin-prismjs": "^2.0.1",
|
"babel-plugin-prismjs": "^2.0.1",
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.1",
|
||||||
"classnames": "^2.3.1",
|
"classnames": "^2.3.1",
|
||||||
"clipboard": "^2.0.8",
|
"clipboard": "^2.0.8",
|
||||||
"copy-webpack-plugin": "^6.1.1",
|
"copy-webpack-plugin": "^6.1.1",
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
"prop-types": "^15.7.2",
|
"prop-types": "^15.7.2",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"react-redux": "^7.2.3",
|
"react-redux": "^7.2.4",
|
||||||
"react-split-pane": "^0.1.92",
|
"react-split-pane": "^0.1.92",
|
||||||
"redux": "^4.0.5",
|
"redux": "^4.0.5",
|
||||||
"redux-logger": "^3.0.6",
|
"redux-logger": "^3.0.6",
|
||||||
|
|||||||
@@ -236,19 +236,23 @@ export default new NamedPage(['problem_create', 'problem_edit'], (pagename) => {
|
|||||||
if (isObject) {
|
if (isObject) {
|
||||||
if (content[i]) c = content[i];
|
if (content[i]) c = content[i];
|
||||||
else {
|
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]];
|
if (list.length) c = content[list[0]];
|
||||||
i = list[0];
|
[i] = list;
|
||||||
}
|
}
|
||||||
} else c = content;
|
} else c = content;
|
||||||
if (typeof c !== 'string') c = JSON.stringify(c);
|
if (typeof c !== 'string') c = JSON.stringify(c);
|
||||||
$dom.val(c);
|
$dom.val(c);
|
||||||
function onChange(val) {
|
function onChange(val) {
|
||||||
|
if (!isObject) {
|
||||||
|
content = { [i]: val };
|
||||||
|
isObject = true;
|
||||||
|
}
|
||||||
const empty = /^\s*$/g.test(val);
|
const empty = /^\s*$/g.test(val);
|
||||||
if (empty) delete content[i];
|
if (empty) delete content[i];
|
||||||
else content[i] = val;
|
else content[i] = val;
|
||||||
$main.val(JSON.stringify(content));
|
$main.val(JSON.stringify(content));
|
||||||
}
|
}
|
||||||
CmEditor.getOrConstruct($dom, { upload, onChange });
|
CmEditor.getOrConstruct($dom, { upload, onChange });
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user