Copy Paste

Dendron does some extra logic when a copy event is detected in a webview to strip out theming related CSS (otherwise, users copying from a dark theme would also paste the dark background when pasting).

Logic

addEventListener(copy, e => {
    htmlSelection = getHTMLOfSelection
    copyToClipboard htmlSelection
})

copyToClipboard {
    // strip styling and create blob
    blob :=

    item = new ClipboardItem(blob)
    clipboard.write(item)

For full details, see the PR.


Backlinks