开发者

Django-admin + dijit-editor : An un-necessary extra field At the top of the page

I have added a dojo rtf editor to a django admin page using the instructions from this blog post (Using Dojo Rich Editor with D开发者_开发知识库jango's Admin).

The problem is that there appears and extra rtf editor at the top of the page .

Django-admin + dijit-editor : An un-necessary extra field At the top of the page

How do I get rid of this ?

The Source Code for the project can be found at gautamk/QPaperGenerator-Django - GitHub.


I believe the problem is that all textarea elements are getting turned into dijit editor widgets. The code at fault is in editor.js:

var textareas = dojo.query("textarea");
if(textareas && textareas.length){
  ...
  textareas.instantiate(dijit.Editor, {...});
}

As you can see, the query selects all textareas, not just the ones you want. Now, I have no idea why there's a text area up at the top of your screen to begin with, but presumably it's getting hit by this query too. To fix the problem, try a more specific query. For instance something like one of these:

dojo.query("#id_question"); // Only the question field
dojo.query("#id_comments"); // Only the comments field
dojo.query(".vLargeTextField"); // All the large-ish admin text widgets
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜