Skip to content

Commit add6a43

Browse files
committed
fix: copy inner text or text content of code element
Signed-off-by: Akshat Patel <[email protected]>
1 parent da90c2c commit add6a43

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/code-snippet/code-snippet.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ export class CodeSnippet extends BaseIconButton implements OnInit, AfterViewInit
269269
onCopyButtonClicked() {
270270
if (!this.disabled) {
271271
window.navigator.clipboard
272-
.writeText(this.code).then(() => {
272+
.writeText(this.code.nativeElement.innerText || this.code.nativeElement.textContent).then(() => {
273273
this.showFeedback = true;
274274
this.animating = true;
275275
setTimeout(() => {

0 commit comments

Comments
 (0)