Sha256: 269258d3bf061d58cb930fb4755c200a19cfa98720602b9f25784eb9185c0593

Contents?: true

Size: 581 Bytes

Versions: 15

Compression:

Stored size: 581 Bytes

Contents

import { decodeEntities } from "@helpers/string";

export default function embedCodeDropdownComponent() {
  let copyTimeout = null;

  return {
    copied: false,

    copyEmbedCode() {
      this.$nextTick(async () => {
        const content = decodeEntities(this.$refs.copyTarget.innerHTML.trim());

        await window.navigator.clipboard.writeText(content);
        this.copied = true;

        if (copyTimeout) {
          clearTimeout(copyTimeout);
        }

        copyTimeout = setTimeout(() => {
          this.copied = false;
        }, 2000);
      });
    },
  };
}

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
lookbook-2.0.1 app/components/lookbook/embed_code_dropdown/component.js
lookbook-2.0.0 app/components/lookbook/embed_code_dropdown/component.js
lookbook-2.0.0.rc.3 app/components/lookbook/embed_code_dropdown/component.js
lookbook-2.0.0.rc.2 app/components/lookbook/embed_code_dropdown/component.js
lookbook-2.0.0.rc.1 app/components/lookbook/embed_code_dropdown/component.js
lookbook-2.0.0.beta.9 app/components/lookbook/embed_code_dropdown/component.js
lookbook-2.0.0.beta.8 app/components/lookbook/embed_code_dropdown/component.js
lookbook-2.0.0.beta.7 app/components/lookbook/embed_code_dropdown/component.js
lookbook-2.0.0.beta.6 app/components/lookbook/embed_code_dropdown/component.js
lookbook-2.0.0.beta.5 app/components/lookbook/embed_code_dropdown/component.js
lookbook-2.0.0.beta.4 app/components/lookbook/embed_code_dropdown/component.js
lookbook-2.0.0.beta.3 app/components/lookbook/embed_code_dropdown/component.js
lookbook-2.0.0.beta.2 app/components/lookbook/embed_code_dropdown/component.js
lookbook-2.0.0.beta.1 app/components/lookbook/embed_code_dropdown/component.js
lookbook-2.0.0.beta.0 app/components/lookbook/embed_code_dropdown/component.js