Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

Commit

Permalink
fix(core): fixed type of ClipboardJS.Event not being exported
Browse files Browse the repository at this point in the history
  • Loading branch information
favna committed May 19, 2021
1 parent a99663b commit 7a4e596
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* It contains typing information for all components that exist in this project.
*/
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
import { ClipboardJSEvent } from "./interfaces";
export namespace Components {
interface SyntaxHighlighter {
/**
Expand Down Expand Up @@ -66,7 +67,7 @@ declare namespace LocalJSX {
* @default undefined
* @example ```html <body> <syntax-highlighter id="example-highlight" theme="dark" language="typescript" content="console.log('example')" /> <script> const syntaxHighlighterElement = document.querySelector('#example-highlight'); syntaxHighlighterElement.addEventListener('clipboardJsError', event => { console.log('handling'); }); </script> </body> ```
*/
"onClipboardJsError"?: (event: CustomEvent<ClipboardJS.Event>) => void;
"onClipboardJsError"?: (event: CustomEvent<ClipboardJSEvent>) => void;
/**
* The theme to use, one of light or dark
* @default dark
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/components/syntax-highlighter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import 'prismjs/components/prism-visual-basic.min.js';
import 'prismjs/components/prism-wasm.min.js';
import 'prismjs/components/prism-wiki.min.js';
import 'prismjs/components/prism-yaml.min.js';
import type { ClipboardJSEvent } from '../interfaces';

@Component({
tag: 'syntax-highlighter',
Expand Down Expand Up @@ -107,7 +108,7 @@ export class SyntaxHighlighter implements ComponentWillLoad, ComponentInterface
* ```
*/
@Event({ bubbles: true })
public clipboardJsError: EventEmitter<ClipboardJS.Event>;
public clipboardJsError: EventEmitter<ClipboardJSEvent>;

/** The internal ref to the code block */
private codeBlockRef: HTMLInputElement;
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './components';
export * from './interfaces';
6 changes: 6 additions & 0 deletions packages/core/src/interfaces.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface ClipboardJSEvent {
action: string;
text: string;
trigger: Element;
clearSelection(): void;
}

0 comments on commit 7a4e596

Please sign in to comment.