feat: add onLinkOpen component prop (#4694)

Co-authored-by: ad1992 <aakansha1216@gmail.com>
This commit is contained in:
David Luzar 2022-02-08 11:25:35 +01:00 committed by GitHub
parent 050bc1ce2b
commit a066317d3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 128 additions and 32 deletions

View file

@ -2,6 +2,7 @@ import colors from "./colors";
import {
CURSOR_TYPE,
DEFAULT_VERSION,
EVENT,
FONT_FAMILY,
WINDOWS_EMOJI_FALLBACK_FONT,
} from "./constants";
@ -523,3 +524,12 @@ export const arrayToMap = <T extends { id: string } | string>(
export const isTestEnv = () =>
typeof process !== "undefined" && process.env?.NODE_ENV === "test";
export const wrapEvent = <T extends Event>(name: EVENT, nativeEvent: T) => {
return new CustomEvent(name, {
detail: {
nativeEvent,
},
cancelable: true,
});
};