From b7e95cc48cc0e0d6fe24c89bb83da5b84a74490f Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 21 May 2026 09:39:09 +0200 Subject: [PATCH] feat: add copy button to action step header, improve other copy buttons (#37744) - Adds a copy button to each action step header that copies the step's rendered log output to clipboard. - Extract a shared `copyToClipboard(target, content)` helper in `clipboard.ts` that adds SVG success/failure feedback. - `is-loading` height for the new helper is sourced from `--loading-size`. - Change actions log timestamp format to include seconds. The indented-markdown code-block fix has moved to #37748. copystep copybt Fixes: https://github.com/go-gitea/gitea/issues/26116 --- This PR was written with the help of Claude Opus 4.7 --------- Signed-off-by: silverwind Co-authored-by: Claude (Opus 4.7) Co-authored-by: wxiaoguang Co-authored-by: Nicolas --- options/locale/locale_en-US.json | 1 + templates/base/head_script.tmpl | 4 +- templates/repo/actions/view_component.tmpl | 1 + .../repo/issue/view_content/context_menu.tmpl | 10 +-- templates/repo/view_content.tmpl | 2 +- web_src/css/modules/animations.css | 3 +- web_src/js/components/ActionRunJobView.vue | 73 +++++++++++---- web_src/js/features/clipboard.ts | 40 --------- web_src/js/features/copycontent.ts | 57 +++--------- web_src/js/features/dropzone.ts | 10 +-- web_src/js/features/repo-actions.ts | 1 + web_src/js/features/repo-code.ts | 3 +- web_src/js/index.ts | 4 +- web_src/js/modules/clipboard.ts | 90 +++++++++++++++++++ web_src/js/modules/codeeditor/context-menu.ts | 6 +- web_src/js/utils/time.ts | 19 ++-- 16 files changed, 194 insertions(+), 130 deletions(-) delete mode 100644 web_src/js/features/clipboard.ts create mode 100644 web_src/js/modules/clipboard.ts diff --git a/options/locale/locale_en-US.json b/options/locale/locale_en-US.json index 1abfe647c81..1ed99f724bc 100644 --- a/options/locale/locale_en-US.json +++ b/options/locale/locale_en-US.json @@ -105,6 +105,7 @@ "copy_error": "Copy failed", "copy_type_unsupported": "This file type cannot be copied", "copy_filename": "Copy filename", + "copy_output": "Copy output", "write": "Write", "preview": "Preview", "loading": "Loading…", diff --git a/templates/base/head_script.tmpl b/templates/base/head_script.tmpl index 1f21c5bee53..1a59f87317e 100644 --- a/templates/base/head_script.tmpl +++ b/templates/base/head_script.tmpl @@ -19,13 +19,13 @@ If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly. sharedWorkerUri: '{{AssetURI "js/eventsource.sharedworker.js"}}', {{/* this global i18n object should only contain general texts. for specialized texts, it should be provided inside the related modules by: (1) API response (2) HTML data-attribute (3) PageData */}} i18n: { - copy_success: {{ctx.Locale.Tr "copy_success"}}, - copy_error: {{ctx.Locale.Tr "copy_error"}}, error_occurred: {{ctx.Locale.Tr "error.occurred"}}, remove_label_str: {{ctx.Locale.Tr "remove_label_str"}}, modal_confirm: {{ctx.Locale.Tr "modal.confirm"}}, modal_cancel: {{ctx.Locale.Tr "modal.cancel"}}, more_items: {{ctx.Locale.Tr "more_items"}}, + copy_success: {{ctx.Locale.Tr "copy_success"}}, + copy_error: {{ctx.Locale.Tr "copy_error"}}, }, }; {{/* in case some pages don't render the pageData, we make sure it is an object to prevent null access */}} diff --git a/templates/repo/actions/view_component.tmpl b/templates/repo/actions/view_component.tmpl index 827c04d1852..95fb1522466 100644 --- a/templates/repo/actions/view_component.tmpl +++ b/templates/repo/actions/view_component.tmpl @@ -36,6 +36,7 @@ data-locale-show-log-seconds="{{ctx.Locale.Tr "show_log_seconds"}}" data-locale-show-full-screen="{{ctx.Locale.Tr "show_full_screen"}}" data-locale-download-logs="{{ctx.Locale.Tr "download_logs"}}" + data-locale-copy-output="{{ctx.Locale.Tr "copy_output"}}" data-locale-logs-always-auto-scroll="{{ctx.Locale.Tr "actions.logs.always_auto_scroll"}}" data-locale-logs-always-expand-running="{{ctx.Locale.Tr "actions.logs.always_expand_running"}}" > diff --git a/templates/repo/issue/view_content/context_menu.tmpl b/templates/repo/issue/view_content/context_menu.tmpl index e28d20a2716..d3c2f8932e4 100644 --- a/templates/repo/issue/view_content/context_menu.tmpl +++ b/templates/repo/issue/view_content/context_menu.tmpl @@ -3,13 +3,13 @@ {{svg "octicon-kebab-horizontal"}}