Add Chinese translation and improve README
All checks were successful
Build on Push and create Release on Tag / build (push) Successful in 1m2s

This commit is contained in:
MassiveBox 2025-08-07 18:30:08 +02:00
parent 163a1513e8
commit c2232c3450
6 changed files with 100 additions and 8 deletions

36
README-zh_CN.md Normal file
View file

@ -0,0 +1,36 @@
# SiYuan js-draw 插件
本插件可在思源笔记的任意位置内嵌 js-draw 白板。
## 使用说明
![演示](asset/demo.webp)
- 在插件市场搜索 `js-draw` 并安装。
- 在文档中新建白板:
1. 在文档内输入 `/插入白板`,选择对应菜单项;
2. 白板编辑器将在新标签页打开,随意绘制后点击“保存”并关闭标签页。
- 后续编辑白板:
1. 左键(或轻触)选中白板,然后点击顶部工具栏的“编辑”图标,或使用快捷键 `Alt+Shift+D`
亦可右键白板(或移动端点击三点按钮),在菜单中选择“插件” > “编辑白板”;
2. 编辑器标签页打开后,按需修改,完成后点击“保存”并关闭标签页。
## 计划功能
查看 [Projects](https://git.massive.box/massivebox/siyuan-jsdraw-plugin/projects) 标签页了解详情!
## 贡献
欢迎任何形式的贡献!
中文翻译由 Kimi AI 完成,因我不懂中文,如有疏漏欢迎指出。
若您愿意协助,请 [提交 Issue](https://git.massive.box/massivebox/siyuan-jsdraw-plugin/issues) 或 [联系我](mailto:box@massive.box)。
## 致谢
本项目离不开以下项目与社区的帮助(排名不分先后):
- [SiYuan](https://github.com/siyuan-note/siyuan) 项目
- [js-draw](https://github.com/personalizedrefrigerator/js-draw)
- [SiYuan plugin sample with vite and svelte](https://github.com/siyuan-note/plugin-sample-vite-svelte)
- [siyuan-drawio-plugin](https://github.com/zt8989/siyuan-drawio-plugin) 与 [siyuan-plugin-whiteboard](https://github.com/zuoez02/siyuan-plugin-whiteboard) 提供的灵感与部分代码
也请关注并支持他们!
## 许可证
原始插件框架由思源笔记开发MIT 许可证。
本人所作修改版权所有 © 2025 MassiveBox同样使用 MIT 许可证。

View file

@ -4,12 +4,13 @@
This plugin allows you to embed js-draw whiteboards anywhere in your SiYuan documents. This plugin allows you to embed js-draw whiteboards anywhere in your SiYuan documents.
## Usage instructions ## Usage instructions
![Demo](asset/demo.webp)
- Install the plugin from the marketplace. You can find it by searching for `js-draw`. - Install the plugin from the marketplace. You can find it by searching for `js-draw`.
- To add a new whiteboard to your document: - To add a new whiteboard to your document:
1. Type `/Insert whiteboard` in your document, and select the correct menu entry 1. Type `/Insert whiteboard` in your document, and select the correct menu entry
2. The whiteboard editor will open in a new tab. Draw as you like, then click the Save button and close the tab. 2. The whiteboard editor will open in a new tab. Draw as you like, then click the Save button and close the tab.
- To edit the whiteboard later: - To edit the whiteboard later:
1. Left-click or tap on the whiteboard to select it, then click on the Edit icon in the top bar 1. Left-click or tap on the whiteboard to select it, then click on the Edit icon in the top bar or use the keyboard shortcut `Alt+Shift+D`
- Or right-click on the whiteboard (or click the three dots on mobile), select "Plugin" > "Edit whiteboard" in the menu - Or right-click on the whiteboard (or click the three dots on mobile), select "Plugin" > "Edit whiteboard" in the menu
2. The editor tab will open, edit your file as you like, then click the Save button and close the tab. 2. The editor tab will open, edit your file as you like, then click the Save button and close the tab.
@ -17,9 +18,9 @@ This plugin allows you to embed js-draw whiteboards anywhere in your SiYuan docu
Check out the [Projects](https://git.massive.box/massivebox/siyuan-jsdraw-plugin/projects) tab! Check out the [Projects](https://git.massive.box/massivebox/siyuan-jsdraw-plugin/projects) tab!
## Contributing ## Contributing
Contributions are always welcome! Right now, I'm working on the core functionality and fixing bugs. Contributions are always welcome!
After that is done, I will need help with the internationalization, as, unfortunately, I don't speak Chinese. The Chinese translation is made by Kimi AI, and I'm unable to verify it because I don't speak Chinese. If you do and find issues, please let me know.
Please [contact me](mailto:box@massive.box) if you'd like to help! Please [open an issue](https://git.massive.box/massivebox/siyuan-jsdraw-plugin/issues) or [contact me](mailto:box@massive.box) if you'd like to help!
## Thanks to ## Thanks to
This project couldn't have been possible without (in no particular order): This project couldn't have been possible without (in no particular order):

BIN
asset/demo.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View file

@ -21,13 +21,16 @@
"desktop-window" "desktop-window"
], ],
"displayName": { "displayName": {
"en_US": "JS-Draw Whiteboard" "en_US": "JS-Draw Whiteboard",
"zh_CN": "JS-Draw 白板"
}, },
"description": { "description": {
"en_US": "Include a whiteboard for freehand drawing anywhere in your documents." "en_US": "Include a whiteboard for freehand drawing anywhere in your documents.",
"zh_CN": "在您的文档中添加一个自由绘图白板。"
}, },
"readme": { "readme": {
"en_US": "README.md" "en_US": "README.md",
"zh_CN": "README-zh_CN.md"
}, },
"funding": { "funding": {
"custom": [ "custom": [

52
public/i18n/zh_CN.json Normal file
View file

@ -0,0 +1,52 @@
{
"insertWhiteboard": "插入白板",
"editWhiteboard": "编辑白板",
"editShortcut": "编辑选中的白板",
"errors": {
"noFileID": "缺少文件 ID无法打开文件。",
"notAWhiteboard": "您必须选择白板,而不是普通图片。<a href='https://s.massive.box/jsdraw-plugin-instructions'>使用说明</a>",
"syncIDNotFound": "在文档中找不到该绘图的 SyncID请确保您尝试编辑的白板已包含在至少一个笔记中。",
"createUnknown": "创建编辑器时出现未知错误,请重试。",
"invalidBackgroundColor": "无效的背景颜色!请输入十六进制颜色,例如 #000000黑色或 #FFFFFF白色。将使用原来的背景颜色。",
"multipleSyncIDs": "在文档中发现多个 syncID。请从文档中删除不存在的绘图。\n同步冲突副本可能导致此错误因此请务必删除它们。\n文件 ID可在重命名菜单中更改的部分在所有文档中必须唯一。\n<a href='https://git.massive.box/massivebox/siyuan-jsdraw-plugin/wiki/Errors-and-Fixes#multiple-syncids-found'>完整说明</a>",
"unchangedProtyle": "请确保您尝试编辑的图片仍存在于文档中。",
"saveGeneric": "保存出错!当前绘图已复制到剪贴板。您可能需要新建一个绘图并粘贴进去。",
"mustSelect": "先在文档中左键点击选中白板,然后使用此图标/快捷键直接打开编辑器。<a href='https://s.massive.box/jsdraw-plugin-instructions'>使用说明</a>"
},
"whiteboard": "白板",
"settings": {
"name": "js-draw 插件设置",
"suggestedColors": {
"white": "白色",
"black": "黑色",
"transparent": "透明",
"custom": "自定义",
"darkBlue": "深蓝",
"darkGray": "深灰"
},
"grid": {
"title": "默认启用网格",
"description": "开启后,新白板将自动显示网格。"
},
"backgroundDropdown": {
"title": "背景颜色",
"description": "新白板的默认背景颜色。"
},
"background": {
"title": "自定义背景",
"description": "新白板自定义背景色的十六进制代码。<br /><b>仅在“背景颜色”设为“自定义”时才生效!</b>"
},
"dialogOnDesktop": {
"title": "在桌面端以对话框打开编辑器",
"description": "对话框模式提供更大的绘图区域,但不如标签页(默认)方便。<br />移动端始终会以对话框打开编辑器。"
},
"analytics": {
"title": "分析统计",
"description": "开启后,向开发者发送匿名使用数据。<a href='https://s.massive.box/jsdraw-plugin-privacy'>隐私政策</a>"
},
"restorePosition": {
"title": "记住编辑器位置",
"description": "开启后,编辑器会记住缩放比例和位置,下次打开同一白板时恢复。"
}
}
}

View file

@ -27,7 +27,7 @@ export default class DrawJSPlugin extends Plugin {
this.protyleSlash = [{ this.protyleSlash = [{
id: "insert-whiteboard", id: "insert-whiteboard",
filter: ["Insert Drawing", "Add drawing", "Insert whiteboard", "Add whiteboard", "whiteboard", "freehand", "graphics", "jsdraw"], filter: ["Insert Drawing", "Add drawing", "Insert whiteboard", "Add whiteboard", "whiteboard", "freehand", "graphics", "jsdraw", this.i18n.insertWhiteboard],
html: getMenuHTML("iconDraw", this.i18n.insertWhiteboard), html: getMenuHTML("iconDraw", this.i18n.insertWhiteboard),
callback: async (protyle: Protyle) => { callback: async (protyle: Protyle) => {
void this.analytics.sendEvent('create'); void this.analytics.sendEvent('create');