富文本中文处理

This commit is contained in:
xiexiangrui 2020-07-04 15:43:41 +08:00
parent c93f54a812
commit d0bd515ed4
3 changed files with 19 additions and 21 deletions

View File

@ -1233,8 +1233,7 @@ var table = {
seeSummernoteDetail: function(index,fild) { seeSummernoteDetail: function(index,fild) {
table.set(); table.set();
var row = $("#" + table.options.id).bootstrapTable('getData')[index]; var row = $("#" + table.options.id).bootstrapTable('getData')[index];
console.log(row) var content = decodeURI(window.atob(row[fild]));
var content =window.atob(row[fild]);
var htmlcontent = [ var htmlcontent = [
"<div style='padding:20px;'>", "<div style='padding:20px;'>",
content, content,

View File

@ -156,10 +156,10 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">${comment}</label> <label class="col-sm-3 control-label">${comment}</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="hidden" name="${field}">
<div class="file-loading"> <div class="file-loading">
<input type="hidden" name="${field}">
<input class="form-control file-upload" name="file" id="${field}" <input class="form-control file-upload" name="file" id="${field}"
type="file" #if($column.required) required#end> type="file" >
</div> </div>
</div> </div>
</div> </div>
@ -261,7 +261,7 @@
callbacks: { callbacks: {
onChange: function (contents, $edittable) { onChange: function (contents, $edittable) {
// Xss 过滤掉了html 内容 所以用base64 保存 // Xss 过滤掉了html 内容 所以用base64 保存
$("input[name='" + this.id + "']").val(window.btoa(contents)) $("input[name='" + this.id + "']").val(window.btoa(encodeURI(contents)));
} }
} }

View File

@ -157,15 +157,14 @@
required#end>[[*{${field}}]]</textarea> required#end>[[*{${field}}]]</textarea>
</div> </div>
</div> </div>
#elseif($column.htmlType == "upload" || $column.htmlType == "uploads") #elseif($column.htmlType == "upload")
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">${comment}</label> <label class="col-sm-3 control-label">${comment}</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="hidden" th:field="*{${field}}">
<div class="file-loading"> <div class="file-loading">
<input type="hidden" th:field="*{${field}}">
<input class="form-control file-upload" name="file" id="${field}" <input class="form-control file-upload" name="file" id="${field}"
type="file" #if($column.htmlType == "uploads") type="file">
multiple#end #if($column.required) required#end>
</div> </div>
</div> </div>
</div> </div>
@ -182,18 +181,18 @@
#end #end
#end #end
#if($table.sub) #if($table.sub)
<h4 class="form-header h4">${subTable.functionName}信息</h4> <h4 class="form-header h4">${subTable.functionName}信息</h4>
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> <button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus">
增加</i></button> 增加</i></button>
<button type="button" class="btn btn-white btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus"> <button type="button" class="btn btn-white btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus">
删除</i></button> 删除</i></button>
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table> <table id="bootstrap-table"></table>
</div>
</div> </div>
</div> </div>
</div>
#end #end
</form> </form>
</div> </div>
@ -267,14 +266,14 @@
$(function () { $(function () {
$('.summernote').each(function (i) { $('.summernote').each(function (i) {
var content = $("input[name='" + this.id + "']").val() var content = $("input[name='" + this.id + "']").val()
content = window.atob(content); content = decodeURI(window.atob(content));
this.innerHTML = content; this.innerHTML = content;
$(this).summernote({ $(this).summernote({
height: 100, height: 100,
lang: 'zh-CN', lang: 'zh-CN',
callbacks: { callbacks: {
onChange: function (contents, $edittable) { onChange: function (contents, $edittable) {
$("input[name='" + this.id + "']").val(window.btoa(contents)) $("input[name='" + this.id + "']").val(window.btoa(encodeURI(contents)));
} }
} }
}); });