Skip to content

Add mwolfinspace/siyuan-dictionary#1843

Open
mwolfinspace wants to merge 4 commits into
siyuan-note:mainfrom
mwolfinspace:add-siyuan-dictionary
Open

Add mwolfinspace/siyuan-dictionary#1843
mwolfinspace wants to merge 4 commits into
siyuan-note:mainfrom
mwolfinspace:add-siyuan-dictionary

Conversation

@mwolfinspace

Copy link
Copy Markdown

Translate selected text to Vietnamese via right-click menu.

@github-actions

github-actions Bot commented May 22, 2026

Copy link
Copy Markdown

Pull Request Check Report

Add 1 Plugin Repo

mwolfinspace/siyuan-dictionary


@TCOTC TCOTC self-requested a review May 22, 2026 10:47
@TCOTC TCOTC changed the title Add siyuan-dictionary Add mwolfinspace/siyuan-dictionary May 22, 2026
@mwolfinspace mwolfinspace force-pushed the add-siyuan-dictionary branch from ce8b29e to 66d93db Compare May 22, 2026 10:59
@TCOTC

TCOTC commented May 22, 2026

Copy link
Copy Markdown
Collaborator

初步审核

以下是 AI 的审核结论,请开发者确认并修复之后回复,然后维护者会进行人工审核。

版本: v1.0.0 (commit: 54ed561)

发现的问题

  • 缺少 onunload() 生命周期方法:插件没有实现 onunload() 方法。onload() 中注册的 open-menu-content 事件监听器在禁用、重载或卸载插件时不会被清理,造成资源泄漏。
  • EventBus 监听器使用了匿名函数,无法解除注册:在 index.js 第 20 行,this.eventBus.on("open-menu-content", ...) 使用了箭头匿名函数。即使添加了 onunload(),也无法通过 this.eventBus.off() 移除此监听器。请将处理函数提取为具名函数或类方法。
  • .gitignore 被打包到了 package.zip:压缩包中包含了 .gitignore 文件,这对最终用户是无用的。请在打包前排除此文件。
  • 同步 XMLHttpRequest 请求index.js:41 使用了同步模式的 XMLHttpRequest(第三个参数为 false),这会阻塞浏览器主线程且已被弃用。建议改用 fetch() 异步请求。
  • readme 字段中冗余的 en_US 条目plugin.jsonreadme.en_US 的值与 readme.default 相同,均为 "README_DICT.md"。显式声明的 en_US 是多余的,应删除。
  • 重复的 README 文件内容一致README.mdREADME_DICT.md 内容完全相同。如果只需要一份用于集市展示,请删除重复文件。

需要维护者人工验证

  • 安装插件后测试翻译功能是否能正常工作
  • 验证右键菜单集成是否正确显示
  • 验证点击翻译结果后是否能正常打开 Google Translate 页面
  • 测试断网时是否正常显示离线警告
  • 在不同前端(桌面端、移动端、浏览器端)测试功能

检查通过

  • icon.png 大小:3.4KB(< 20KB ✓)
  • preview.png 大小:87KB(< 200KB ✓)
  • README 文件:无相对路径链接 ✓
  • LICENSE:MIT 协议,年份 2026,版权人 Xedryk ✓
  • window.location.reload() 调用 ✓
  • 压缩包内路径使用正斜杠 ✓
  • plugin.json 字段完整(name、author、url、version、minAppVersion)✓
  • frontends/backends 设置合理 ✓
  • i18n 字段在 plugin.json 中 ✓
  • 使用自定义 SVG 图标(非思源内置图标)✓
  • 无配置存储问题 ✓
  • 无 IPC 使用 ✓
  • 无定时器/Observer ✓

Preliminary Review

The following is the AI's review conclusion. Please confirm and fix the issues before replying, then the maintainer will conduct a manual review.

Version: v1.0.0 (commit: 54ed561)

Issues Found

  • Missing onunload() lifecycle method: The plugin does not implement onunload(), so the open-menu-content eventBus listener registered in onload() is never cleaned up. This causes a resource leak on disable, reload, or uninstall.
  • EventBus listener uses anonymous function, cannot be removed: In index.js:20, this.eventBus.on("open-menu-content", ...) uses an anonymous arrow function. Even if onunload() is added, this.eventBus.off() cannot remove this listener. Extract the handler to a named function or class method.
  • .gitignore bundled in package.zip: The zip includes .gitignore, which is unnecessary for end users. Exclude this file before packaging.
  • Synchronous XMLHttpRequest: At index.js:41, synchronous XMLHttpRequest (third param false) blocks the main thread and is deprecated. Use fetch() with async/await instead.
  • Redundant en_US in readme field: plugin.json has readme.en_US with the same value ("README_DICT.md") as readme.default. Delete the redundant en_US entry.
  • Duplicate README files with identical content: README.md and README_DICT.md have exactly the same text. Remove the duplicate if only one is needed.

Needs Manual Verification

  • Install and test the translation feature in SiYuan
  • Verify the context menu integration works correctly
  • Verify the Google Translate URL opens in browser on click
  • Verify offline warning appears when network is unavailable
  • Test on different frontends (desktop, mobile, browser)

Passed

  • icon.png size: 3.4KB (< 20KB ✓)
  • preview.png size: 87KB (< 200KB ✓)
  • README: no relative-path links ✓
  • LICENSE: MIT, year 2026, copyright holder Xedryk ✓
  • No window.location.reload()
  • Internal zip paths use forward slashes ✓
  • plugin.json fields complete (name, author, url, version, minAppVersion) ✓
  • frontends/backends set appropriately ✓
  • No i18n field in plugin.json ✓
  • Custom SVG icon used (not SiYuan built-in) ✓
  • No config management issues ✓
  • No IPC usage ✓
  • No timers/observers ✓

@mwolfinspace mwolfinspace force-pushed the add-siyuan-dictionary branch from 66d93db to 9d0d3cb Compare May 22, 2026 11:36
@mwolfinspace mwolfinspace force-pushed the add-siyuan-dictionary branch from 9d0d3cb to 33b5db3 Compare May 22, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants