How to use clipboard-copy - 10 common examples

To help you get started, we’ve selected a few clipboard-copy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nexxtway / react-rainbow / src / components / Lookup / __test__ / selectedValue.spec.js View on Github external
it('should copy value label to clipboard when input gets focus', () => {
        copyFn.mockReset();
        const component = mount();
        component.find('input').simulate('focus');
        expect(copyFn).toHaveBeenCalledWith(value.label);
    });
});
github deptno / dynamon / src / components / react-deep-json-table / BlueprintDJT.tsx View on Github external
handleFocusedCell = ({col, row, focusSelectionIndex}) => {
    const header = this.state.headers[col]
    const rowData = this.state.collection[row]
    const cell = rowData[header]

    copy(cell).then(() => console.log('copied'))

    if (Array.isArray(cell)) {
      this.setState({
        disabled: {
          cell      : false,
          collection: false,
          enter     : true,
        },
      })
      this.props.onItemSelected(cell)
    } else if (cell !== null && typeof cell === 'object') {
      this.setState({
        disabled: {
          cell      : false,
          collection: true,
          enter     : false,
github dmitrybubyakin / nova-medialibrary-field / resources / js / components / Medialibrary / Media.js View on Github external
async copy(as) {
    let value = null

    for (const copyAs of this.copyAs) {
      if (copyAs.as === as) {
        value = copyAs.value
      }
    }

    if (value === null) {
      value = this[as]
    }

    await copy(value)

    Nova.success(Nova.app.__('Copied!'))
  }
github microsoft / DLWorkspace / src / dashboard / src / pages / Home / GPUCard.tsx View on Github external
const handleCopy = React.useCallback(() => {
    if (input.current) {
      copy(input.current.innerHTML).then(()=>{
        setOpenCopyWarn(true)
      })

    }
  },[input])
  return (
github badges / shields / frontend / components / customizer / customizer.tsx View on Github external
async function copyMarkup(markupFormat: MarkupFormat) {
    const builtBadgeUrl = generateBuiltBadgeUrl()
    const markup = generateMarkup({
      badgeUrl: builtBadgeUrl,
      link,
      title,
      markupFormat,
    })

    try {
      await clipboardCopy(markup)
    } catch (e) {
      setMessage('Copy failed')
      setMarkup(markup)
      return
    }

    setMarkup(markup)
    if (indicatorRef.current) {
      indicatorRef.current.trigger()
    }
  }
github vtex / styleguide / react / docs / Pathline.js View on Github external
        onClick={() => copy(vtexIOString)}
        title="Copy to clipboard">
github decred / decrediton / app / components / CopyToClipboardButton.js View on Github external
onClick() {
    if(copy(this.props.textToCopy)) {
      this.setState({ showTooltip: true });
    }
  }
github vrk-kpa / suomifi-ui-components / src / core / Colors / Colors.tsx View on Github external
const onEnterPressed = (keyName: string) => (e: React.KeyboardEvent) => {
  if (e.key === 'Enter') {
    clipboardCopy(keyName);
  }
};

clipboard-copy

Lightweight copy to clipboard for the web

MIT
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis

Popular clipboard-copy functions