just found out an easier way:

forget nr. 3 and change AddRichTextEditing.js to this:

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);

btw, i´ve tested this with m-r on Firefox 1.5.

patrick


Am 18.05.2006 um 13:07 schrieb va:patrick.kranzlmueller:

>
> i guess you mean the editor widget:
>
> 1. drop dojo (kitchen sink) into /media/ (like /media/dojo)
> 2. add this script as AddRichTextEditing.js into /media/js/admin/
> ### this script looks for the help text "Rich Text Editing" and
> replaces the textarea before with the dojo widget
>
> 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",
> "Editor");
>                               }
>               }
>       },
> }
> addEvent(window, 'load', AddEditor.init);
>
> 3. in change_form.html add the dojo js to block extrahead (it should
> look like this):
>
> {% block extrahead %}{{ block.super }}
> <script type="text/javascript" src="../../../jsi18n/"></script>
> {% for js in javascript_imports %}{% include_admin_script js %}{%
> endfor %}
> <script type="text/javascript" src="/media/dojo/dojo.js"></script>
> <script type="text/javascript">
>      dojo.require("dojo.widget.Editor");
> </script>
> {% endblock %}
>
> ### i don´t know why, but the dojo-js has to be included AFTER the
> admin-scripts
> ### it´d be cool to integrate this into AddRichTextEditing.js (but i
> don´t know how ...)
>
> 4. in your models, define the areas for richtext editing like this:
>
> class Blog(models.Model):
>      body = models.TextField('Body', help_text='Rich Text Editing.',
> blank=True, null=True)
>      class Admin:
>          js = ['js/admin/AddRichTextEditingDirectly.js']
>
>
> that´s it. if there are any further questions, don´t hesitate to ask.
>
> additionally, you might wanna change the widget styles (dojo/src/
> widget/templates/HTMLEditorToolbar.css):
>
> add margin-left: 110px to EditorToolbarSmallBg
> add this:
> .RichTextEditable {
>      margin-left: 110px;
> }
>
> with changing the styles a bit more, the whole thing might look like
> this:
> http://www.vonautomatisch.at/django/dojoeditor.jpg
>
> patrick
>
>
>
> Am 18.05.2006 um 09:06 schrieb Mary Adel:
>
>>
>> hi all
>> I am using magic removal
>> i need to use text widget in my admin interface so can anyone tell me
>> how i could do this
>>
>> Thanks,
>> Mary
>>
>>
>>>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to