Refactor copy-code-widget.ts for improved functionality

- Changed `innerHTML` to `textContent` for more accurate text copying
This commit is contained in:
Zach 2023-09-15 14:10:30 -04:00
parent b8a690a4ea
commit c0bcb91d72

View file

@ -16,7 +16,7 @@ export class CopyWidget extends WidgetType {
previousElement = previousElement.previousElementSibling
}
const textToCopy = previousElement?.innerHTML
const textToCopy = previousElement?.textContent
if(textToCopy) {
navigator.clipboard.writeText(textToCopy)
new Notice(`Copied '${textToCopy}' to clipboard!`);