From f166448420de47372014e900bf7a4ea57fc8146d Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Fri, 5 Jan 2024 20:49:46 +0800 Subject: [PATCH] [opt] tag-plugin: copy --- _config.yml | 1 + scripts/tags/lib/copy.js | 5 ++++- source/css/_layout/tag-plugins/copy.styl | 17 +++++++++++++---- source/js/plugins/copycode.js | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/_config.yml b/_config.yml index d3d3942..d90584b 100755 --- a/_config.yml +++ b/_config.yml @@ -395,6 +395,7 @@ plugins: js: /js/plugins/copycode.js default_text: 'Copy' success_text: 'Copied' + toast: 复制成功 # AI 摘要 # https://github.com/zhheo/Post-Abstract-AI diff --git a/scripts/tags/lib/copy.js b/scripts/tags/lib/copy.js index 22d6643..29e4d27 100644 --- a/scripts/tags/lib/copy.js +++ b/scripts/tags/lib/copy.js @@ -12,7 +12,7 @@ var copy_index = 0 module.exports = ctx => function(args) { - args = ctx.args.map(args, ['git'], ['text']) + args = ctx.args.map(args, ['git', 'prefix'], ['text']) if (args == undefined || args.text == undefined) { return '' } @@ -35,6 +35,9 @@ module.exports = ctx => function(args) { var el = `` el += `
` + if (args.prefix?.length > 0) { + el += `${args.prefix}` + } el += `` el += `