Skip to content

Copy text as HTML #80

@DDeis

Description

@DDeis

I'm have HTML text in a variable (e.g. const html = '<strong>Hello <em>world</em></strong>';).
When I'm copying this variable using clipboardService.copyFromContent:

const html = `
  <h1>Just a title</h1>
  <p>
    <strong>Hello <em>world</em></strong>
  </p>
`
this.clipboardService.copyFromContent(html, this.renderer);

Then paste it into a mail the pasted text is

<h1>Just a title</h1><p><strong>Hello <em>world</em></strong></p>

Is there a way to copy text as HTML so it stays formatted when pasted, i.e. having the titles in big font size, bold text, italic, etc.

On a previous project on AngularJS, I was using https://www.npmjs.com/package/clipboard-js (not https://www.npmjs.com/package/clipboard) and it was working fine, so maybe it can be possible with this library as well ?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions