From e7b6e23f8f79d3f266b8f333e28703ed363347b4 Mon Sep 17 00:00:00 2001 From: qiqi Date: Mon, 19 Oct 2026 14:03:55 +0800 Subject: [PATCH] =?UTF-8?q?feat(plugin):=20=E6=96=B0=E5=A2=9E=20image-anno?= =?UTF-8?q?tate=20=E6=A0=87=E6=B3=A8/=E4=BF=AE=E5=9B=BE=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=20+=20=E6=9E=84=E5=BB=BA=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 编辑器逐字移植自 iwb-plaus/iwb-cutout-extension(11 模块 + 2 个 shared 文件,纯 Canvas 2D、零第三方库) - plugin/ 存 ESM 源码,src/index.js 是构建产物(提交进仓,CI 只校验不构建) - scripts/build-plugin.mjs:esbuild 打包 + banner/footer 手写单引号 manifest + 产物自检 - 能力 commands / nodeActions / canvas / canvasWrite;入口 = 节点漂浮菜单 + 右键命令 - 导出模式按编辑器字面量映射:replace → setNodeImage,newNode → createImageNode --- image-annotate/README.md | 48 + image-annotate/package.json | 11 + image-annotate/plugin/editor.css | 1338 ++++++ image-annotate/plugin/editor/crop.js | 326 ++ image-annotate/plugin/editor/dom.js | 208 + image-annotate/plugin/editor/events.js | 1357 ++++++ image-annotate/plugin/editor/history.js | 224 + image-annotate/plugin/editor/index.js | 231 + image-annotate/plugin/editor/layers.js | 721 +++ image-annotate/plugin/editor/objects.js | 646 +++ image-annotate/plugin/editor/placement.js | 251 + image-annotate/plugin/editor/state.js | 82 + image-annotate/plugin/editor/tools.js | 372 ++ image-annotate/plugin/editor/viewport.js | 279 ++ image-annotate/plugin/entry.js | 17 + image-annotate/plugin/glue.js | 125 + image-annotate/plugin/manifest.banner.js | 15 + image-annotate/plugin/manifest.footer.js | 9 + image-annotate/plugin/vendor/image-math.js | 52 + image-annotate/plugin/vendor/layer-logic.js | 41 + image-annotate/src/index.js | 4607 +++++++++++++++++++ package-lock.json | 481 ++ package.json | 6 +- scripts/build-plugin.mjs | 94 + 24 files changed, 11540 insertions(+), 1 deletion(-) create mode 100644 image-annotate/README.md create mode 100644 image-annotate/package.json create mode 100755 image-annotate/plugin/editor.css create mode 100644 image-annotate/plugin/editor/crop.js create mode 100644 image-annotate/plugin/editor/dom.js create mode 100644 image-annotate/plugin/editor/events.js create mode 100644 image-annotate/plugin/editor/history.js create mode 100644 image-annotate/plugin/editor/index.js create mode 100644 image-annotate/plugin/editor/layers.js create mode 100644 image-annotate/plugin/editor/objects.js create mode 100644 image-annotate/plugin/editor/placement.js create mode 100644 image-annotate/plugin/editor/state.js create mode 100644 image-annotate/plugin/editor/tools.js create mode 100644 image-annotate/plugin/editor/viewport.js create mode 100644 image-annotate/plugin/entry.js create mode 100644 image-annotate/plugin/glue.js create mode 100644 image-annotate/plugin/manifest.banner.js create mode 100644 image-annotate/plugin/manifest.footer.js create mode 100644 image-annotate/plugin/vendor/image-math.js create mode 100644 image-annotate/plugin/vendor/layer-logic.js create mode 100644 image-annotate/src/index.js create mode 100644 package-lock.json create mode 100644 scripts/build-plugin.mjs diff --git a/image-annotate/README.md b/image-annotate/README.md new file mode 100644 index 0000000..4d385b5 --- /dev/null +++ b/image-annotate/README.md @@ -0,0 +1,48 @@ +# 标注 / 修图(插件) + +在宿主里选中一个带图的节点,打开**全屏标注编辑器**(画笔 / 矩形 / 箭头 / 文字 / 橡皮 / 吸管 / 抓手 / 裁剪, +图层、撤销重做、缩放平移),导出后**覆盖原节点**或**新建一个节点**。 + +编辑器**移植自** `iwb-plaus` 仓库的 `iwb-cutout-extension`(纯 Canvas 2D、零第三方库): +- 源:`/Users/qiqi/open/github/iwb-plaus/iwb-cutout-extension/src/editor/`(11 个模块)+ `src/shared/{image-math,layer-logic}.js` +- 差异:只有「宿主胶水」(`plugin/glue.js`、`plugin/entry.js`)是新写的;编辑器模块与样式**逐字移植**,便于日后回灌上游。 +- 原扩展的 CSS 由 `manifest.json` 的 `content_scripts.css` 注入;插件没有 manifest,改为构建时以字符串内联、运行时注入 `