Version 4 (modified by 18 years ago) ( diff ) | ,
---|
Add Dojo Editor
Download Dojo (kitchen sink) and install it on your webserver in /media/dojo/...
Save the following script as AddRichTextEditing.js into /media/js/admin/
document.write('<script type="text/javascript" src="/media/dojo/dojo.js"></script>'); document.write('<script type="text/javascript">dojo.require("dojo.widget.Editor2");</script>'); var AddEditor = { init: function() { var helptext = document.getElementsByTagName('p'); for (var i = 0, ht; ht = helptext[i]; i++) { if (ht.firstChild.data == "Rich Text Editing.") { ht.previousSibling.previousSibling.setAttribute("dojoType", "Editor2"); } } }, } addEvent(window, 'load', AddEditor.init);
This script looks for the help text "Rich Text Editing." and replaces the associated textarea with the Dojo-Editor. I´m using Editor2, because it´s loading much faster than Editor.
Define your model like this:
body = models.TextField('Body', help_text='Rich Text Editing.', blank=True, null=True) ... class Admin: js = ['js/admin/AddRichTextEditing.js']
that´s it.
Screenshot
Note:
See TracWiki
for help on using the wiki.