添加评论表情、评论图床 ✅
This commit is contained in:
parent
afe1269afd
commit
c7384fae1b
@ -1,6 +1,6 @@
|
||||
.vh-comment {
|
||||
box-sizing: border-box;
|
||||
padding: 2rem 1rem 1rem;
|
||||
padding: 2rem 1rem 2.88rem;
|
||||
width: 100%;
|
||||
height: max-content;
|
||||
border-radius: 0.5rem;
|
||||
@ -401,7 +401,7 @@
|
||||
|
||||
// 图片
|
||||
img {
|
||||
&:not(.wl-user-avatar, .wl-reaction-list img) {
|
||||
&:not(.wl-user-avatar, .wl-reaction-list img,.wl-panel img) {
|
||||
max-height: 66px;
|
||||
object-fit: contain;
|
||||
cursor: zoom-in;
|
||||
|
||||
@ -14,7 +14,16 @@ const WalineFn = async (commentDOM: string, walineInit: any) => {
|
||||
import('@waline/client/waline.css');
|
||||
import('@waline/client/waline-meta.css');
|
||||
const { init } = await import('@waline/client');
|
||||
walineInit = init({ el: commentDOM, serverURL: SITE_INFO.Comment.Waline.serverURL });
|
||||
walineInit = init({
|
||||
el: commentDOM, serverURL: SITE_INFO.Comment.Waline.serverURL, emoji: ['https://registry.npmmirror.com/@waline/emojis/1.3.0/files/alus', 'https://registry.npmmirror.com/@waline/emojis/1.3.0/files/bilibili', 'https://registry.npmmirror.com/@waline/emojis/1.3.0/files/bmoji', 'https://registry.npmmirror.com/@waline/emojis/1.3.0/files/qq', 'https://registry.npmmirror.com/@waline/emojis/1.3.0/files/tieba', 'https://registry.npmmirror.com/@waline/emojis/1.3.0/files/weibo', 'https://registry.npmmirror.com/@waline/emojis/1.3.0/files/soul-emoji'],
|
||||
imageUploader: async (file: any) => {
|
||||
const body = new FormData();
|
||||
body.append('file', file);
|
||||
const res = await fetch("https://wp-cdn.4ce.cn/upload", { method: "POST", body });
|
||||
const resJson = await res.json();
|
||||
return resJson.data.link.replace('i.imgur.com', 'wp-cdn.4ce.cn/v2');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 检查是否开启评论
|
||||
@ -26,10 +35,11 @@ const checkComment = () => {
|
||||
|
||||
// 初始化评论插件
|
||||
const commentInit = async (key: string, walineInit: any) => {
|
||||
// 评论列表
|
||||
const CommentList: any = { TwikooFn, WalineFn };
|
||||
// 评论 DOM
|
||||
const commentDOM = '.vh-comment>section'
|
||||
if (!document.querySelector(commentDOM)) return;
|
||||
// 评论列表
|
||||
const CommentList: any = { TwikooFn, WalineFn };
|
||||
// 初始化评论
|
||||
CommentList[`${key}Fn`](commentDOM, walineInit);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
|
||||
import vh from 'vh-plugin'
|
||||
import vh from 'vh-plugin';
|
||||
import { fmtDate } from '@/utils/index'
|
||||
import { $GET } from '@/utils/index'
|
||||
// 图片懒加载
|
||||
|
||||
@ -10,7 +10,7 @@ const ViewImgList: string[] = [
|
||||
// Twikoo 评论区图片
|
||||
".vh-comment>.twikoo>.tk-comments img:not(.tk-avatar-img,.tk-owo-emotion,.OwO-item img)",
|
||||
// Waline 评论区图片
|
||||
".vh-comment div[data-waline] img:not(.wl-user-avatar,.wl-avatar img,.wl-reaction-list img)"
|
||||
".vh-comment div[data-waline] img:not(.wl-user-avatar,.wl-avatar img,.wl-reaction-list img,.wl-panel img)"
|
||||
];
|
||||
// 初始化
|
||||
export default async () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user