type: ‘POST’,
data: formData,
processData: false,
contentType: false,
success: function (data) {
//图片插入到summernote中
$(“#summernote”).summernote(‘insertImage’, data);
},
error: function () {
alert(“上传失败”)
}
})
},
//清除word复制的格式
onPaste: function (ne) {
var bufferText = ((ne.originalEvent || ne).clipboardData || window.clipboardData).getData(‘Text/plain’);
ne.preventDefault ? ne.preventDefault() : (ne.returnValue = false);
setTimeout(function () {
document.execCommand(“insertText”, false, bufferText);
}, 10);
}
}
});
});
toolbar设置工具栏功能控件,可以自定义,也可以使用默认的。
Summernote工具栏所有属性。
-
插入
-
picture
: 打开图像对话框 -
link
: 打开链接对话框 -
video
: 打开视频对话框 -
table
: 插入表格 -
hr
: 插入水平线 -
字体样式
-
fontname
: 设置字体系列 -
fontsize
: 设置字体大小 -
color
: 设置前景色和背景色 -
forecolor
: 设置前景色 -
backcolor
: 设置背景色 -
bold
: 切换字体粗细 -
italic
: 斜体 -
underline
: 切换下划线 -
strikethrough
: 切换删除线 -
superscript
: 切换上标 -
subscript
: 切换下标 -
clear
: 清除字体样式 -
段落样式
-
style
: 格式化所选块 -
ol
: 切换有序列表 -
ul
: 切换无序列表 -
paragraph
: 段落对齐下拉菜单 -
height
: 设置行高 -
杂项
-
fullscreen