MCPcopy Create free account
hub / github.com/marktext/marktext / renderCopyButton

Function renderCopyButton

packages/muya/src/block/commonMark/codeBlock/code.ts:16–42  ·  view source on GitHub ↗
(i18n: I18n)

Source from the content-addressed store, hash-verified

14const debug = logger('code:');
15
16function renderCopyButton(i18n: I18n) {
17 const selector = 'a.mu-code-copy';
18 const iconVnode = h(
19 'i.icon',
20 h(
21 'i.icon-inner',
22 {
23 style: {
24 'background': `url(${copyIcon}) no-repeat`,
25 'background-size': '100%',
26 },
27 },
28 '',
29 ),
30 );
31
32 return h(
33 selector,
34 {
35 attrs: {
36 title: i18n.t('Copy content'),
37 contenteditable: 'false',
38 },
39 },
40 iconVnode,
41 );
42}
43
44class Code extends Parent {
45 public override parent: Nullable<CodeBlock> = null;

Callers 1

createCopyNodeMethod · 0.70

Calls 2

hFunction · 0.85
tMethod · 0.80

Tested by

no test coverage detected