简体   繁体   English

django-tinymce现代主题

[英]django-tinymce modern theme

I'm having issues getting the modern theme to work with django-tinymce. 我在使现代主题与django-tinymce配合使用时遇到问题。 Both the simple and the advanced themes render correctly, but when I switch to the modern theme nothing renders and I get a 404 error for /static/tiny_mce/themes/modern/editor_template.js in the console 简单主题和高级主题都可以正确渲染,但是当我切换到现代主题时,没有任何渲染,并且在控制台中/static/tiny_mce/themes/modern/editor_template.js出现404错误

I am attempting to do all of this in the django admin. 我正在尝试在django管理员中执行所有这些操作。 The error is coming from /static/tiny_mce/tiny_mce.js which is interesting because I don't have anything installed in that directory. 该错误来自/static/tiny_mce/tiny_mce.js,这很有趣,因为该目录中没有安装任何东西。 I'm using /static/js/tinymce as my TINYMCE_JS_ROOT in settings.py. 我在settings.py中使用/ static / js / tinymce作为我的TINYMCE_JS_ROOT When switching between simple and advanced theme, everything works correctly. 在简单主题和高级主题之间切换时,一切正常。

I've tried to copy a version of editor_template.js in the exact location it's looking, but I still get the 404. It's like it wipes out /static/tiny_mce if it exists and replaces it with something, but I can't figure out how/where it's getting that from. 我试图在其查找的确切位置复制一个editor_template.js版本,但我仍然得到404。这就像它消除了/ static / tiny_mce(如果存在)并将其替换为某些内容一样,但我不知道知道如何/从哪里得到的。

I'm using an install of TinyMCE 4.1.3 from http://www.tinymce.com/download/download.php and django 1.6.5 我正在使用从http://www.tinymce.com/download/download.php和Django 1.6.5安装的TinyMCE 4.1.3。

I've been struggling with TinyMCE recently, as well. 我最近也一直在与TinyMCE挣扎。 I'm using TinyMCE v4 and Django 1.6. 我正在使用TinyMCE v4和Django 1.6。 I went down the django-tinymce / django-flatpages-tinymce route because I had these working on another project. 我沿着django-tinymce / django-flatpages-tinymce路线走了,因为我在其他项目上进行了研究。 Some how it wasn't working for this new project. 对于这个新项目,它有些不起作用。 I did some research and decided to just go straight TinyMCE, no Django applications (eg, no django-tinymce or django-flatpages-tinymce ). 我做了一些研究,决定直接使用TinyMCE,没有Django应用程序(例如,没有django-tinymcedjango-flatpages-tinymce )。

This method cuts down on all configuration in Django, and it can be completely handled within the tinymce.init call. 此方法减少了Django中的所有配置,并且可以在tinymce.init调用中完全处理。 I found this much easier than dealing with Django's settings files, overriding models, etc. Just simply find the template you want TinyMCE to spice up and add the init call there. 我发现这比处理Django的设置文件,覆盖模型等要容易得多。只需找到想要TinyMCE进行调味的模板并在其中添加init调用即可。

The example here for full featured example really helped me: 全功能示例的示例确实对我有所帮助:

http://www.tinymce.com/tryit/full.php http://www.tinymce.com/tryit/full.php

This use the modern theme... 这使用了现代主题...

I simply added this to whichever change_form.html template for whatever model I was needing the rich editor. 我只是将它添加到了我需要丰富编辑器的任何模型的change_form.html模板中。 For instance for flatpages: 例如平面广告:

admin/flatpages/flatpage/change_form.html

Or custom model in app: 或应用中的自定义模型:

admin/custom_app/model_name/change_form.html

I know this is exactly an answer to your question, but I think it's worth thinking about and might help you ultimately get what you need. 我知道这确实是您问题的答案,但是我认为这值得考虑,并且可能最终帮助您获得所需的东西。

Also, I should note, it looks like only modern theme is available for TinyMCE v4: 另外,我应该注意,似乎只有现代主题可用于TinyMCE v4:

http://www.tinymce.com/wiki.php/Tutorial:Migration_guide_from_3.x http://www.tinymce.com/wiki.php/Tutorial:Migration_guide_from_3.x

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM