diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 04a581558..a334b392a 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -413,6 +413,18 @@ "debugLogError": { "message": "Something went wrong with the upload! Please consider manually adding your log to the bug you file." }, + "debugLogCopy": { + "message": "Copy", + "description": "Shown as the text for the copy button on the debug log screen" + }, + "debugLogCopyAlt": { + "message": "Copy link to your clipboard", + "description": "Shown as the alt text for the copy button on the debug log screen" + }, + "debugLogLinkCopied": { + "message": "Link Copied to Your Clipboard", + "description": "Shown in a taost to let the user know that the link to the debug log has been copied to their clipboard" + }, "reportIssue": { "message": "Report an issue", "description": "Link to open the issue tracker" diff --git a/debug_log.html b/debug_log.html index dff42777a..9387f33c1 100644 --- a/debug_log.html +++ b/debug_log.html @@ -38,7 +38,7 @@ + + diff --git a/debug_log_preload.js b/debug_log_preload.js index 407f6f963..401eeda82 100644 --- a/debug_log_preload.js +++ b/debug_log_preload.js @@ -2,6 +2,7 @@ const { ipcRenderer } = require('electron'); const url = require('url'); +const copyText = require('copy-text-to-clipboard'); const i18n = require('./js/modules/i18n'); const config = url.parse(window.location.toString(), true).query; @@ -11,6 +12,7 @@ const localeMessages = ipcRenderer.sendSync('locale-data'); window.getVersion = () => config.version; window.theme = config.theme; window.i18n = i18n.setup(locale, localeMessages); +window.copyText = copyText; // got.js appears to need this to successfully submit debug logs to the cloud window.nodeSetImmediate = setImmediate; diff --git a/images/icons/v2/open-24.svg b/images/icons/v2/open-24.svg deleted file mode 100644 index bff343e2a..000000000 --- a/images/icons/v2/open-24.svg +++ /dev/null @@ -1 +0,0 @@ -open-24 \ No newline at end of file diff --git a/js/views/debug_log_view.js b/js/views/debug_log_view.js index 9f0ffaa2c..20775696a 100644 --- a/js/views/debug_log_view.js +++ b/js/views/debug_log_view.js @@ -7,17 +7,33 @@ window.Whisper = window.Whisper || {}; + Whisper.LinkedCopiedToast = Whisper.ToastView.extend({ + render_attributes() { + return { toastMessage: i18n('debugLogLinkCopied') }; + }, + }); + Whisper.DebugLogLinkView = Whisper.View.extend({ templateName: 'debug-log-link', initialize(options) { this.url = options.url; }, + events: { + 'click .copy': 'copy', + }, render_attributes() { return { url: this.url, reportIssue: i18n('reportIssue'), + debugLogCopy: i18n('debugLogCopy'), + debugLogCopyAlt: i18n('debugLogCopyAlt'), }; }, + copy(e) { + e.preventDefault(); + window.copyText(e.currentTarget.href); + Whisper.ToastView.show(Whisper.LinkedCopiedToast, document.body); + }, }); Whisper.DebugLogView = Whisper.View.extend({ templateName: 'debug-log', diff --git a/stylesheets/_debugLog.scss b/stylesheets/_debugLog.scss index 348433c0d..9120c7184 100644 --- a/stylesheets/_debugLog.scss +++ b/stylesheets/_debugLog.scss @@ -30,7 +30,7 @@ .result { $link-max-width: 400px; - $open-width: 72px; + $open-width: 100px; $open-height: 36px; text-align: center; @@ -41,14 +41,16 @@ max-width: $group-max-width; } - $open-pad-x: ($open-width - 22px) / 2; + $open-pad-x: ($open-width - 40px) / 2; $open-pad-y: ($open-height - 22px) / 2; - .open { + .copy { float: left; display: inline-block; width: $open-width; height: $open-height; padding: $open-pad-y $open-pad-x; + color: unset; + text-decoration: none; cursor: pointer; border-radius: 0 5px 5px 0; @@ -56,24 +58,16 @@ @include light-theme { border: solid 1px $color-gray-25; background: $color-gray-02; + &:active { + background: $color-gray-25; + } } @include dark-theme { border: solid 1px $color-gray-45; background-color: $color-gray-90; color: $color-gray-02; - } - - &:before { - content: ''; - display: block; - width: 24px; - height: 24px; - - @include light-theme { - @include header-icon-black('../images/icons/v2/open-24.svg'); - } - @include dark-theme { - @include header-icon-white('../images/icons/v2/open-24.svg'); + &:active { + background: $color-gray-25; } } } diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index 987a823aa..1c0229c07 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -370,72 +370,72 @@ "rule": "jQuery-$(", "path": "js/views/debug_log_view.js", "line": " this.$('textarea').val(i18n('loading'));", - "lineNumber": 27, + "lineNumber": 43, "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", + "updated": "2020-05-01T17:11:39.527Z", "reasonDetail": "Protected from arbitrary input" }, { "rule": "jQuery-$(", "path": "js/views/debug_log_view.js", "line": " this.$('textarea').val(text);", - "lineNumber": 31, + "lineNumber": 47, "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", + "updated": "2020-05-01T17:11:39.527Z", "reasonDetail": "Protected from arbitrary input" }, { "rule": "jQuery-$(", "path": "js/views/debug_log_view.js", "line": " const text = this.$('textarea').val();", - "lineNumber": 50, + "lineNumber": 66, "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", + "updated": "2020-05-01T17:11:39.527Z", "reasonDetail": "Protected from arbitrary input" }, { "rule": "jQuery-$(", "path": "js/views/debug_log_view.js", "line": " this.$('.buttons, textarea').remove();", - "lineNumber": 55, + "lineNumber": 71, "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", + "updated": "2020-05-01T17:11:39.527Z", "reasonDetail": "Protected from arbitrary input" }, { "rule": "jQuery-$(", "path": "js/views/debug_log_view.js", "line": " el: this.$('.result'),", - "lineNumber": 62, + "lineNumber": 78, "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", + "updated": "2020-05-01T17:11:39.527Z", "reasonDetail": "Protected from arbitrary input" }, { "rule": "jQuery-$(", "path": "js/views/debug_log_view.js", "line": " this.$('.loading').removeClass('loading');", - "lineNumber": 64, + "lineNumber": 80, "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", + "updated": "2020-05-01T17:11:39.527Z", "reasonDetail": "Protected from arbitrary input" }, { "rule": "jQuery-$(", "path": "js/views/debug_log_view.js", "line": " this.$('.link')", - "lineNumber": 66, + "lineNumber": 82, "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", + "updated": "2020-05-01T17:11:39.527Z", "reasonDetail": "Protected from arbitrary input" }, { "rule": "jQuery-$(", "path": "js/views/debug_log_view.js", "line": " this.$('.loading').removeClass('loading');", - "lineNumber": 74, + "lineNumber": 90, "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", + "updated": "2020-05-01T17:11:39.527Z", "reasonDetail": "Protected from arbitrary input" }, {