Search code examples
wysiwygwagtailwagtail-streamfieldwagtail-admin

Wagtail. Ability to edit html within editor


My editors want to have an ability to edit raw html within editor. For example, we can have simple list markup:

<ul>
   <li>Some text<li>
</ul>

Or with custom classes and event tags:

<ul>
   <li class="my_class">Some text
       <span class="special">Some additional info</span>
   <li>
</ul>

And so on.

I know that built-in Draftail doesnt support html editing. But using third-party editor comes with problem:

Losing integration with system. For example, i cant just put image like with draftail. Or, preview mode cant handle all functionality of third-party editor.

So, maybe someone has working solution for this situation. I thought about using special StreamField panels, but it seems to be overhead of blocks. Dont like this idea of having lots of blocks with little differences


Solution

  • At the end i made my own solution Simple rewrite some methods in wagtail`s Html DbWhiteLister and HtmlConverter. This gives me an opportunity to allow any tags with any attributes.

    https://github.com/Chenger1/wagtailtinymce.-Full-Rich-Text-Editor