Socket
Socket
Sign inDemoInstall

clip-it

Package Overview
Dependencies
0
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    clip-it

A totally easy way for modern browsers to put something into clipboard.


Version published
Weekly downloads
13
increased by550%
Maintainers
1
Install size
10.0 kB
Created
Weekly downloads
 

Readme

Source

CLIP IT

A totally easy way for modern browsers to put something into clipboard.

build npm codecov license

Try it Out

Demo by Codepen

Installation

$ npm i --save clip-it

Usage

HTML

<button>Copy as Text</button>
<button>Copy as HTML</button>

JavaScript

import clipIt from 'clip-it'

const $btnCopyText = document.querySelector('button')
const $btnCopyHTML = document.querySelector('button')

$btnCopyText.onclick = e => clipIt('Hello World'))

$btnCopyHTML.onclick = e => clipIt('<span style="color: red;">Hello world!</span>', {
  contentType: 'text/html'
}))

ATTENTION

  • The clip-it API must be triggered in the same callstack with a trusted event.
  • Some browsers only supports to copy plain text. (e.g. iOS Safari)

Keywords

FAQs

Last updated on 17 Mar 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc