How to use the clipboard/dist/clipboard.min.js 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 jpush / jchat-web / src / app / components / message-menu / message-menu.component.ts View on Github external
public ngAfterViewInit() {
        const clipboard = new Clipboard('.message-copy');
    }
    private selectMenuItemAction(item) {
github dessalines / simple-vote / ui / src / app / components / poll / poll.component.ts View on Github external
ngOnInit() {
		this.isLoading = true;
		new Clipboard('.clipboard-link');
		this.init();
	}
github Inndy / vue-clipboard2 / vue-clipboard.js View on Github external
return new Promise(function (resolve, reject) {
        var fakeElement = document.createElement('button')
        var clipboard = new Clipboard(fakeElement, {
          text: function () { return text },
          action: function () { return 'copy' },
          container: typeof container === 'object' ? container : document.body
        })
        clipboard.on('success', function (e) {
          clipboard.destroy()
          resolve(e)
        })
        clipboard.on('error', function (e) {
          clipboard.destroy()
          reject(e)
        })
        if (VueClipboardConfig.appendToBody) document.body.appendChild(fakeElement)
        fakeElement.click()
        if (VueClipboardConfig.appendToBody) document.body.removeChild(fakeElement)
      })
github Inndy / vue-clipboard2 / vue-clipboard.js View on Github external
bind: function (el, binding, vnode) {
        if (binding.arg === 'success') {
          el._vClipboard_success = binding.value
        } else if (binding.arg === 'error') {
          el._vClipboard_error = binding.value
        } else {
          var clipboard = new Clipboard(el, {
            text: function () { return binding.value },
            action: function () { return binding.arg === 'cut' ? 'cut' : 'copy' },
            container: VueClipboardConfig.autoSetContainer ? el : undefined
          })
          clipboard.on('success', function (e) {
            var callback = el._vClipboard_success
            callback && callback(e)
          })
          clipboard.on('error', function (e) {
            var callback = el._vClipboard_error
            callback && callback(e)
          })
          el._vClipboard = clipboard
        }
      },
      update: function (el, binding) {
github Inndy / vue-clipboard2 / dist / vue-clipboard.js View on Github external
return new Promise(function (resolve, reject) {
        var fakeElement = document.createElement('button')
        var clipboard = new Clipboard(fakeElement, {
          text: function () { return text },
          action: function () { return 'copy' },
          container: typeof container === 'object' ? container : document.body
        })
        clipboard.on('success', function (e) {
          clipboard.destroy()
          resolve(e)
        })
        clipboard.on('error', function (e) {
          clipboard.destroy()
          reject(e)
        })
        if (VueClipboardConfig.appendToBody) document.body.appendChild(fakeElement)
        fakeElement.click()
        if (VueClipboardConfig.appendToBody) document.body.removeChild(fakeElement)
      })
github OpenSprites / OpenSprites-next / public / assets / js / copy.js View on Github external
module.exports = function() {
  if(document.getElementById('copycode')) {
    let cb = new Clipboard('#copycode')
    let int = 0

    let was = document.querySelector('#copycode').innerHTML

    cb.on('success', function(e) {
      document.querySelector('#copycode').innerHTML = 'Copied!'

      window.clearInterval(int)
      int = window.setInterval(() => document.querySelector('#copycode').innerHTML = was, 1000)

      e.clearSelection()
    })

    cb.on('error', function(e) {
      document.querySelector('#copycode').innerHTML = 'Press Ctrl+C to copy'
github Inndy / vue-clipboard2 / dist / vue-clipboard.js View on Github external
bind: function (el, binding, vnode) {
        if (binding.arg === 'success') {
          el._vClipboard_success = binding.value
        } else if (binding.arg === 'error') {
          el._vClipboard_error = binding.value
        } else {
          var clipboard = new Clipboard(el, {
            text: function () { return binding.value },
            action: function () { return binding.arg === 'cut' ? 'cut' : 'copy' },
            container: VueClipboardConfig.autoSetContainer ? el : undefined
          })
          clipboard.on('success', function (e) {
            var callback = el._vClipboard_success
            callback && callback(e)
          })
          clipboard.on('error', function (e) {
            var callback = el._vClipboard_error
            callback && callback(e)
          })
          el._vClipboard = clipboard
        }
      },
      update: function (el, binding) {