GithubHelp home page GithubHelp logo

halo-dev / plugin-comment-widget Goto Github PK

View Code? Open in Web Editor NEW
20.0 5.0 18.0 12.23 MB

通用的 Halo 2.0 评论组件插件

Home Page: https://halo.run/store/apps/app-YXyaD

License: GNU General Public License v3.0

JavaScript 6.56% TypeScript 16.89% Java 10.53% CSS 1.99% Vue 63.18% HTML 0.85%
halo halo-plugin

plugin-comment-widget's Introduction

plugin-comment-widget

Halo 2.0 的通用评论组件插件,为前台提供完整的评论解决方案。

使用方式

  1. 下载,目前提供以下两个下载方式:
  2. 安装,插件安装和更新方式可参考:https://docs.halo.run/user-guide/plugins

需要注意的是,此插件需要主题进行适配,不会主动在内容页加载评论组件。

开发环境

git clone [email protected]:halo-dev/plugin-comment-widget.git

# 或者当你 fork 之后

git clone [email protected]:{your_github_id}/plugin-comment-widget.git
cd path/to/plugin-comment-widget
./gradlew pnpmInstall

./gradlew build

修改 Halo 配置文件:

halo:
  plugin:
    runtime-mode: development
    classes-directories:
      - "build/classes"
      - "build/resources"
    lib-directories:
      - "libs"
    fixedPluginPath:
      - "/path/to/plugin-comment-widget"

主题适配

此插件是一个通用的评论组件插件,主题需要针对此类型插件做适配。Halo 为模板引擎提供了专门的标签(<halo:comment />),只需要在必要的位置添加此标签即可。

以下是代码示例:

<!-- /templates/post.html -->
<halo:comment
  group="content.halo.run"
  kind="Post"
  th:attr="name=${post.metadata.name}"
  colorScheme="'light'"
/>

参数解释:

  • group:自定义模型的 group,目前文章和自定义页面的分组均为 content.halo.run
  • kind:目前支持 Post(文章) 和 SinglePage(自定义页面) 两种类型,分别可用于 post.htmlpage.html 模板。
  • name:文章或者自定义页面的唯一标识,可通过 post.metadata.name 或者 singlePage.metadata.name 获取。
  • colorScheme:评论组件的颜色方案,支持 lightdark 两种,支持固定或者 JavaScript 变量。需要注意的是,如果需要固定一个值,那么需要添加单引号,如 'dark'。使用 JavaScript 变量时不需要。

plugin-comment-widget's People

Contributors

guqing avatar lilgg avatar ruibaby avatar wsj20010128 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

plugin-comment-widget's Issues

匿名评论无法看到发送的待审核评论

Your current Halo version

2.11

Describe this feature

当设置为开放注册,默认为访客时,访客身份评论后可以看到自己发送的评论,并提示待审核中。当设置不开放注册,并开放匿名评论时,匿名用户评论后不能像访客身份一样看到自己发送的评论,但实际后台中是有此评论的,可能会让匿名用户困惑是否成功评论。所以是否能让匿名评论也像访客评论一样可以显示并提示待审核中。

Additional information

No response

【BUG】关于评论审核和邮件通知

  1. 用户 A 留下评论审核后显示在了页面上,用户 B 回复了用户 A 的评论,这条回复并没有审核通过,但是用户 A 却收到了评论回复的邮件提醒,个人觉得应该改为审核通过后在进行邮件提醒

  2. 希望评论后加一个“等待审核通过”的提示语,当开启评论审核后用户的评论不会直接显示在页面上,评论后没有任何提示,容易出现“我刚才是不是评论失败了”的错觉

  3. 现在只有一级评论才会对站长进行邮件提醒,当用户 B 回复了用户 A 站长并不知情,这里建议回复也加上站长邮件提醒,否则不能及时审核

无法注册

用户无法注册 全是一样的名字 一样的头像
image

建议:支持站长自己管理评论表情包

现在使用的评论插件只有默认的emoji表情,建议在后续的评论插件可以允许站长(或者网站管理员)添加和管理图片表情包,以增加互动趣味性。

或者提供几套好看的表情包也可以

无法正常发送评论

halo版本
v2.3.0

评论插件
v1.3.0

问题描述
点击提交评论后,提交按钮一直loading,不回调。去后台发现评论已提交。

评论回复展示顺序与后端不一致

Halo 版本

2.2.0 development

插件版本

1.2.0 development

问题描述

后端展示的评论回复顺序与插件前端展示的评论顺序不一致。

后端如图所示:
image

前端如图所示:
image

个人认为应该同后端所示,按评论创建时间从上往下正序排列。

/kind bug

希望所有评论可以默认展开

如果评论再有回复,现在默认是需要再点一下的,希望能够默认评论全部展开或者加个开关之类的。另外希望评论显示时间是具体的时间而不是相对于现在的时间~
image

请求提供原始js文件

请问源码中的comment-widget.iife.js文件为什么是压缩格式的?可以提供原始的js文件吗?谢谢。

评论区在白天/黑夜模式切换后的样式问题

评论区在白天/黑夜模式手动切换后,样式不能跟随适配,需要手动刷新之后才能适配,这是插件的问题还是主题的问题?
如图所示,黑夜->白天之后,一些样式依旧是暗色,并且红框内的用户名因为是白色而无法查看。
image

单个页面有多个评论组件时,实现按需加载。

问题描述

当前情况下,当单个页面有多个评论区域时,所有的评论区会在页面加载的时候一次性全部请求并处理,非常耗费资源。如下图所示
image

问题期望

实现按需加载,例如,当评论组件可视时,再进行资源的请求与加载。

新增最近评论的接口

查询所有文章评论最新的几条

{
  "page": 1,
  "size": 2,
  "total": 5,
  "items": [
    {
      "spec": {
        "raw": "222",
        "content": "222",
        "owner": {
          "kind": "Email",
          "name": "[email protected]",
          "displayName": "test",
          "annotations": {
            "website": "https://airbozh.cn"
          }
        },
        "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.41",
        "ipAddress": "127.0.0.1",
        "approvedTime": "2023-02-13T18:18:50.635073600Z",
        "priority": 0,
        "top": false,
        "allowNotification": true,
        "approved": true,
        "hidden": false,
        "subjectRef": {
          "group": "content.halo.run",
          "version": "v1alpha1",
          "kind": "Post&size=20&page=1",
          "name": "5fb642fc-a828-4149-a9ab-479baaf9dcff"
        }
      },
      "status": {
        "unreadReplyCount": 0,
        "hasNewReply": false
      },
      "apiVersion": "content.halo.run/v1alpha1",
      "kind": "Comment",
      "metadata": {
        "finalizers": [
          "comment-protection"
        ],
        "name": "5c0998a9-fae8-4b93-b442-69a6d841cc3c",
        "annotations": {},
        "version": 2,
        "creationTimestamp": "2023-02-13T18:18:50.635073600Z"
      }
    },
    {
      "spec": {
        "raw": "qweqwe",
        "content": "qweqwe",
        "owner": {
          "kind": "Email",
          "name": "[email protected]",
          "displayName": "test",
          "annotations": {
            "website": "https://airbozh.cn"
          }
        },
        "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.41",
        "ipAddress": "127.0.0.1",
        "approvedTime": "2023-02-13T18:05:04.899478700Z",
        "priority": 0,
        "top": false,
        "allowNotification": true,
        "approved": true,
        "hidden": false,
        "subjectRef": {
          "group": "content.halo.run",
          "version": "v1alpha1",
          "kind": "Post&size=20&page=1",
          "name": "5fb642fc-a828-4149-a9ab-479baaf9dcff"
        }
      },
      "status": {
        "unreadReplyCount": 0,
        "hasNewReply": false
      },
      "apiVersion": "content.halo.run/v1alpha1",
      "kind": "Comment",
      "metadata": {
        "finalizers": [
          "comment-protection"
        ],
        "name": "84569789-311b-447c-8635-42de47f507a4",
        "annotations": {},
        "version": 2,
        "creationTimestamp": "2023-02-13T18:05:04.900475Z"
      }
    }
  ],
  "first": true,
  "last": false,
  "hasNext": true,
  "hasPrevious": false,
  "totalPages": 3
}

手机端样式问题

1.手机端Emoji列表有一半显示不出来。
2.手机端,用户登录的情况下,名字过长,或者屏幕宽度过小会造成样式混乱

目前可以用,但是为啥填写了网址网站,头像或者名字却没有超链接?

目前可以用,但是为啥填写了网址网站,头像或者名字却没有超链接?
类似wordpress一样,点名字或者头像,可以超链接他自己写的网站呢
要不然,我这边无法及时互动呀,哥哥!~

是否可以介入 G头像的那个,写邮箱为了头像,或者现在很多评论体系需要写QQ,自动获取头像的那个?

建议:网址哪里可以写也可以不写,不强制,写的话,名字超链接上,不写的话,就没超链接。

这样可以吗,非常感谢~ 新人小白,敬上!

补充: 此插件是一个通用的评论组件插件,主题需要针对此类型插件做适配。Halo 为模板引擎提供了专门的标签(<halo:comment />),只需要在必要的位置添加此标签即可。

目前不懂,自用默认主题,什么也不用配置就好用。

增加 autosize 来自动扩充编辑区域

问题描述

评论的编辑区域默认情况下,如果输入的文本超过当前行数,将会展示一个滚动条,如下所示:

image

期望结果

期望能够使用 autosize 来让评论区域自动扩充,如下所示:
image

评论展示

halo2.9 评论插件1.7.0 友连1.3.1
image

友连 页面 评论展示未知

评论功能字数过多异常

评论字数过长或者太多,查询会oom,建议限制长度,或者分段查询,缩略... (容易被恶意刷评)
展示框异常,如果很长一段评论完成后,框体不会缩小,被撑的很大

插件初始化失败

我第一次访问有评论插件的页面的时候会报错CommentWidget is not defined,再次刷新页面或者点击页面,又会正常渲染,不知道是主题问题还是插件问题。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.