question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Difference of formatting / render between quill-editor and quill-view component

See original GitHub issue

Hi 😃

I’ve got a pretty weird issue and would like to know if you could have some leads on that 😄

You already saw some exemples of what I’m building, with some quill-view to display multiple zones of content and a quill-editor popping on the top of a zone, on click, to modify the content.

My content is stored in DB (legacy) letter by letter with every style attribute attached to it. I made a simple converter to wrap each letters in a span with the relative styling and wrap each sentences in p tags

Something like this :

<p style="text-align: center;">
  <span style="font-size: 35px; color: rgb(115, 115, 115);">H</span>
  <span style="font-size: 35px; color: rgb(115, 115, 115);">E</span>
  <span style="font-size: 35px; color: rgb(115, 115, 115);">L</span>
  <span style="font-size: 35px; color: rgb(115, 115, 115);">L</span>
  <span style="font-size: 35px; color: rgb(115, 115, 115);">0</span>
</p>

What’s nice with quill is that when I open the quill-editor component, the content will be automatically transformed to a nice

<p style="text-align: center;">
  <span style="font-size: 35px; color: rgb(115, 115, 115);">HELLO</span>
</p>

Regrouping all the children element with the same styling together. Neat.

But, it does not seems to make this transform on the quill-view. Or at least it replace things like this :

<p class="ql-align-center">
  <span style="color: rgb(115, 115, 115);">HELLO</span>
</p>

So it transform inline style to classes and remove some of the style. I thought it would be because the quill-view has not access to the modules, but I’ve set the [modules]="modules" on the component.

What’s fun is : when I arrive on the page, the style is broken, then if I open the editor component and modify the content or don’t modify, close, change page and come back to this page, it’s displayed correctly. (By page I don’t mean browser page but in my app I have multiple pages with editable zones)

I tried to trigger manually some quillEditor.clipboard.convert(value) on it but well, with no success from now.

Tried to play around with domSanitizer.sanitize(SecurityContext.HTML, value) too but same result.

If you got some leads on that I’m all ears. Thanks !

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
KillerCodeMonkeycommented, Dec 5, 2019

feel free to send me a PR if something is inconsistent between the editor and the view component

0reactions
Yexancommented, Dec 9, 2019

Well not really, I think It might be due to some issues with format registering. It’s the only way I could understand what happen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I display the content of React Quill without the html ...
The simplest way is to use the same react-quill component with editing disabled. ... Save the html output from quill editor. Then render...
Read more >
How to Customize Quill - Quill Rich Text Editor
Quill is a free, open source WYSIWYG editor built for the modern web. Completely customize it for any need with its modular architecture...
Read more >
React-Quill View Source Example - CodePen
PropTypes.string,\\n}\\n\\n/* \\n * Render component on page\\n */\\nReactDOM.render(\\n <Editor placeholder={'Write something'}/>, \\n document.
Read more >
react-quill - npm, render quill-delta to html, quill editor html ...
Each version of Quill is built and ready to use from a variety of sources, ... The quill-editor and quill-view component of ngx-quill...
Read more >
Render React Component inside Quill without losing context
To apply format to the text you can use format method from Quill. The required parameters are formatType and value. Ex., this.editor.format(" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found