1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-08-05 22:11:40 +08:00

1.调整编辑器条目

2.增加代码块复制
This commit is contained in:
xiaochong0302 2024-04-28 21:17:36 +08:00
parent 2b3372c8e8
commit e24cf1bd1c
5 changed files with 53 additions and 12 deletions

View File

@ -15,6 +15,8 @@ class SyncAppInfoTask extends Task
public function mainAction()
{
echo '------ start sync app info ------' . PHP_EOL;
$url = 'https://www.koogua.com/api/instance/collect';
$site = $this->getSettings('site');
@ -37,6 +39,8 @@ class SyncAppInfoTask extends Task
$client = new Client();
$client->request('POST', $url, ['form_params' => $params]);
echo '------ end sync app info ------' . PHP_EOL;
}
}

View File

@ -6,18 +6,19 @@ layui.use(['jquery'], function () {
var options = {
uploadJson: '/admin/upload/content/img',
cssPath: '/static/lib/kindeditor/content.css',
cssPath: '/static/home/css/content.css',
width: '100%',
height: '300px',
items: [
'selectall', '|',
'undo', 'redo', '|',
'copy', 'plainpaste', 'wordpaste', '|',
'formatblock', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'removeformat', '|',
'insertorderedlist', 'insertunorderedlist', 'table', '|',
'superscript', 'subscript', '|', 'image', 'link', 'unlink', '|',
'formatblock', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'strikethrough', 'removeformat', '|',
'insertorderedlist', 'insertunorderedlist', 'table', 'code', '|',
'superscript', 'subscript', '|',
'image', 'link', 'unlink', '|',
'source', 'about'
],
pasteType: 1,
extraFileUploadParams: {
csrf_token: $('meta[name="csrf-token"]').attr('content')
}

View File

@ -178,7 +178,8 @@
font-family: Consolas, Monaco, Andale Mono, monospace;
line-height: 1.7em;
overflow: auto;
padding: 6px 10px;
padding: 15px 10px;
margin-bottom: 15px;
border-left: 5px solid #6CE26C;
}
@ -218,4 +219,25 @@
.ke-content blockquote p {
color: #666;
}
.ke-content pre {
position: relative;
}
.ke-content pre > span.kg-copy {
position: absolute;
top: 10px;
right: 10px;
padding: 0 10px;
color: #fff;
font-size: 12px;
border-radius: 3px;
background: rgba(0, 0, 0, 0.5);
cursor: pointer;
display: none;
}
.ke-content pre:hover > span.kg-copy {
display: block;
}

View File

@ -12,12 +12,13 @@ layui.use(['jquery'], function () {
items: [
'selectall', '|',
'undo', 'redo', '|',
'copy', 'plainpaste', 'wordpaste', '|',
'formatblock', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'removeformat', '|',
'insertorderedlist', 'insertunorderedlist', 'table', '|',
'superscript', 'subscript', '|', 'image', 'link', 'unlink', '|',
'formatblock', 'formatblock', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'strikethrough', 'removeformat', '|',
'insertorderedlist', 'insertunorderedlist', 'table', 'code', '|',
'superscript', 'subscript', '|',
'image', 'link', 'unlink', '|',
'source', 'about'
],
pasteType: 1,
extraFileUploadParams: {
csrf_token: $('meta[name="csrf-token"]').attr('content')
}

View File

@ -1,9 +1,22 @@
layui.use(['layer'], function () {
layui.use(['jquery','layer'], function () {
var $ = layui.jquery;
var layer = layui.layer;
if ($('.ke-content').length > 0) {
var kePres = $('pre');
if (kePres.length > 0) {
kePres.each(function () {
var text = $(this).text();
var btn = $('<span class="kg-copy">复制</span>').attr('data-clipboard-text', text);
$(this).prepend(btn);
});
}
}
var clipboard = new ClipboardJS('.kg-copy');
clipboard.on('success', function (e) {
clipboard.on('success', function () {
layer.msg('内容已经复制到剪贴板');
});