@vuepress-denaro/vuepress-plugin-one-click-copy
TypeScript icon, indicating that this package has built-in type declarations

1.3.1 • Public • Published

vuepress-plugin-one-click-copy

🎉 A vuepress plugin for clipboard-copy. 一键复制 Vuepress 插件.

npm version GitHub stars GitHub issues
jsdelivr NPM

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.

Thanks

vuepress-plugin-one-click-copy

Package Sidebar

Install

npm i @vuepress-denaro/vuepress-plugin-one-click-copy

Weekly Downloads

2

Version

1.3.1

License

MIT

Unpacked Size

18.6 kB

Total Files

25

Last publish

Collaborators

  • vxhly