Skip to content

Commit

Permalink
Initial release.
Browse files Browse the repository at this point in the history
  • Loading branch information
webcore-it committed Jun 12, 2018
1 parent ab13cb0 commit 48abfb8
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 51 deletions.
59 changes: 10 additions & 49 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,61 +1,22 @@
.DS_Store

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Editor directories and files
.idea
*.iml
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Tom
Copyright (c) 2018 webcore-it

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,40 @@
# nuxt-clipboard2
Nuxt module for vue-clipboard2

> A "copy to clipboard" module for Nuxt.js using [vue-clipboard2](https://github.com/Inndy/vue-clipboard2)
## Setup
- Add `nuxt-clipboard2` dependency using yarn or npm to your project
- Add `nuxt-clipboard2` to `modules` section of `nuxt.config.js`

```js
{
modules: [
'nuxt-clipboard2',
]
}
```

## Usage
You can use **$copyText** in almost any context using `app.$copyText` or `this.$copyText` (Including store actions).

See [vue-clipboard2 official docs](https://github.com/Inndy/vue-clipboard2) for more usage information.

```js
export default {
methods: {
async copySomething(text) {
try {
await this.$copyText(text);
} catch (e) {
console.error(e);
}
},
},
};
```

## License

[MIT License](./LICENSE)

Copyright (c) webcore-it
15 changes: 15 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const path = require('path');

module.exports = function nuxtClipboard(moduleOptions) {
const options = Object.assign({}, this.options.toast, moduleOptions);

// Register plugin
this.addPlugin({
src: path.resolve(__dirname, 'plugin.js'),
ssr: false,
fileName: 'clipboard.js',
options,
});
};

module.exports.meta = require('./package.json');
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "nuxt-clipboard2",
"version": "0.0.1",
"license": "MIT",
"main": "index.js",
"repository": "https://github.com/webcore-it/nuxt-clipboard2",
"homepage": "https://github.com/webcore-it/nuxt-clipboard2",
"publishConfig": {
"access": "public"
},
"dependencies": {
"vue-clipboard2": "^0.1.1"
}
}
8 changes: 8 additions & 0 deletions plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Vue from 'vue';
import VueClipboard from 'vue-clipboard2';

Vue.use(VueClipboard);

export default function (ctx, inject) {
inject('copyText', Vue.copyText);
}

0 comments on commit 48abfb8

Please sign in to comment.