Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Allow CopyToClipboardService to receive a custom success message

Klaus Zandersf82bab0b4d72
diff --git a/frontend/src/app/shared/components/copy-to-clipboard/copy-to-clipboard.service.ts b/frontend/src/app/shared/components/copy-to-clipboard/copy-to-clipboard.service.ts
index 931a84c8c0a..1ae0b12a53a 100644
--- a/frontend/src/app/shared/components/copy-to-clipboard/copy-to-clipboard.service.ts
+++ b/frontend/src/app/shared/components/copy-to-clipboard/copy-to-clipboard.service.ts
@@ -40,14 +40,14 @@ export class CopyToClipboardService {
readonly I18n:I18nService,
) { }
- copy(content:string) {
+ copy(content:string, successMessage?:string) {
if (!navigator.clipboard) {
// fallback for browsers that don't support clipboard API at all
this.addNotification('addError', this.I18n.t('js.clipboard.browser_error', { content }));
} else {
void navigator.clipboard.writeText(content)
.then(() => {
- this.addNotification('addSuccess', this.I18n.t('js.clipboard.copied_successful'));
+ this.addNotification('addSuccess', successMessage || this.I18n.t('js.clipboard.copied_successful'));
})
.catch(() => {
// fallback when running into e.g. browser permission errors