mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: add fill to pretest button (#1109)
This commit is contained in:
1 parent
0f75f7ce36
commit
c1327a55a2
3 files changed
+33
No files matched your search
@@ -57,6 +57,12 @@ code
|
|||||||
border-radius: 0px !important
|
border-radius: 0px !important
|
||||||
background: none !important
|
background: none !important
|
||||||
|
|
||||||
|
.scratchpad-fill-button
|
||||||
|
display: none
|
||||||
|
|
||||||
|
.mode--scratchpad .scratchpad-fill-button
|
||||||
|
display: inline-block
|
||||||
|
|
||||||
.token.tab:not(:empty),
|
.token.tab:not(:empty),
|
||||||
.token.cr,
|
.token.cr,
|
||||||
.token.lf,
|
.token.lf,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
|
import Notification from 'vj/components/notification';
|
||||||
import { AutoloadPage } from 'vj/misc/Page';
|
import { AutoloadPage } from 'vj/misc/Page';
|
||||||
import { i18n, tpl } from 'vj/utils';
|
import { i18n, tpl } from 'vj/utils';
|
||||||
|
|
||||||
@@ -33,6 +34,31 @@ const highlighterPage = new AutoloadPage('highlighterPage', () => {
|
|||||||
$output.parent().prepend($(tpl`<h2>${i18n('Sample Output')} ${id}</h2>`))
|
$output.parent().prepend($(tpl`<h2>${i18n('Sample Output')} ${id}</h2>`))
|
||||||
.addClass('medium-6 columns sample').appendTo($c);
|
.addClass('medium-6 columns sample').appendTo($c);
|
||||||
}
|
}
|
||||||
|
if ($root.find('.scratchpad-fill-button').length) return;
|
||||||
|
const $toolbar = $root.find('.toolbar');
|
||||||
|
const $button = $(tpl`
|
||||||
|
<div class="toolbar-item scratchpad-fill-button">
|
||||||
|
<a href="javascript:;">${i18n('Fill to Pretest')}</a>
|
||||||
|
</div>
|
||||||
|
`);
|
||||||
|
$button.on('click', (e) => {
|
||||||
|
const store = (window as any).store;
|
||||||
|
if (!store) return;
|
||||||
|
e.preventDefault();
|
||||||
|
try {
|
||||||
|
store.dispatch({
|
||||||
|
type: 'SCRATCHPAD_PRETEST_DATA_CHANGE',
|
||||||
|
payload: {
|
||||||
|
type: 'input',
|
||||||
|
value: $code.text(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
Notification.success(i18n('Input filled to pretest!'), 2000);
|
||||||
|
} catch (err) {
|
||||||
|
Notification.error(i18n('Failed to fill input'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$toolbar.append($button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -407,6 +407,7 @@ File uploaded successfully.: 上传文件成功
|
|||||||
File: 文件
|
File: 文件
|
||||||
Filename: 文件名
|
Filename: 文件名
|
||||||
Files: 文件
|
Files: 文件
|
||||||
|
Fill to Pretest: 填充到自测
|
||||||
Filter: 过滤
|
Filter: 过滤
|
||||||
First of Contest: 全场一血
|
First of Contest: 全场一血
|
||||||
First of Problem: 题目一血
|
First of Problem: 题目一血
|
||||||
|
|||||||
Reference in new issue
Block a user