-
-
Notifications
You must be signed in to change notification settings - Fork 79k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed incorrect instructions: "Press ⌘ to copy" #20602
Conversation
It needed to be "Press ⌘C to copy"
According to http://www.fileformat.info/info/unicode/char/2318C/index.htm this PR would be wrong |
@wolfy1339 Have you tried the code in your browser? The last C is the letter "C" and not part of the character. u2318 renders the command icon (⌘) |
Yes I have, but It can be mis-interpreted as another Unicode glyph. So it would be better to use string concatenation to avoid any potential bugs when using any other font than the ones in default Bootstrap |
Why not simply using |
@Kovah I do not recommend that as Apple stylizes shortcuts without a '+' sign, and adding a '+' could possibly confuse users. There is no '+' action between the ⌘ and the C, so ⌘C makes the most sense. |
Updated copy command to concatenated string to prevent potential issues
@@ -73,7 +73,7 @@ | |||
}) | |||
|
|||
clipboard.on('error', function (e) { | |||
var fallbackMsg = /Mac/i.test(navigator.userAgent) ? 'Press \u2318 to copy' : 'Press Ctrl-C to copy' | |||
var fallbackMsg = /Mac/i.test(navigator.userAgent) ? 'Press \u2318' + 'C to copy' : 'Press Ctrl-C to copy' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected var, use let or const instead no-var
Unexpected string concatenation of literals no-useless-concat
I updated it to concatenate the two pieces. Should this work now? |
I'd recommend |
@tomlutzenberger I don't recommend that, at least for Mac users, who this PR applies to.
|
Hm okay... const modifierKey = /Mac/i.test(navigator.userAgent) ? '\u2318' : 'Ctrl-';
let fallbackMsg = 'Press ' + modifierKey + 'C to copy'; That way you dodge unnecessary string concatenation AND prevent duplicate code/text. |
As per excellent suggestion by @tomlutzenberger
@@ -73,7 +73,8 @@ | |||
}) | |||
|
|||
clipboard.on('error', function (e) { | |||
var fallbackMsg = /Mac/i.test(navigator.userAgent) ? 'Press \u2318 to copy' : 'Press Ctrl-C to copy' | |||
const modifierKey = /Mac/i.test(navigator.userAgent) ? '\u2318' : 'Ctrl-'; | |||
let fallbackMsg = 'Press ' + modifierKey + 'C to copy'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected string concatenation prefer-template
Extra semicolon semi
Oh yes, I forgot. They have this "no-semicolon-on-line-endings"-Rule. |
@tomlutzenberger Done. Thanks dude! |
Why do the checks still fail? //cc @cvrebert |
@tjkohli could you rebase and squash these commits, and force push the branch again. This will also trigger Travis to rebuild this PR. |
* Fixed incorrect instruction: "Press ⌘ to copy" It needed to be "Press ⌘C to copy" * Updated to concatenate copy string Updated copy command to concatenated string to prevent potential issues * Updated the way the copy string concatenates As per excellent suggestion by @tomlutzenberger * Removed semicolon line endings ;P * var not const or let
Merged this with #21236, so closing. Thanks! |
Changed to "Press ⌘C to copy"