* Copies the specified heading's github-slug to the clipboard. * @param key The heading-id to copy.
(key: string)
| 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 |