From 64c858cdf7dccea74e707a87006849a61bd86517 Mon Sep 17 00:00:00 2001 From: panda Date: Mon, 1 Apr 2024 20:17:11 +0800 Subject: [PATCH] ui: fix files link & title (#773) --- packages/hydrooj/locales/zh.yaml | 2 ++ packages/ui-default/components/preview/preview.page.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/hydrooj/locales/zh.yaml b/packages/hydrooj/locales/zh.yaml index 1e3957e50..e60508001 100644 --- a/packages/hydrooj/locales/zh.yaml +++ b/packages/hydrooj/locales/zh.yaml @@ -376,6 +376,7 @@ homework_detail_problem_submit: 递交作业题目 homework_detail_problem: 题目详情 homework_detail: 作业详情 homework_edit: 编辑作业 +homework_files: 作业文件 homework_main: 作业 homework_scoreboard: 作业成绩表 homework_status: 作业成绩表 @@ -816,6 +817,7 @@ Training requirement is not satisfied.: 不满足训练条件。 training_create: 创建训练 training_detail: 训练详情 training_edit: 编辑训练 +training_files: 训练文件 training_main: 训练 Training: 训练 Trainings per page: 每页展示的训练数量 diff --git a/packages/ui-default/components/preview/preview.page.ts b/packages/ui-default/components/preview/preview.page.ts index 965adfcfd..10d8a2e5a 100644 --- a/packages/ui-default/components/preview/preview.page.ts +++ b/packages/ui-default/components/preview/preview.page.ts @@ -46,7 +46,8 @@ const dialogAction = (id) => [ ]; function bindCopyLink(id, src: string) { - const url = !(window.location.href.endsWith('file') || window.location.href.endsWith('files')) || window.location.href.match('contest/.*/file') + const url = !(window.location.href.endsWith('file') || window.location.href.endsWith('files')) + || window.location.href.match('homework/.*/file') || window.location.href.match('training/.*/file') ? `file://${src.substring(src.lastIndexOf('/') + 1)}` : src; const clip = new Clipboard(`#copy-${id}`, { text: () => `${url}` }); clip.on('success', () => Notification.success(i18n(`${url.startsWith('file://') ? 'Reference' : 'Download'} link copied to clipboard!`)));