An open API service indexing awesome lists of open source software.

https://github.com/dafrok/clip-it

A totally easy way for modern browsers to put something into clipboard.
https://github.com/dafrok/clip-it

Last synced: about 1 year ago
JSON representation

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

Awesome Lists containing this project

README

          

# CLIP IT

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

[![build](https://travis-ci.org/Dafrok/clip-it.svg?branch=master)]()
[![npm](https://img.shields.io/npm/v/clip-it.svg)](https://www.npmjs.com/package/clip-it)
[![codecov](https://codecov.io/gh/Dafrok/clip-it/branch/master/graph/badge.svg)](https://codecov.io/gh/Dafrok/clip-it)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)]()

## Try it Out

> [Demo by Codepen](https://codepen.io/Dafrok/full/jaQZME/)

## Installation

```bash
$ npm i --save clip-it
```

## Usage

### HTML

```html
Copy as Text
Copy as HTML
```

### JavaScript

```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('Hello world!', {
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)