Skip to content

Commit 726a778

Browse files
wyMinLwin7nik
andauthored
fix: Correct copy for specific code block [Svelte] (#1647)
* fix: Correct copy for specific code block [Svelte] * style: format code * refactor: select code block in simple way --------- Co-authored-by: 7nik <[email protected]>
1 parent 83360b1 commit 726a778

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

packages/site-kit/src/lib/components/Text.svelte

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
.find((node) => (node as HTMLElement).classList.contains('code-block')) as HTMLElement;
3434
3535
const ts = !!parent.querySelector('.ts-toggle:checked');
36-
const query = ts ? `pre[data-language="ts"] code` : 'pre code';
37-
const code = parent.querySelector(query) as HTMLElement;
36+
const code = parent.querySelectorAll(':scope > pre > code')[ts ? 1 : 0] as HTMLElement;
3837
navigator.clipboard.writeText(get_text(code));
3938
}
4039
}

0 commit comments

Comments
 (0)