diff --git a/README-zh_CN.md b/README-zh_CN.md new file mode 100644 index 0000000..f027586 --- /dev/null +++ b/README-zh_CN.md @@ -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 许可证。 \ No newline at end of file diff --git a/README.md b/README.md index 258f071..77a52af 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,13 @@ This plugin allows you to embed js-draw whiteboards anywhere in your SiYuan documents. ## Usage instructions +![Demo](asset/demo.webp) - Install the plugin from the marketplace. You can find it by searching for `js-draw`. - To add a new whiteboard to your document: 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. - 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 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! ## Contributing -Contributions are always welcome! Right now, I'm working on the core functionality and fixing bugs. -After that is done, I will need help with the internationalization, as, unfortunately, I don't speak Chinese. -Please [contact me](mailto:box@massive.box) if you'd like to help! +Contributions are always welcome! +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 [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 This project couldn't have been possible without (in no particular order): diff --git a/asset/demo.webp b/asset/demo.webp new file mode 100644 index 0000000..6137351 Binary files /dev/null and b/asset/demo.webp differ diff --git a/plugin.json b/plugin.json index a5431f9..ceef33c 100644 --- a/plugin.json +++ b/plugin.json @@ -21,13 +21,16 @@ "desktop-window" ], "displayName": { - "en_US": "JS-Draw Whiteboard" + "en_US": "JS-Draw Whiteboard", + "zh_CN": "JS-Draw 白板" }, "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": { - "en_US": "README.md" + "en_US": "README.md", + "zh_CN": "README-zh_CN.md" }, "funding": { "custom": [ diff --git a/public/i18n/zh_CN.json b/public/i18n/zh_CN.json new file mode 100644 index 0000000..7c62e7a --- /dev/null +++ b/public/i18n/zh_CN.json @@ -0,0 +1,52 @@ +{ + "insertWhiteboard": "插入白板", + "editWhiteboard": "编辑白板", + "editShortcut": "编辑选中的白板", + "errors": { + "noFileID": "缺少文件 ID,无法打开文件。", + "notAWhiteboard": "您必须选择白板,而不是普通图片。使用说明", + "syncIDNotFound": "在文档中找不到该绘图的 SyncID,请确保您尝试编辑的白板已包含在至少一个笔记中。", + "createUnknown": "创建编辑器时出现未知错误,请重试。", + "invalidBackgroundColor": "无效的背景颜色!请输入十六进制颜色,例如 #000000(黑色)或 #FFFFFF(白色)。将使用原来的背景颜色。", + "multipleSyncIDs": "在文档中发现多个 syncID。请从文档中删除不存在的绘图。\n同步冲突副本可能导致此错误,因此请务必删除它们。\n文件 ID(可在重命名菜单中更改的部分)在所有文档中必须唯一。\n完整说明", + "unchangedProtyle": "请确保您尝试编辑的图片仍存在于文档中。", + "saveGeneric": "保存出错!当前绘图已复制到剪贴板。您可能需要新建一个绘图并粘贴进去。", + "mustSelect": "先在文档中左键点击选中白板,然后使用此图标/快捷键直接打开编辑器。使用说明" + }, + "whiteboard": "白板", + "settings": { + "name": "js-draw 插件设置", + "suggestedColors": { + "white": "白色", + "black": "黑色", + "transparent": "透明", + "custom": "自定义", + "darkBlue": "深蓝", + "darkGray": "深灰" + }, + "grid": { + "title": "默认启用网格", + "description": "开启后,新白板将自动显示网格。" + }, + "backgroundDropdown": { + "title": "背景颜色", + "description": "新白板的默认背景颜色。" + }, + "background": { + "title": "自定义背景", + "description": "新白板自定义背景色的十六进制代码。
仅在“背景颜色”设为“自定义”时才生效!" + }, + "dialogOnDesktop": { + "title": "在桌面端以对话框打开编辑器", + "description": "对话框模式提供更大的绘图区域,但不如标签页(默认)方便。
移动端始终会以对话框打开编辑器。" + }, + "analytics": { + "title": "分析统计", + "description": "开启后,向开发者发送匿名使用数据。隐私政策" + }, + "restorePosition": { + "title": "记住编辑器位置", + "description": "开启后,编辑器会记住缩放比例和位置,下次打开同一白板时恢复。" + } + } +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 1e0d691..ae064b0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -27,7 +27,7 @@ export default class DrawJSPlugin extends Plugin { this.protyleSlash = [{ 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), callback: async (protyle: Protyle) => { void this.analytics.sendEvent('create');