@vuepress-denaro/vuepress-plugin-one-click-copy
v1.3.1
Published
A vuepress plugin for clipboard-copy. 一键复制 Vuepress 插件.
Downloads
20
Maintainers
Readme
vuepress-plugin-one-click-copy
:tada: A vuepress plugin for clipboard-copy. 一键复制 Vuepress 插件.
Usage
- Install
# npm
npm install @vuepress-denaro/vuepress-plugin-one-click-copy
# yarn
yarn add @vuepress-denaro/vuepress-plugin-one-click-copy
- Update
plugins
in.vuepress/config.js
or.vuepress/config.ts
js
const {
oneClickCopyPlugin,
} = require('@vuepress-denaro/vuepress-plugin-one-click-copy')
module.exports = {
plugins: [
oneClickCopyPlugin({
copySelector: [
'div[class*="language-"] pre',
'div[class*="aside-code"] aside',
], // Need to add one-click-copy class wildcard.
copyMessage: 'Copied successfully!', // Prompt for successful copy.
toolTipMessage: 'Copy to clipboard', // Click the title of the copy button.
duration: 3000, // Successful prompt disappearing time.
}),
],
}
ts
import { oneClickCopyPlugin } from '@vuepress-denaro/vuepress-plugin-one-click-copy'
import { defineUserConfig } from '@vuepress/cli'
export default defineUserConfig({
plugins: [
oneClickCopyPlugin({
copySelector: [
'div[class*="language-"] pre',
'div[class*="aside-code"] aside',
], // Need to add one-click-copy class wildcard.
copyMessage: 'Copied successfully!', // Prompt for successful copy.
toolTipMessage: 'Copy to clipboard', // Click the title of the copy button.
duration: 3000, // Successful prompt disappearing time.
}),
],
})
Configurations
copySelector
- type:
string|array
- default:
['div[class*="language-"] pre', 'div[class*="aside-code"] aside']
Need to add one-click-copy class wildcard.
copyMessage
- type:
string
- default:
'Copied successfully!'
Prompt for successful copy.
toolTipMessage
- type:
string
- default:
'Copy to clipboard'
Click the title of the copy button.
duration
- type:
number
- default:
3000
Successful prompt disappearing time.