Support cmd+click on mac

This commit is contained in:
Daniel Imms
2017-03-03 12:37:34 -08:00
parent 012051c1db
commit 15a867d2b7
+3 -2
View File
@@ -2,6 +2,7 @@
* @license MIT
*/
import { isMac } from './utils/Browser';
import { LinkMatcherOptions } from './Interfaces';
import { LinkMatcher, LinkMatcherHandler, LinkMatcherValidationCallback } from './Types';
@@ -239,7 +240,7 @@ export class Linkifier {
return;
}
// Require ctrl on click
if (event.ctrlKey) {
if (isMac ? event.metaKey : event.ctrlKey) {
handler(uri);
}
});
@@ -249,7 +250,7 @@ export class Linkifier {
element.target = '_blank';
element.addEventListener('click', (event: KeyboardEvent) => {
// Require ctrl on click
if (!event.ctrlKey) {
if (isMac ? !event.metaKey : !event.ctrlKey) {
event.preventDefault();
return false;
}