Skip to content

Commit

Permalink
🏷️ Add overload for Clipboard.dangerouslyPasteHTML()
Browse files Browse the repository at this point in the history
`Clipboard.dangerouslyPasteHTML()` is allowed to be called without an
index as its first argument.

At the moment, doing this results in a compilation error:

```
(method) Clipboard.dangerouslyPasteHTML(index: number, html: string, source?: EmitterSource): void
Expected 2-3 arguments, but got 1.ts(2554)
```

This change adds the overload to allow this.
  • Loading branch information
alecgibson authored and luin committed Jun 2, 2023
1 parent f9dc3df commit b3d1532
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,15 @@ class Clipboard extends Module<ClipboardOptions> {
);
}

dangerouslyPasteHTML(html: string, source?: EmitterSource): void;
dangerouslyPasteHTML(
index: number,
html: string,
source?: EmitterSource,
): void;
dangerouslyPasteHTML(
index: number | string,
html: string,
source: EmitterSource = Quill.sources.API,
) {
if (typeof index === 'string') {
Expand Down

0 comments on commit b3d1532

Please sign in to comment.