Git Product home page Git Product logo

Comments (5)

aramk avatar aramk commented on August 16, 2024 6

This seems to work:

quill.setContents(quill.clipboard.convert(html));

from delta.

aramk avatar aramk commented on August 16, 2024 4

I store it as HTML and delta as well so I can render without parsing each time. I think there should be a setHtmlContents() convenience method as well though. Is this not supported because Quill is a superset of HTML and doing so may alter results, or vice versa?

from delta.

jhchen avatar jhchen commented on August 16, 2024

You can use the construction APIs to create a Delta in general, but parsing, sanitizing and interpreting HTML is outside the scope of this project. You will have to use another third party library for that in conjunction with the construction APIs.

from delta.

Toub avatar Toub commented on August 16, 2024

What about using Clipboard.convert ?

https://github.com/quilljs/quill/blob/master/modules/clipboard.js

from delta.

sdhull avatar sdhull commented on August 16, 2024

I know this is an old issue but it strikes me as an odd oversight that Quill doesn't support this in any sort of documented way and the only way to do it is essentially a hack.

What is the recommended approach from Quill designers if I want to make some rich content editable more than once but also want to make the content renderable as simple HTML (as in the editor but just for display)?

AFAICT the easiest way to support this use-case is to store the content twice: once as Delta and once as HTML. Otherwise you're left rolling your own parser to convert HTML to Delta (if you store it as HTML) or Delta to HTML (for rendering outside an editor context).

Surely I'm missing something here?

from delta.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.