From e24cf1bd1c83f48f351a604d810999fe443aa245 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Sun, 28 Apr 2024 21:17:36 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=B0=83=E6=95=B4=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E6=9D=A1=E7=9B=AE=202.=E5=A2=9E=E5=8A=A0=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=9D=97=E5=A4=8D=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Tasks/SyncAppInfoTask.php | 4 ++++ public/static/admin/js/content.editor.js | 11 ++++++----- public/static/home/css/content.css | 24 +++++++++++++++++++++++- public/static/home/js/content.editor.js | 9 +++++---- public/static/home/js/copy.js | 17 +++++++++++++++-- 5 files changed, 53 insertions(+), 12 deletions(-) diff --git a/app/Console/Tasks/SyncAppInfoTask.php b/app/Console/Tasks/SyncAppInfoTask.php index cbca2b44..361d029e 100644 --- a/app/Console/Tasks/SyncAppInfoTask.php +++ b/app/Console/Tasks/SyncAppInfoTask.php @@ -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; } } diff --git a/public/static/admin/js/content.editor.js b/public/static/admin/js/content.editor.js index d9e370a5..b7b948cb 100644 --- a/public/static/admin/js/content.editor.js +++ b/public/static/admin/js/content.editor.js @@ -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') } diff --git a/public/static/home/css/content.css b/public/static/home/css/content.css index fd953ae6..d5ff9a65 100644 --- a/public/static/home/css/content.css +++ b/public/static/home/css/content.css @@ -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; } \ No newline at end of file diff --git a/public/static/home/js/content.editor.js b/public/static/home/js/content.editor.js index cbefda90..1a09f8f6 100644 --- a/public/static/home/js/content.editor.js +++ b/public/static/home/js/content.editor.js @@ -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') } diff --git a/public/static/home/js/copy.js b/public/static/home/js/copy.js index c66d263f..0c7bfc12 100644 --- a/public/static/home/js/copy.js +++ b/public/static/home/js/copy.js @@ -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 = $('复制').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('内容已经复制到剪贴板'); });