Sha256: 0b6f9ff3d0525b1fb4e52d34433df9d5f721610834fb906a12bf445cef0b547c

Contents?: true

Size: 433 Bytes

Versions: 2

Compression:

Stored size: 433 Bytes

Contents

export default function copy() {
  return {
    get content() {
      const target = document.getElementById(
        this.$root.getAttribute("data-target")
      );
      return (target ? target.innerHTML : "").trim();
    },
    done: false,
    async save() {
      await window.navigator.clipboard.writeText(this.content);
      this.done = true;
      setTimeout(() => {
        this.done = false;
      }, 1000);
    },
  };
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lookbook-0.5.1 app/assets/lookbook/js/components/copy.js
lookbook-0.5.0 app/assets/lookbook/js/components/copy.js