How to use the clipboard.isSupported function in clipboard

To help you get started, we’ve selected a few clipboard 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 getsentry / sentry / src / sentry / static / sentry / app / components / clipboard.tsx View on Github external
render() {
    const {children, hideUnsupported} = this.props;

    // Browser doesn't support `execCommand`
    if (hideUnsupported && !Clip.isSupported()) {
      return null;
    }

    if (!React.isValidElement(children)) {
      return null;
    }

    return React.cloneElement(children, {
      ref: this.handleMount,
    });
  }
}
github nihey / react-clipboard.js / index.js View on Github external
render() {
    const attributes = {
      title: this.props.title || '',
      type: this.getType(),
      className: this.props.className || '',
      style: this.props.style || {},
      ref: element => this.element = element,
      onClick: this.props.onClick,
      ...this.propsWith(/^data-/),
      ...this.propsWith(/^button-/, true),
    };

    const Clipboard = require('clipboard');
    if (!this.props.isVisibleWhenUnsupported && !Clipboard.isSupported()) {
      return null;
    }

    return React.createElement(
      this.getComponent(),
      attributes,
      this.props.children
    );
  }
github learningequality / kolibri / kolibri / core / assets / src / views / AppError / TechnicalTextBlock.vue View on Github external
clipboardCapable() {
        return ClipboardJS.isSupported();
      },
      dynamicHeightStyle() {
github EnMarche / en-marche.fr / front / pages / social_share.js View on Github external
export default (urlAll, urlCategory) => {
    if (Clipboard.isSupported()) {
        const confirmMessage = dom('#confirm-message');

        new Clipboard('.social__copy');

        findAll(dom('#je-partage'), '.social__copy').forEach((item) => {
            show(item);
            on(item, 'click', () => {
                addClass(confirmMessage, 'je-partage__copy--flash');
                setTimeout(() => { removeClass(confirmMessage, 'je-partage__copy--flash'); }, 700);
            });
        });
    }

    const categoryChooser = dom('#je-partage-category');

    on(categoryChooser, 'change', () => {
github veritone / veritone-sdk / packages / veritone-react-common / src / components / CopyPrompt / index.js View on Github external
this.props.args.map(
                arg =>
                  isString(arg) ? (
                    <span>{arg}</span>
                  ) : (
                    <span>
                      {arg.t}
                    </span>
                  )
              )}
          
        
        {Clipboard.isSupported() &amp;&amp; (
          <span>
            <button color="primary">
              Copy
            </button>
          </span>
        )}
      
    );
  }
}
github FlowCI / flow-web / src / components / ClipboardButton / index.js View on Github external
import React, { Component } from 'react'
import { string, func } from 'prop-types'

import clipboard from 'clipboard'
import ClipboardButton from 'react-clipboard.js'

export const supported = clipboard.isSupported()

export default class ClipboardButtonWrapper extends Component {
  static propTypes = {
    className: string,
    i18n: func.isRequired,
    onSuccess: func,
  }

  static defaultProps = {
    className: '',
    i18n: function (n) { return n },
  }

  state = {}

  componentWillUnmount () {
github vasttian / vue-admin-vuetify / src / utils / clipboard.js View on Github external
function handleClipboard(target, text) {
  if (!ClipboardJS.isSupported()) {
    Vue.prototype.$message({
      text: 'The current browser does not support copying',
      type: 'error',
    });
    return;
  }

  const clipboard = new ClipboardJS(target, {
    text: () => text,
  });

  function removeEventListener() {
    clipboard.off('error');
    clipboard.off('success');
    clipboard.destroy();
  }