这里我们再来一次:进一步发挥,我发现了一个我更喜欢的解决方案:根本不在主页面调用tinymce。
有一件事是肯定的:如果你来到这个页面是因为你正在使用Eric的SimpleModal。而且,如果是这样,你肯定会使用jQuery。
考虑到这一点,为什么不使用jQuery版本的tinyMCE?
好的,所以我的解决方案是保持对tinyMCE javascript的调用以及您要在其中使用tinyMCE的页面中的初始化。
在我的情况下,具体来说,我叫一个独立模式的编辑器tinyMCE,因为我使用simpleModal来调用我的显示器,所以我使用jQuery加载函数。
例:加载与编辑模态
页:showEditor.asp(ASP,因为我有数据库访问将有关岗位将被编辑或类型或回复信息)。
modal hidden div(在主应用程序页面上):myModal。
的showEditor页面上
:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- #include virtual="/.../my database functions . asp" -->
<script type='text/javascript' src='/your_path/jscripts/tiny_mce/jquery.tinymce.js' rel='forceLoad'></script>
<script type='text/javascript'>
$(function() {
$('textarea.tinymce').tinymce({
// Location of TinyMCE script
script_url : '/myIncludes/tinyMCE/jscripts/tiny_mce/tiny_mce.js',
// General options
theme : "advanced",
plugins : "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",
// Theme options
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,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,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
// Example content CSS (should be your site CSS)
content_css : "css/content.css",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}
});
});
</script>
</head>
<body>
<textarea id='yourChosenID' class='tinymce' cols='10' rows='10'></textarea>
</body>
</html>
在我所说的编辑页面
,我处理这样的:
..... onClick=showEditor();
function showEditor() {
$('#myModal').load('showEditor.asp');
$('#myModal').modal({ your options here });
}
你去那里: 一套完整的;非修饰;原始示例。根据您的喜好定制它,并特别注意src javascript调用中提到的tinymce,它指的是jQuery(jquery.tinymce.js)版本;而在jQuery函数中提到的那个是纯粹的tiny_mce.js。
一种格式提示:有可用于格式化编辑器窗口上方的按钮。例如,选择一些文本并按下“{}”按钮使它缩进四个空格,这将导致它被渲染为代码块。有关更多信息,另请参阅http://stackoverflow.com/editing-help。 – sth 2011-01-31 00:20:46