How to use the clipboard-polyfill.writeText function in clipboard-polyfill

To help you get started, we’ve selected a few clipboard-polyfill 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 manifoldco / ui / src / components / manifold-copy-credentials / manifold-copy-credentials.tsx View on Github external
private handleClick() {
    if (this.credentials) {
      clipboard
        .writeText(this.credentials)
        .then(() => {
          const detail: SuccessDetail = { resourceLabel: this.resourceLabel };
          this.success.emit(detail);
        })
        .catch(() => {
          const message = 'couldn’t access clipboard';
          const detail: ErrorDetail = { message, resourceLabel: this.resourceLabel };
          this.error.emit(detail);
          console.error(message);
        });
    }
  }
github hugetiny / negibox / src / components / Task / TaskItemActions.vue View on Github external
.then((data) => {
          const { btTracker } = data
          const uri = getTaskUri(this.task, btTracker)
          clipboard.writeText(uri)
            .then(() => {
              console.log(this.$t('copy-link-success'))
            })
        })
    },
github nitin42 / react-color-tools / build / react-color-tools.es.js View on Github external
(_this.copyColor = function() {
        var _this$state = _this.state,
          color = _this$state.color,
          currentFormat = _this$state.currentFormat

        var activeColor = _this.getColor(color)[currentFormat]

        clipboard.writeText(activeColor)
        _this.setState({ showMsg: true })
      }),
      _temp)),
github Army-U / avi / src / utils / copy.js View on Github external
export function copyText (text) {
  return clipboard.writeText(text)
    .then(() => {
      const shortText = short(text)
      notice({ title: t('copy.copied'), body: text }, function () {
        message.success(`${t('copy.copied')}: ${shortText}`, 0.7)
      })
    }, copyFailure)
}
github nitin42 / react-color-tools / src / pickers / BasicPicker.js View on Github external
copyColor = () => {
    const { color, currentFormat } = this.state
    const activeColor = this.getColor(color)[currentFormat]

    clipboard.writeText(activeColor)
    this.setState({ showMsg: true })
  }
github nitin42 / react-color-tools / build / react-color-tools.es.js View on Github external
(_this.copyColor = function() {
        clipboard.writeText(_this.state.color)
        _this.setState({ showMsg: true })
      }),
      _temp)),
github d2-projects / d2-admin / src / pages / demo / components / icon / components / d2-icon-cell.vue View on Github external
copy (text) {
      clipboard.writeText(text)
      this.$message({
        message: `${text} 复制到剪贴板`,
        type: 'success'
      })
    }
  }
github zenprotocol / explorer / src / pages / oracle / components / TickersTable / TickersTable.jsx View on Github external
copyToClipboard(proof) {
    clipboard
      .writeText(proof)
      .then(() => {
        this.setState(
          {
            copied: true,
          },
          () => {
            this.timeout = setTimeout(() => {
              this.setState({ copied: false });
            }, 2000);
          }
        );
      })
      .catch(() => {
        this.setState({ copyFailed: true });
      });

clipboard-polyfill

A polyfill for the asynchronous clipboard API

MIT
Latest version published 28 days ago

Package Health Score

76 / 100
Full package analysis