mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
core&ui: support pasting image in editor
This commit is contained in:
1 parent
6a289f788d
commit
8223b45d23
13 files changed
+131
-39
No files matched your search
@@ -264,10 +264,10 @@ export class ProblemModel {
|
||||
await bus.emit('problem/delTestdata', domainId, pid, names);
|
||||
}
|
||||
|
||||
static async addAdditionalFile(domainId: string, pid: number, name: string, f: Readable | Buffer | string) {
|
||||
static async addAdditionalFile(domainId: string, pid: number, name: string, f: Readable | Buffer | string, skipUpload = false) {
|
||||
const [[, fileinfo]] = await Promise.all([
|
||||
document.getSub(domainId, document.TYPE_PROBLEM, pid, 'additional_file', name),
|
||||
storage.put(`problem/${domainId}/${pid}/additional_file/${name}`, f),
|
||||
skipUpload || storage.put(`problem/${domainId}/${pid}/additional_file/${name}`, f),
|
||||
]);
|
||||
const meta = await storage.getMeta(`problem/${domainId}/${pid}/additional_file/${name}`);
|
||||
const payload = { name, ...pick(meta, ['size', 'lastModified', 'etag']) };
|
||||
|
||||
Reference in new issue
Block a user