1.1.4 • Published 1 year ago

gs-clipboard v1.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

gs-chipboard

// docs working on it!

import { GsClipboard } from "@/GsClipboard/GsClipboard";
import { Handler } from "@/GsClipboard/handlers";

class HyperlinkHandler implements Handler {
  public type = "hyperlink";
  toText(value: any): string {
    return value;
  }
  toHtml(value: any): string {
    return value;
  }
  parse(value: any): any {
    return value;
  }
}

const GS = new GsClipboard({
  handlers: [new HyperlinkHandler()],
});

GS.on("copySucceeded", () => {
  console.log("copySucceeded");
});

GS.on("copyFailed", (rej) => {
  console.log(rej);
});

document.getElementById("copy").addEventListener("click", () => {
  GS.setCopy(["123", "456"]);
});

//  set as hyperlink
document.getElementById("copy").addEventListener("click", () => {
  GS.setCopy([{
    value: {
      link: "https://google.com",
      title: "google",
      attrs:{}
    },
    type: EBuildInHandlers.HYPERLINK
  }]);
});

document.getElementById("getData").addEventListener("click", async () => {
  console.log(await GS.getDataFromClipboard());
});
1.1.4

1 year ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

0.0.9

2 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago