quill icon indicating copy to clipboard operation
quill copied to clipboard

Copy/pasted html is treated as plain text

Open conradfr opened this issue 8 months ago • 0 comments

I can't figure how to get pasted html text (as a user, not programmatically) and get it interpreted correctly and not as plain text.

I try :

const quill = new Quill('#editor', {
  modules: {
    toolbar: [
      [{ header: [1, 2, false] }],
      ['bold', 'italic', 'underline'],
      ['image', 'code-block'],
    ],
  },
  placeholder: 'Compose an epic...',
  theme: 'snow', // or 'bubble'
});

and

const quill = new Quill('#editor', {
  modules: {
    toolbar: [
      [{ header: [1, 2, false] }],
      ['bold', 'italic', 'underline'],
      ['image', 'code-block'],
    ],
    clipboard: {
      allowed: {
        tags: ['a', 'b', 'strong', 'em', 'i', 'p', 'br']
      }
    }
  },
  placeholder: 'Compose an epic...',
  theme: 'snow', // or 'bubble'
});

here

Expected behavior:

When html content like <p>Lorem ipsum</p> dolor <strong>sit</strong> amet is pasted by the user the content is formatted by Quill accordingly.

Actual behavior:

It's displayed as-is.

Platforms:

Firefox / Chrome / Safari

Version:

2.02

I guess I'm missing something very basic but what?

conradfr avatar Jun 24 '24 06:06 conradfr