MCPcopy
hub / github.com/marktext/marktext / copyGithubSlug

Function copyGithubSlug

packages/desktop/src/renderer/src/store/editor.ts:219–233  ·  view source on GitHub ↗

* Copies the specified heading's github-slug to the clipboard. * @param key The heading-id to copy.

(key: string)

Source from the content-addressed store, hash-verified

217 * @param key The heading-id to copy.
218 */
219 copyGithubSlug(key: string): void {
220 const item = this.listToc.find((i) => i.slug === key)
221
222 if (item) {
223 window.electron.clipboard.writeText(`#${item.githubSlug}`)
224 notice.notify({
225 title: t('store.editor.anchorLinkCopied'),
226 type: 'primary',
227 time: 2000,
228 showConfirm: false
229 })
230 } else {
231 console.warn(t('store.editor.tocItemNotFound', { key }))
232 }
233 },
234
235 /**
236 * Update scroll position for the currentFile

Callers

nothing calls this directly

Calls 4

tFunction · 0.90
writeTextMethod · 0.80
notifyMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected