1、tinymce 初始化函数:
tinyMCE.init({ });
2、常用配置项:
mode : "textareas", theme : "advanced", //主题 elements : "tinyArea",// id language : "zh-cn", //语言 skins : "o2k7", //皮肤 width : "100%", //宽度 height : h, //高度 readonly : readonly, //只读模式? dialog_type : 'modal',//对话框模式 plugins : "table,advlist,autolink,insertdatetime,noneditable,searchreplace,print",//配置插件
//工具栏按钮 theme_advanced_buttons1:"undo,redo,cut,copy,pasteAsHtml,pasteAsText,|,bold,italic,strikethrough,underline,justifyleft,justifycenter,justifyright,outdent,indent,bullist,numlist,link,unlink,forecolor,backcolor,removeformat,hr,formatselect,fontselect,fontsizeselect,|,addAtt", theme_advanced_buttons2:"tablecontrols,|,insertCode,code,|,insertdate,inserttime,search,|,print", theme_advanced_buttons3:"",
//工具栏位置 theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left",
// 字体列表 theme_advanced_fonts : "黑体,宋体,微软雅黑,楷体,魏碑",
// 内容区域CSS样式表
content_css : "./themes/advanced/css/editor_content.css",
设置、获取、插入html代码
以下的 tinyArea 为编辑器的id
// 设置html tinyMCE.get("tinyArea").setContent(html); 或 tinymce.activeEditor.setContent(html); // 获取html var html = tinyMCE.get("tinyArea").getContent(); 或 var html = tinymce.activeEditor.getContent();
// 插入html
tinyMCE.get("tinyArea").execCommand("mceInsertContent", false, html);
或
tinymce.activeEditor.execCommand("mceInsertContent", false, html);
// 动态设置tinymce 高度
tinyMCE.DOM.setStyle(tinyMCE.DOM.get("tinyArea" + "_ifr"), "height", ("" + height + "px"));
在 html、tinymce 中调用WinForm里的方法:
window.external.Function();
window.external得到的是绑定到WebBrowser控件的 ObjectForScripting 属性对象。
tinymce 回调函数列表:
cleanup_callback execcommand_callback file_browser_callback handle_event_callback handle_node_change_callback init_instance_callback onchange_callback oninit onpageload remove_instance_callback save_callback setup setupcontent_callback urlconverter_callback
Editor 事件列表:
API : tinymce.Editor.onActivate (event) API : tinymce.Editor.onBeforeExecCommand (event) API : tinymce.Editor.onBeforeGetContent (event) API : tinymce.Editor.onBeforeRenderUI (event) API : tinymce.Editor.onBeforeSetContent (event) API : tinymce.Editor.onChange (event) API : tinymce.Editor.onClick (event) API : tinymce.Editor.onContextMenu (event) API : tinymce.Editor.onDblClick (event) API : tinymce.Editor.onDeactivate (event) API : tinymce.Editor.onEvent (event) API : tinymce.Editor.onExecCommand (event) API : tinymce.Editor.onGetContent (event) API : tinymce.Editor.onInit (event) API : tinymce.Editor.onKeyDown (event) API : tinymce.Editor.onKeyPress (event) API : tinymce.Editor.onKeyUp (event) API : tinymce.Editor.onLoadContent (event) API : tinymce.Editor.onMouseDown (event) API : tinymce.Editor.onMouseUp (event) API : tinymce.Editor.onNodeChange (event) API : tinymce.Editor.onPaste (event) API : tinymce.Editor.onPostProcess (event) API : tinymce.Editor.onPostRender (event) API : tinymce.Editor.onPreInit (event) API : tinymce.Editor.onPreProcess (event) API : tinymce.Editor.onRedo (event) API : tinymce.Editor.onRemove (event) API : tinymce.Editor.onReset (event) API : tinymce.Editor.onSaveContent (event) API : tinymce.Editor.onSetContent (event) API : tinymce.Editor.onSetProgressState (event) API : tinymce.Editor.onSubmit (event) API : tinymce.Editor.onUndo (event) API : tinymce.Editor.onVisualAid (event)
WinForm 中调用js的方法:
public object InvokeScript(string method) { if (this.tnWebBrowser.Document != null) { return this.tnWebBrowser.Document.InvokeScript(method); } return null; } public object InvokeScript(string method, object obj1) { if (this.tnWebBrowser.Document != null) { return this.tnWebBrowser.Document.InvokeScript(method, new object[] { obj1 }); } return null; }