若依框架 富文本编辑器
//引入
<head>
<meta charset="UTF-8">
<title>without bootstrap</title>
<script src="../../../static/js/jquery-3.4.1.slim.min.js" th:src="@{/js/jquery-3.4.1.slim.min.js}"></script>
<link href="../../../static/css/summernote-lite.min.css" th:href="@{/css/summernote-lite.min.css}" rel="stylesheet" />
<link href="../../../static/css/font/summernote.woff2" th:href="@{/css/font/summernote.woff2}" rel="stylesheet" />
<link href="../../../static/css/font/summernote.woff" th:href="@{/css/font/summernote.woff}" rel="stylesheet" />
<script src="../../../static/js/summernote-lite.min.js" th:src="@{/js/summernote-lite.min.js}"></script>
<script src="../../../static/js/summernote-zh-CN.js" th:src="@{/js/summernote-zh-CN.js}"></script>
</head>
//定义富文本
<div id="summernote"></div>
<script>
$('#summernote').summernote({
lang : 'zh-CN',
placeholder: 'Hello stand alone ui',
tabsize: 2,
height: 120,
toolbar: [
['style', ['style']],
['font', ['bold', 'underline', 'clear']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['table', ['table']],
['insert', ['link', 'picture', 'video']],
['view', ['fullscreen', 'codeview', 'help']]
]
});
var markupStr = $('#summernote').summernote('code')
var url = "/suumo/house/summernote";
$.ajax({
url : url,
async: false,
type:"post",
data : {"ftext":markupStr},
success: function (data) {
console.log("保存成功")
}
});
var inputext;
$(function() {
inputext = $("#inputtext").val();
$('#summernote').summernote("code",inputext);
})
</script>