Ueditor部署路径(集成sharepoint)
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\template\layouts\Resource\ueditor\ueditor\net
注意:需要 “转换成为应用程序”
需要修改uedittor.config.js文件
前端页面的引用代码如下:
1 <table> 2 <tr> 3 <td style="display: block;"> 4 <p>排序编号:</p> 5 </td> 6 <td> 7 <input id="txt_num" type="text" style="width: 300px;" /> 8 </td> 9 </tr> 10 <tr> 11 <td> 12 <p>标题:</p> 13 </td> 14 <td> 15 <table style="width: 100%;"> 16 <tr> 17 <td> 18 <input id="txt_title" type="text" style="width: 300px;" /></td> 19 <td style="text-align: right;"> 20 <input type="button" onclick="saveContent()" value="保存" /> 21 <input type="button" onclick="skip()" value="取消" /> 22 </td> 23 </tr> 24 </table> 25 </td> 26 </tr> 27 <tr> 28 <td style="display: block;"> 29 <p>内容:</p> 30 </td> 31 <td> 32 <script id="editor" type="text/plain" style="width: 1024px; height: 500px;"></script> 33 </td> 34 </tr> 35 <tr> 36 <td></td> 37 <td style="text-align: right;"> 38 <input type="button" onclick="saveContent()" value="保存" /> 39 <input type="button" onclick="skip()" value="取消" /> 40 </td> 41 </tr> 42 </table> 43 </div> 44 <%}%> 45 <script type="text/javascript"> 46 //实例化编辑器 47 //建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor(‘editor‘)就能拿到相关的实例 48 //var ue = UE.getEditor(‘editor‘); 49 50 function saveContent() { 51 var arr = UE.getEditor(‘editor‘).getContent(); 52 var cur_title = $(‘#txt_title‘).val(); 53 var itemId = "<%=item_id%>"; 54 var listName = "<%=Props_Data_listID%>"; 55 var operation = "<%=operation%>"; 56 var serialNumber = $(‘#txt_num‘).val(); 57 var myreg = /^[0-9,]*$/; 58 if (!myreg.test(serialNumber) || serialNumber == "") { 59 alert(‘请填写有效的排序编号(1-99)!‘); 60 return; 61 if (serialNumber < 1 || serialNumber > 99) { 62 alert(‘请填写有效的排序编号(1-99)!‘); 63 return; 64 } 65 } 66 67 if (cur_title == "") { 68 alert(‘请填写标题!‘); 69 return; 70 } 71 72 $.ajax({ 73 type: "post", 74 url: "../_layouts/15/Resource/ueditor/newMagazineSave.ashx", 75 data: { "content": arr, "title": cur_title, "operation": operation, "listName": listName, "itemId":itemId, "serialNumber": serialNumber }, 76 datatype: "text", 77 success: function () { 78 window.close(); <%--window.location.href = "<%=showUrl%>";--%> 79 }, 80 error: function (e) { 81 alert(e); 82 } 83 }); 84 } 85 86 87 function skip() { 88 window.close(); 89 } 90 91 function setContent(isAppendTo) { 92 var cur_content = "<%=content%>"; 93 UE.getEditor(‘editor‘).setContent(cur_content, isAppendTo); 94 } 95 96 $(window).load(function () { 97 var ue = UE.getEditor(‘editor‘); 98 var operation = "<%=operation%>"; 99 if (operation == "edit") 100 { 101 ue.ready(function () { 102 setContent(); 103 }); 104 105 $("#txt_num").val = "<%=serialNumber%>"; 106 document.getElementById("txt_num").value = "<%=serialNumber%>"; 107 108 $("#txt_title").val = "<%=title%>"; 109 document.getElementById("txt_title").value = "<%=title%>"; 110 } 111 }); 112 113 </script>
时间: 2024-10-25 23:01:42