tinymce with jframe and form plugin
I manage to call TinyMce editor with Jframe ,but for now I have a problem:
textarea is not update on insert or up开发者_StackOverflow中文版date click button . For each event jFrame take control and I cannot call any event before submit or click or anything else.
Anyone have experiece this ?
For every one ,I find the solution :
on jFrame caller page init TinyMCE :
<script type="text/javascript" src="../js/tinymce/tiny_mce_gzip.js"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
tinyMCE_GZ.init({
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,ccSimpleUploader,mediaservice",
themes : 'advanced',
languages : 'en',
disk_cache : true,
debug : false
});
//add a function
function loadEditor() {
tinyMCE.init({
mode : "exact",
elements : "wysiwyg",
theme : "advanced",
skin : "o2k7",
skin_variant : "silver",
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,ccSimpleUploader,mediaservice",
theme_advanced_buttons1 : "code,fullscreen,preview,|newdocument,|,search,|,undo,redo,|,cut,copy,paste,pastetext,pasteword,|,bold,italic,underline,|,forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist",
................................
});
}
$(document).ready(function(){
//on ajax event complete
$("#invoices_target").ajaxComplete(function() {
loadEditor();
});
//--><!]]>
</script>
then in called page :
<script type="text/javascript">
<!--//--><![CDATA[//><!--
$(document).ready(function(){
});
function saveMCE() {
tinyMCE.triggerSave();
tinyMCE.execCommand('mceRemoveControl',true,'wysiwyg');
}
//--><!]]>
</script>
then put the saveMCE() function on "onClick" button event in your form :
<form id="recordSettings" method="post" name="settings">
<textarea id="wysiwyg" rows="8" cols="47" name="wysiwyg"></textarea>
<input onclick="javascript:saveMCE();" type="button" name="insert" />
</form>
That's all, for me this work fine ,hope for you too.
精彩评论