我向django admin添加了TinyMCE(直接,不是django-tinymce)和django-filebrowser。它有效,除了一件事: 然后我点击Tiny“添加图片”菜单上的文件浏览按钮,我找不到页面(404),因为我不明白这个字符串在Tiny选项中是什么意思:
var managerURL = window.location.toString()
+ 'media/upload/?type=' + type;
完整代码:
<script type="text/javascript">
function tinyDjangoBrowser(field_name, url, type, win) {
var managerURL = window.location.toString()
+ 'media/upload/?type=' + type;
tinyMCE.activeEditor.windowManager.open({
file: managerURL,
title: 'Pic',
width: 800,
height: 450,
resizable: 'yes',
inline: 'yes',
close_previous: 'no',
popup_css : false
}, {
window: win,
input: field_name
});
return false;
}
tinyMCE.init({
mode : "specific_textareas",
theme : "advanced",
skin : "bootstrap",
plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
extended_valid_elements : 'script[type|src],iframe[src|style|width|height|scrolling|marginwidth|marginheight|frameborder],div[*],p[*],object[width|height|classid|codebase|embed|param],param[name|value],embed[param|src|type|width|height|flashvars|wmode]',
media_strict: false,
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,media,advhr,|,print,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
file_browser_callback: 'tinyDjangoBrowser',
relative_urls : "false",
remove_script_host : false,
convert_urls : false
});
</script>
请告诉我,我的情况应该如何?
还有一件事:我需要连接tiny_mce_popup.js吗?对不起,我的英语不好。 THX!
答案 0 :(得分:1)
var managerURL = '/admin/filebrowser/browse/?pop=2'