1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-23 03:50:56 +08:00
2024-05-05 21:52:13 +08:00

45 lines
1.4 KiB
JavaScript

layui.use(['jquery'], function () {
var $ = layui.jquery;
var editor;
var options = {
uploadJson: '/upload/content/img',
cssPath: '/static/home/css/content.css',
width: '100%',
height: '300px',
items: [
'selectall', '|',
'undo', 'redo', '|',
'formatblock', 'formatblock', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'strikethrough', 'removeformat', '|',
'insertorderedlist', 'insertunorderedlist', 'table', 'code', '|',
'image', 'link', 'unlink', '|',
'source', 'about'
],
htmlTags: {
span: ['.color', '.background-color'],
a: ['id', 'class', 'href', 'target', 'name'],
img: ['id', 'class', 'src', 'width', 'height', 'alt', 'title'],
table: ['id', 'class'],
div: ['id', 'class'],
pre: ['id', 'class'],
hr: ['id', 'class'],
'td,th': ['id', 'class'],
'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6': ['id', 'class'],
'br,tbody,tr,strong,b,sub,sup,em,i,u,strike,s,del': ['id', 'class'],
},
extraFileUploadParams: {
csrf_token: $('meta[name="csrf-token"]').attr('content')
}
};
KindEditor.ready(function (K) {
editor = K.create('#editor-textarea', options);
});
$('.kg-submit').on('click', function () {
editor.sync();
});
});