Djangoアプリケーションでdjango-tinymceとHTML5 Boilerplate (H5BP) を使用しています。H5BP の賢明な提案に従って、jQueryロードを体の一番下に配置しました。次のようなフォーム フィールドに TinyMCE エディターをアタッチします。
widgets = {
'content': TinyMCE(attrs={'cols': 40, 'rows': 15}),
}
残念ながら、django-tinymce は、jQuery が読み込まれる前に、フォームとフォームセットに添付されたタグを介して jQuery にアクセスしようとします。
ページの下部にロードされているときに、django-tinymce を jQuery とうまく連携させる方法はありますか? ページのレンダリングの前にスクリプトをロードする必要はありません。
フォーム テーブルの行の例を次に示します。
<td>
<textarea rows="15" cols="40" name="form-0-content" id="id_form-0-content"></textarea>
<script type="text/javascript">tinyMCE.init({"spellchecker_languages": "Arabic=ar,Azerbaijani=az,Bulgarian=bg,Bengali=bn,Bosnian=bs,Catalan=ca,Czech=cs,Welsh=cy,Danish=da,German=de,Greek=el,+English / British English=en,Esperanto=eo,Spanish / Argentinian Spanish / Mexican Spanish / Nicaraguan Spanish=es,Estonian=et,Basque=eu,Persian=fa,Finnish=fi,French=fr,Frisian=fy,Irish=ga,Galician=gl,Hebrew=he,Hindi=hi,Croatian=hr,Hungarian=hu,Indonesian=id,Icelandic=is,Italian=it,Japanese=ja,Georgian=ka,Kazakh=kk,Khmer=km,Kannada=kn,Korean=ko,Lithuanian=lt,Latvian=lv,Macedonian=mk,Malayalam=ml,Mongolian=mn,Norwegian Bokmal=nb,Nepali=ne,Dutch=nl,Norwegian Nynorsk=nn,Punjabi=pa,Polish=pl,Portuguese / Brazilian Portuguese=pt,Romanian=ro,Russian=ru,Slovak=sk,Slovenian=sl,Albanian=sq,Serbian / Serbian Latin=sr,Swedish=sv,Swahili=sw,Tamil=ta,Telugu=te,Thai=th,Turkish=tr,Tatar=tt,Ukrainian=uk,Urdu=ur,Vietnamese=vi,Simplified Chinese / Traditional Chinese=zh", "elements": "id_form-0-content", "theme_advanced_buttons3": "forecolorpicker,fontselect,fontsizeselect", "custom_undo_redo_levels": 10, "skin": "o2k7", "cleanup_on_startup": true, "language": "en", "theme_advanced_buttons1": "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect", "directionality": "ltr", "theme_advanced_buttons2": "bullist,numlist,|,outdent,indent,|,undo,redo,|,hr", "theme": "advanced", "strict_loading_mode": 1, "mode": "exact"})</script>
</td>