feat: add copy-inner-text class name

This commit is contained in:
purocean
2022-03-17 18:10:37 +08:00
parent 3c9422d5e4
commit bb1bf12be9
4 changed files with 4 additions and 1 deletions
+1
View File
@@ -76,6 +76,7 @@ This feature is implemented using [markdown-it-attrs](https://github.com/arve0/m
| `block` | The current element is displayed as a block element |
| `reduce-brightness` | Reduce the brightness of this element when using dark theme |
| `bgw` | Set current element background to white |
| `copy-inner-text` | Mark "Ctrl/Cmd + left click" to copy element text |
### Image Enhancement
+1
View File
@@ -77,6 +77,7 @@ define:
| `block` | 当前元素显示为块元素 |
| `reduce-brightness` | 使用暗色主题时候降低此元素亮度 |
| `bgw` | 设置当前元素背景为白色 |
| `copy-inner-text` | 标记 “Ctrl/Cmd + 单击左键” 拷贝元素文字 |
### 图片增强
+1 -1
View File
@@ -58,7 +58,7 @@ export default {
ctx.markdown.registerPlugin(md => {
const codeInline = (fn: Function) => (tokens: any, idx: any, options: any, env: any, slf: any) => {
if (tokens[idx].attrIndex('title') < 0) {
tokens[idx].attrJoin('class', 'copy-inner-text')
tokens[idx].attrJoin('class', ctx.constant.DOM_CLASS_NAME.COPY_INNER_TEXT)
tokens[idx].attrPush(['title', ctx.command.getKeyLabel('CtrlCmd') + ' + ' + ctx.i18n.t('click-to-copy')])
}
+1
View File
@@ -15,4 +15,5 @@ export const DOM_CLASS_NAME = {
INLINE: 'inline',
BLOCK: 'block',
BGW: 'bgw',
COPY_INNER_TEXT: 'copy-inner-text',
}