首页 > 编程学习 > js 文本编辑器

js 文本编辑器

发布时间:2022/11/24 23:24:50

view - html

<div class="col-sm-6"><div class="form-group"><label for="summary_summernote">简介/规则</label><div id="summary_summernote"></div></div></div>

-js

$('#summary_summernote').summernote({lang: 'zh-CN', // default: 'en-US'minHeight: 500,callbacks: {onImageUpload: function(files) { //the onImageUpload API  img = sendFile(files[0]);}}});

function sendFile(file) {data = new FormData();data.append("file", file);$.ajax({data: data,type: "POST",url: "<{spUrl c=proxytc a=uploadicon}>?retype=text",cache: false,contentType: false,processData: false,success: function(url) {if (url == "permission_error") {layer.msg("你没有操作权限", {icon: 5, closeBtn: 1, shadeClose: true});} else if (url == "error") {layer.msg("上传失败", {icon: 5, closeBtn: 1, shadeClose: true});} else {$("#summary_summernote").summernote('insertImage', url, 'image name'); // the insertImage API  }}});}




本文链接:https://www.ngui.cc/el/2111916.html
Copyright © 2010-2022 ngui.cc 版权所有 |关于我们| 联系方式| 豫B2-20100000