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

Method createCopyNode

packages/muya/src/block/commonMark/codeBlock/code.ts:90–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

88 // its element so CodeBlockContent.update() can sync rows without a
89 // querySelector per keystroke.
90 createCopyNode() {
91 const { i18n, options } = this.muya;
92 const withLineNumbers = options.codeBlockLineNumbers && this._withLineNumbers;
93 let html = toHTML(renderCopyButton(i18n));
94 if (withLineNumbers)
95 html += lineNumbersWrapperHTML();
96 this.domNode!.innerHTML = html;
97 this.lineNumbersWrapper = withLineNumbers
98 ? this.domNode!.querySelector<HTMLElement>(`.${LINE_NUMBERS_ROWS_CLASS}`)
99 : null;
100 }
101
102 listen() {
103 const { editor } = this.muya;

Callers 1

constructorMethod · 0.95

Calls 2

lineNumbersWrapperHTMLFunction · 0.90
renderCopyButtonFunction · 0.70

Tested by

no test coverage detected