在WinForm中借助WebBrowser控件使用 tinymce 总结
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",//配置插件< br >< br >//工具栏按钮 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:"",< br >< br >//工具栏位置 theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left",< br >< br >// 字体列表 theme_advanced_fonts : "黑体,宋体,微软雅黑,楷体,魏碑",< br >// 内容区域CSS样式表< br >content_css : "./themes/advanced/css/editor_content.css",< br >< br >< br >< br >< br >< br >< br >< br > |
设置、获取、插入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();< br >< br >// 插入html< br >tinyMCE.get("tinyArea").execCommand("mceInsertContent", false, html);< br >或< br >tinymce.activeEditor.execCommand("mceInsertContent", false, html);< br >// 动态设置tinymce 高度< br >tinyMCE.DOM.setStyle(tinyMCE.DOM.get("tinyArea" + "_ifr"), "height", ("" + height + "px")); |
在 html、tinymce 中调用WinForm里的方法:
window.external.Function();< br >< br >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 ; } |
分类:
[99-1]资料收集
, [01-4].NET-WinForm
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
2010-09-11 零起点学习WPF之《WPF揭秘》读书笔记(9)——第三章 多个提供程序的支持
2010-09-11 零起点学习WPF之《WPF揭秘》读书笔记(8)——第三章 属性值继承