mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
ui: fix fileio pretest
This commit is contained in:
1 parent
dc4464c19a
commit
603f2938fb
6 files changed
+27
-29
No files matched your search
@@ -1,5 +0,0 @@
|
||||
const { spawnSync } = require('child_process');
|
||||
const os = require('os');
|
||||
if (os.platform() === 'linux') {
|
||||
spawnSync('bash download.sh');
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"scripts": {
|
||||
"prepublish": "node download.js"
|
||||
"prepublish": "./download.sh"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"hydrooj": "*"
|
||||
|
||||
@@ -114,18 +114,12 @@ class DiscussionNodeHandler extends DiscussionHandler {
|
||||
user.getList(domainId, uids),
|
||||
discussion.getNodes(domainId),
|
||||
]);
|
||||
const path = [
|
||||
['Hydro', 'homepage'],
|
||||
['discussion_main', 'discussion_main'],
|
||||
[this.vnode.title, null, true],
|
||||
];
|
||||
const vndict = { [typeMapper[type]]: { [name.toString()]: this.vnode } };
|
||||
this.response.template = 'discussion_main_or_node.html';
|
||||
this.response.body = {
|
||||
ddocs,
|
||||
dpcount,
|
||||
udict,
|
||||
path,
|
||||
page,
|
||||
vndict,
|
||||
vnode: this.vnode,
|
||||
|
||||
@@ -13,20 +13,28 @@ export default function DataInputComponent(props) {
|
||||
const cn = classNames(className, 'flex-col flex-fill');
|
||||
return (
|
||||
<div {...rest} className={cn}>
|
||||
{html // eslint-disable-next-line react/no-danger
|
||||
? <div className="scratchpad__data-input" wrap="off"><pre dangerouslySetInnerHTML={{ __html: value }} /></div>
|
||||
: (
|
||||
<textarea
|
||||
className="scratchpad__data-input"
|
||||
wrap="off"
|
||||
value={value}
|
||||
onChange={(ev) => {
|
||||
ev.stopPropagation();
|
||||
onChange(ev.target.value);
|
||||
}}
|
||||
placeholder={title}
|
||||
/>
|
||||
)}
|
||||
{html ? (
|
||||
<div
|
||||
className="scratchpad__data-input"
|
||||
style={{ overflowY: 'scroll' }}
|
||||
wrap="off"
|
||||
contentEditable
|
||||
>
|
||||
{/* eslint-disable-next-line react/no-danger */}
|
||||
<pre dangerouslySetInnerHTML={{ __html: value }} />
|
||||
</div>
|
||||
) : (
|
||||
<textarea
|
||||
className="scratchpad__data-input"
|
||||
wrap="off"
|
||||
value={value}
|
||||
onChange={(ev) => {
|
||||
ev.stopPropagation();
|
||||
onChange(ev.target.value);
|
||||
}}
|
||||
placeholder={title}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -90,9 +90,10 @@ export default connect(mapStateToProps, mapDispatchToProps)(class ScratchpadTool
|
||||
}
|
||||
const keys = Object.keys(LANGS);
|
||||
if (!keys.includes(this.props.editorLang)) this.props.setEditorLanguage(keys[0]);
|
||||
const canUsePretest = ['default', 'fileio'].includes(UiContext.pdoc.config?.type);
|
||||
return (
|
||||
<Toolbar>
|
||||
{UiContext.pdoc.config?.type === 'default' && (
|
||||
{canUsePretest && (
|
||||
<ToolbarButton
|
||||
disabled={this.props.isPosting || this.props.isRunning}
|
||||
className="scratchpad__toolbar__pretest"
|
||||
@@ -156,7 +157,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class ScratchpadTool
|
||||
</select>
|
||||
</ToolbarItem>
|
||||
<ToolbarSplit />
|
||||
{['default', 'fileio'].includes(UiContext.pdoc.config?.type) && (
|
||||
{canUsePretest && (
|
||||
<ToolbarButton
|
||||
activated={this.props.pretestVisible}
|
||||
onClick={() => this.props.togglePanel('pretest')}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.24.1",
|
||||
"version": "4.24.2",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
|
||||
Reference in new issue
Block a user