Displaying Quill editor content with correct style - quill

I am using the Quill editor (via ngx-quill) to give my user the ability to edit documents. When the documents are displayed I show them like this:
<div [innerHTML]="doc.text"></div>
This works reliably, but the styling of the content of the div tag is quite different from what you see in the Quill editor window. What I want to do is apply the Quill content stylesheet to my div tag, but I haven't been able to find any document to do that. Does anyone here know how to do that?
I know one alternative is to invoke a Quill editor in read-only mode and without a tool-bar. That's my fall-back but I would prefer not to do that.

I was facing the same issue. Some inline styles are displayed, but the styles applied from the Quill.js class are not applied. post-content is class of div containing the content:
let content=document.querySelector('.post-content')
content.innerHTML=content.innerText

Related

Wagtail: How to render the blocks dynamically on Admin panel?

In wagtail, I need to make a Struct/Stream Block
There is a dropdown on the top of the block(Image/Video)
If editor choose Image, VideoChooserBlock should be hidden.
And if editor choose Video, ImageChooserBlock should be hidden.
class MyBlock(StruckBlock):
category = ChoiceBlock(choices=(("image", "image"),("video", "video")))
image = ImageChooserBlock()
video = videoChooserBlock()
Here, editor should be able to choose only image or video depending on category.
Any help is appriciated.
Thanks
You may find it useful to review the code of wagtail-link-block which does something similar.
Main files to focus on:
blocks.py for displaying fields conditionally based on a ChoiceBlock
static/link_block/link_block.js and static/link_block/link_block.css to handle the DOM manipulation and styling with JavaScript and CSS
wagtail_hooks.py to insert JS and CSS

Is there a way to add FontAwesome icons into QuillJS editor

I've been attempting to add custom i tags as blots into a Quill editor. Basically I need a way for a user to specify a FontAwesome icon and the editor handle it.
<i class="fa-thin fa-address-book"></i>
My previous attempt included adding a custom toolbar button that allows you to edit raw html, however when pasting this back to the editor the class (<i class=) is stripped.

How to add a custom UI/intellisense inside Monaco editor?

I want to add a custom pill element next to the import definitions in my Monaco Editor just like in the image below. So is there a way to extend Monaco editor's UI or is there any API that'll let me do so? I couldn't find any information on how to do it. Any help would be appreciated!
Thank you!
Check Monaco.IStandaloneCodeEditor.deltaDecorations which allows to add any type of HTML in the editor. Text content will be moved to avoid overlapping of decorations and text.

QuillJS preview is not as editor view- formatting issue

i am using react quill editor and the editor is working fine. but when i display the html content its not in the format shown in editor view. in console i can see that ql-indent class was applied to tag but its not working outside editor. i tried applying quill core.css styles but still no use.
It's difficult to find a guide on displaying quill-editor html content outside the editor.
so please help me in handing ql-xxxx classes outside editor.
i fixed it by adding ql-editor class to the preview div tag.
<div className="ql-editor" dangerouslySetInnerHTML={{__html: htmlContent}} />

How can I prevent having a tabindex on toolbar buttons in Quill

I would like to prevent toolbar buttons in a Quill editor from having a tabindex. How can I do this?
Quill offers two ways to get a toolbar at the two ends of the customization spectrum. One is you pass in an array of formats that you want and Quill builds the toolbar for you (in this case with a tabindex). The other is you give Quill whatever container you want (with or without a tabindex) and Quill attaches the appropriate handlers. If the former is not to your liking then the latter is the alternative.

Resources