How to use clipboard-polyfill - 10 common examples

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 harvard-lil / capstone / capstone / static / js / case / sidebar.vue View on Github external
copyCiteToSelection() {
        // Copies: "Selected quotation" name_abbreviation, official_citation, ()
        // TODO: add pin cite to citation
        const toCopy = `"${this.selectedText}" ${this.templateVars.fullCite}`;
        clipboard.writeText(toCopy).then(
          () => this.copyStatus = "copied",
          () => this.copyStatus = "copy failed",
        );
      },
      elideOrRedactSelection(kind) {
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 d2-projects / d2-admin / src / pages / demo / plugins / clipboard-polyfill / index.vue View on Github external
read () {
      clipboard.read().then((res) => {
        console.log(res)
        this.$message({
          message: '读取成功 返回结果请查看控制台',
          type: 'success'
        })
      }, (err) => {
        console.log(err)
        this.$message({
          message: '错误信息已经打印到控制台',
          type: 'error'
        })
      })
    }
  }
github d2-projects / d2-admin / src / views / demo / plugins / clipboard-polyfill / index.vue View on Github external
read () {
      clipboard.read().then((res) => {
        console.log(res)
        this.$message({
          message: '读取成功 返回结果请查看控制台',
          type: 'success'
        })
      }, (err) => {
        console.log(err)
        this.$message({
          message: '错误信息已经打印到控制台',
          type: 'error'
        })
      })
    }
  }
github d2-projects / d2-admin / src / pages / demo / plugins / clipboard-polyfill / index.vue View on Github external
readText () {
      clipboard.readText().then((res) => {
        this.$message({
          message: '读取成功 返回结果请查看控制台',
          type: 'success'
        })
      }, err => {
        console.log(err)
        this.$message({
          message: '错误信息已经打印到控制台',
          type: 'error'
        })
      })
    },
    read () {
github d2-projects / d2-admin / src / views / demo / plugins / clipboard-polyfill / index.vue View on Github external
readText () {
      clipboard.readText().then((res) => {
        this.$message({
          message: '读取成功 返回结果请查看控制台',
          type: 'success'
        })
      }, err => {
        console.log(err)
        this.$message({
          message: '错误信息已经打印到控制台',
          type: 'error'
        })
      })
    },
    read () {
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)
}

clipboard-polyfill

A polyfill for the asynchronous clipboard API

MIT
Latest version published 10 days ago

Package Health Score

78 / 100
Full package analysis