mirror of
https://github.com/purocean/yn.git
synced 2026-09-24 15:46:02 +08:00
feat: add copy-inner-text class name
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ define:
|
||||
| `block` | 当前元素显示为块元素 |
|
||||
| `reduce-brightness` | 使用暗色主题时候降低此元素亮度 |
|
||||
| `bgw` | 设置当前元素背景为白色 |
|
||||
| `copy-inner-text` | 标记 “Ctrl/Cmd + 单击左键” 拷贝元素文字 |
|
||||
|
||||
### 图片增强
|
||||
|
||||
|
||||
@@ -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')])
|
||||
}
|
||||
|
||||
|
||||
@@ -15,4 +15,5 @@ export const DOM_CLASS_NAME = {
|
||||
INLINE: 'inline',
|
||||
BLOCK: 'block',
|
||||
BGW: 'bgw',
|
||||
COPY_INNER_TEXT: 'copy-inner-text',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user