有谁知道如何用 Episerver Commerce SP2 上的默认编辑器替换 TinyMCE?
1 回答
- 将 tiny_mce 文件夹复制到 eCommerceFramework\5.2\EPiServerCommerceManager\Shared\Apps\Core\Controls\Editors\
- 将 TinyMCEEditor.dll 复制到 Commerce Manager 站点的 \bin 文件夹中。
- 在 Commerce Manager 站点文件夹中打开 appSettings.config。将 2 个键“HtmlEditorControl”和“AdminHtmlEditorControl”更改为新的编辑器路径。
- 在 Commerce Manager 站点的根文件夹中创建文件夹名称“UserFiles”。
- 完成后,进入 Commerce Manager 并测试编辑器。
使用以下控件:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EditorControl.ascx.cs" Inherits="TinyMCEEditor.EditorControl" %>
tinyMCE.init({ // 常规选项模式:"textareas",主题:"advanced",插件:"pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,媒体,搜索替换,打印,上下文菜单,粘贴,方向性,全屏,不可编辑,可视字符,不间断,xhtmlxtras,模板,字数,广告列表”,file_browser_callback:“文件浏览器”,设置:函数(ed){ed.onKeyPress.add(函数( ed, evt) { } ); }, // 主题选项 theme_advanced_buttons1: "bold,italic,underline,|,charmap,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2: "cut ,复制,粘贴,|,搜索,替换,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,cleanup,code,|,preview",theme_advanced_buttons3: "tablecontrols", theme_advanced_buttons4: "", theme_advanced_toolbar_location: "top", theme_advanced_toolbar_align: "left", theme_advanced_statusbar_location: "bottom", theme_advanced_resizing: true, // 示例内容 CSS(应该是你的网站 CSS) content_css: "css/ content.css", // 链接/图像/媒体/模板对话框的下拉列表 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", // 样式格式 style_formats: [ { title: 'Bold text', inline: 'b' }, { title: 'Red text', inline: 'span', styles: { color: ' #ff0000'} }, { 标题:'红色标题',块:'h1',样式:{颜色:'#ff0000'}},{标题:'示例1',内联:'span',类:'example1'},{标题:'示例2 ', inline: 'span', classes: 'example2' }, { title: 'Table styles' }, { title: 'Table row 1', selector: 'tr', classes: 'tablerow1' } ], // 替换模板插件的值 template_replace_values: { username: "Some User", staffid: "991234" } });'tr', classes: 'tablerow1' } ], // 替换模板插件的值 template_replace_values: { username: "Some User", staffid: "991234" } });'tr', classes: 'tablerow1' } ], // 替换模板插件的值 template_replace_values: { username: "Some User", staffid: "991234" } });
功能文件浏览器(字段名,网址,类型,赢){
fileBrowserURL = "../FileManager/Default.aspx?sessionid=<%= Session.SessionID.ToString() %>"; tinyMCE.activeEditor.windowManager.open({ title: "Ajax File Manager", url: fileBrowserURL, width: 950, height: 650, inline: 0, maximizable: 1, close_previous: 0 }, { window: win, input: field_name, sessionid: '<%= Session.SessionID.ToString() %>' } ); } </script> <script type="text/javascript" language="javascript"> $(".ajax__htmleditor_editor_toptoolbar").each(function (index) { $(this).html($(this).html() + "<img onclick=showImgManager('" + index + "') src='../FileManager/icons/img-add-32.png' class='ajax__htmleditor_toolbar_button' /><img onclick=showFileManager('" + index + "') src='../FileManager/icons/Files-add-32.png' class='ajax__htmleditor_toolbar_button' /><div style='display:none;float:left;width:100%;padding-top:5px;' id='divImgManager" + index + "'></div>"); }); function openFileManager(index) { window.open("../FileManager/Default.aspx?sessionid=<%= Session.SessionID %>&input=" + index, "myWindow", "status = 1, height = 650, width = 950, resizable = 0") } </script> <textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 40%" runat="server"></textarea>