Post lifecyle
-
I'm trying to build a WYSIWIG composer plugin using summernote with the redactor plugin as a starting point/template. However, at some point between hitting the submit button and the rendering of the final HTML, some filtering seems to be occurring. Is there any documentation available that would help me understand the flow from submission to saving to rendering so I can identify where the filtering happens?
-
@razibal wow! That's a huge thing to tackle NodeBB supports the regular markdown composer and Quill, Redactor is deprecated, but can still functional well as a base.
Most likely you're thinking of the post sanitization step... Is it stripping out all of the html?
May be worth looking at the Quill plugin to see how it is handled.
-
@julian It's mostly working as intended. However, all div tags get stripped out and I'm unable to find any specific place in the code where it might be occurring. I can live without the div tags or just replace then with spans before submitting, but having them stripped out does break some existing html that someone might choose to paste from an existing post/article in another system. Plus, it would be nice to know the entire lifecycle from the 'submit' button to rendering. I've tried following the hooks in the
src/posts/parse.js
script and the html is still intact at that stage. Yet, by the time it gets rendered they're gone. I am using the sanitize plugin to go along with the new composer, but its been disabled while I chase down the disappearing divs. -
@razibal I'm surprised you haven't found the built-in sanitization code in core. You don't need the sanitize plugin because it's built in now.
You'll need to hook into the
filter:sanitize.config
hook. -
I did find the built-in sanitization code and turned that off for testing, but that still doesn't seem to be the source of the disappearing divs. With the redactor composer, sanitization was also occurring within the plugin code. I still want to use the sanitization plugin because it allows for the rules to be customized in one place along with options for further data transformations.
-
@razibal how did you turn off sanitization in core?
-
@razibal try checking ajaxify.data for the post content to see what it looks like before being added to the page.