javascript - Wagtail / Hallo.js - Adding plugins but modified content is not saved -


i'm running on wagtail 1.3.1, django 1.7.11.

i have activated hallohtml , hallojustify plugins , appear in toolbar (without icons buttons here).

the buttons can used , modifications seen in textarea (i mean can center field example , see it).

when publish page, modifications made either hallojustify or hallohtml not saved whereas can still use bold/italic buttons , save content. looks html cleaned up...

i should miss but...

@hooks.register('insert_editor_js') def editor_js(): js_files = [ ] js_includes = format_html_join('\n', '', ((settings.static_url, filename) filename in js_files) )  return js_includes + format_html(         """         <script>           registerhalloplugin('hallojustify');           registerhalloplugin('hallohtml');         </script>         """     ) 

by design, wagtail allows subset of html tags , attributes, , strips out not on whitelist. done several reasons: prevents editors inserting malicious content (such <script> tags), , encourages site developers keep content , presentation separate. (you shouldn't including formatting information such left/right/centre alignment inside rich text content - should defined inside template , css.)

you can customise html whitelisting rules using construct_whitelister_element_rules hook - however, i'd encourage reconsider whether need overload rich text editor functionality, or whether there's more structured way of achieving want (such streamfield).


Comments

Popular posts from this blog

iis - ASP.Net Core CreatedAtAction in HttpPost action returns 201 but entire request ends with 500 -

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -