diff --git a/src/app/tabs/settings-tab.js b/src/app/tabs/settings-tab.js index 29774aa9c3..b6e70462af 100644 --- a/src/app/tabs/settings-tab.js +++ b/src/app/tabs/settings-tab.js @@ -71,8 +71,8 @@ module.exports = class SettingsTab extends ViewPlugin { var gistAccessToken = yo`` var token = this.config.get('settings/gist-access-token') if (token) gistAccessToken.value = token - var gistAddToken = yo` { this.config.set('settings/gist-access-token', gistAccessToken.value); tooltip('Access token saved') }} value="Save" type="button">` - var gistRemoveToken = yo` { gistAccessToken.value = ''; this.config.set('settings/gist-access-token', ''); tooltip('Access token removed') }} value="Remove" type="button">` + var gistAddToken = yo` { this.config.set('settings/gist-access-token', gistAccessToken.value); tooltip('Access token saved') }} value="Save" type="button">` + var gistRemoveToken = yo` { gistAccessToken.value = ''; this.config.set('settings/gist-access-token', ''); tooltip('Access token removed') }} value="Remove" type="button">` this._view.gistToken = yo`
${gistAccessToken}${copyToClipboard(() => gistAccessToken.value)}${gistAddToken}${gistRemoveToken}
` this._view.optionVM = yo`` if (this.config.get('settings/always-use-vm') === undefined) this.config.set('settings/always-use-vm', true) diff --git a/src/app/ui/copy-to-clipboard.js b/src/app/ui/copy-to-clipboard.js index 1ae5bff759..85f88d0dd9 100644 --- a/src/app/ui/copy-to-clipboard.js +++ b/src/app/ui/copy-to-clipboard.js @@ -12,8 +12,8 @@ var css = csjs` } ` -module.exports = function copyToClipboard (getContent, tip = 'Copied value to clipboard', icon = 'fa-copy') { - var copyIcon = yo`` +module.exports = function copyToClipboard (getContent, tip = 'Copy value to clipboard', icon = 'fa-copy') { + var copyIcon = yo`` copyIcon.onclick = (event) => { event.stopPropagation() var copiableContent @@ -30,7 +30,7 @@ module.exports = function copyToClipboard (getContent, tip = 'Copied value to cl } } catch (e) {} copy(copiableContent) - addTooltip(tip) + addTooltip('Copied value to clipboard.') } else { addTooltip('Cannot copy empty content!') } diff --git a/test-browser/tests/generalSettings.js b/test-browser/tests/generalSettings.js index 27793ef0a6..649c91d75e 100644 --- a/test-browser/tests/generalSettings.js +++ b/test-browser/tests/generalSettings.js @@ -57,7 +57,7 @@ module.exports = { browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]') .click('*[data-id="copyToClipboardCopyIcon"]') .waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)') - .assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Copied value to clipboard') + .assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Copied value to clipboard.') .click('*[data-id="tooltipCloseButton"]') },