drawui-react 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +1 -1
- package/dist/styles.css +91 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
**简体中文** | [繁體中文](#繁體中文) | [English](#english) | [日本語](#日本語) | [한국어](#한국어) | [Deutsch](#deutsch) | [Français](#français)
|
|
4
4
|
|
|
5
|
-
基于 [drawui-core](https://www.npmjs.com/package/drawui-core) 的 React 封装,提供开箱即用的画布组件。
|
|
5
|
+
基于 [drawui-core](https://www.npmjs.com/package/drawui-core) 的 React 封装,提供开箱即用的画布组件。
|
|
6
|
+
|
|
7
|
+
> 🛠 **图片上传对接**(接 OSS / 自建后端)请看 [`../core/IMAGE_UPLOAD.md`](../core/IMAGE_UPLOAD.md):含 `imageUpload` prop 的两种通道(`ImageUploadConfig` 与 `ImageUploader` 函数)、30 MB 体积上限、60 s 超时、OSS CORS 与 STS 直传示例。
|
|
6
8
|
|
|
7
9
|
## 安装
|
|
8
10
|
|
|
@@ -59,6 +61,26 @@ export function App() {
|
|
|
59
61
|
|
|
60
62
|
## 更新日志
|
|
61
63
|
|
|
64
|
+
### v0.5.0
|
|
65
|
+
|
|
66
|
+
> 主题:**图片上传通道**(OSS / 自建后端友好)
|
|
67
|
+
|
|
68
|
+
- 🛡️ **单张图片体积上限 30 MB**:超过上限直接拒绝(抛 `image.tooLarge`),不会真的发请求;接入方可按需通过 `imageUpload.maxSizeBytes` 自定义。
|
|
69
|
+
- ⏱ **上传超时 30 s → 60 s**:默认 `timeoutMs` 从 30000 调整为 60000。
|
|
70
|
+
- 🧰 **`imageUpload` 现在支持两种通道**:`ImageUploadConfig`(配 `{ url, method, headers, responseUrlPath, timeoutMs, maxSizeBytes }`)或 `ImageUploader` 函数(`(file: File) => Promise<string>`),函数优先级高于配置。
|
|
71
|
+
- 🌐 **多语言新增 `image.tooLarge` 文案**:7 种语言全部同步,体积超限时 toast 用对应语言提示用户。
|
|
72
|
+
- 📄 **图片上传对接指南**:[`../core/IMAGE_UPLOAD.md`](../core/IMAGE_UPLOAD.md)。
|
|
73
|
+
|
|
74
|
+
### v0.4.2
|
|
75
|
+
|
|
76
|
+
- 🖱️ **画布右键菜单(新增 `ContextMenu` 组件)**:选中图形右键弹出飞书式菜单 —— 复制 / 复制为图片 / 粘贴 / 创建副本 / **层级**(置于顶层 / 上移一层 / 下移一层 / 置于底层,悬停展开子菜单)/ 复制样式 / 粘贴样式 / 水平翻转 / 垂直翻转 / 旋转 / **成组 · 解组** / 锁定 / 删除,每项带快捷键标注,无操作能力的项自动置灰;空白处右键只显示「粘贴」,右键锁定的图形只显示「解锁 / 解组」。菜单自动贴边避让视口,点击外部或 `Esc` 关闭,文案随语言切换(7 种语言已补齐)。
|
|
77
|
+
- 🚫 **接管全部右键**:画板容器与 canvas 两层拦截 `contextmenu`,工具栏、样式面板、小地图上右键都不再弹出浏览器原生菜单(不会再出现「图片另存为」)。
|
|
78
|
+
- 🔒 **锁定**:锁定的图形由 core 在包围盒右上角画出**挂锁标记**(20×20 屏幕像素,随缩放不变),一眼可知「为什么点不动」。
|
|
79
|
+
- 👥 **分组 = 给多个图形绑一把锁**:选中多个图形右键「**成组**」`Ctrl+G` 后整组锁定,点不中拖不动;右键组内成员 → 「解锁本组 / 解组」解锁;解锁后点任一成员即选中整组,画布上有**虚线组框**。`Ctrl+Shift+G` 解组。
|
|
80
|
+
- ↔️ **水平 / 垂直翻转** `Shift+H` / `Shift+V`(菜单里也有入口),画布与导出同源呈现。
|
|
81
|
+
- 🖐️ **按住拖拽生成图形**:绘制工具按下后拖过 5px 即随手势放大缩小,圆形取拖拽长边做直径,矩形 / 圆角矩形等支持 `Shift` 锁定默认宽高比。
|
|
82
|
+
- 📦 依赖的 `drawui-core` 同步升级到 `0.4.2`。
|
|
83
|
+
|
|
62
84
|
### v0.4.1
|
|
63
85
|
|
|
64
86
|
- 📊 **新增「表格」图形与完整编辑体验**:工具栏独立「表格」按钮 + 8×6 选择器插入;选中后浮出**表格悬浮工具条**(插入 / 删除行列、合并 / 拆分单元格),双击单元格进入就地编辑。
|
|
@@ -215,6 +237,26 @@ export function App() {
|
|
|
215
237
|
|
|
216
238
|
## Changelog
|
|
217
239
|
|
|
240
|
+
### v0.5.0
|
|
241
|
+
|
|
242
|
+
> Theme: **Image upload channel** (OSS / custom backend friendly)
|
|
243
|
+
|
|
244
|
+
- 🛡️ **30 MB per-image size cap**: oversized images are rejected before any request is sent (throws `image.tooLarge`); overridable via `imageUpload.maxSizeBytes`.
|
|
245
|
+
- ⏱ **Upload timeout 30 s → 60 s**: default `timeoutMs` bumped from 30000 to 60000.
|
|
246
|
+
- 🧰 **`imageUpload` now accepts two channels**: `ImageUploadConfig` (with `{ url, method, headers, responseUrlPath, timeoutMs, maxSizeBytes }`) **or** an `ImageUploader` function (`(file: File) => Promise<string>`); the function takes priority over the config.
|
|
247
|
+
- 🌐 **`image.tooLarge` localized**: added in all 7 supported languages so the size-cap toast always uses the user's language.
|
|
248
|
+
- 📄 **Image upload integration guide**: see [`../core/IMAGE_UPLOAD.md`](../core/IMAGE_UPLOAD.md).
|
|
249
|
+
|
|
250
|
+
### v0.4.2
|
|
251
|
+
|
|
252
|
+
- 🖱️ **Canvas context menu (new `ContextMenu` component)**: right-clicking a selected shape opens a Feishu-style menu — copy / copy as image / paste / duplicate / **layer** (hover to expand: bring to front / forward / backward / send to back) / copy style / paste style / flip horizontal / flip vertical / rotate / **group · ungroup** / lock / delete, each with its shortcut, unavailable entries greyed out. Right-clicking empty space shows only "Paste"; right-clicking a locked shape shows only "Unlock / Ungroup". The menu clamps itself into the viewport and closes on outside click or `Esc`; all copy is translated into 7 languages.
|
|
253
|
+
- 🚫 **Right-click fully taken over**: the board container and the canvas both intercept `contextmenu`, so right-clicking the toolbar, style panel or minimap no longer opens the browser's native menu (no more "Save image as").
|
|
254
|
+
- 🔒 **Locking**: locked shapes get a **padlock badge** drawn by core at the top-right of their bounds (20×20 screen pixels, zoom-independent) — you can see at a glance why a shape won't respond.
|
|
255
|
+
- 👥 **Groups = one lock shared by several shapes**: select several shapes and pick "**Group**" (`Ctrl+G`) to lock the whole group at once — it can't be picked, dragged or deleted. Right-click any member → "Unlock group / Ungroup" to release it. Once unlocked, clicking any member selects the entire group, and the canvas draws a **dashed frame** around it. `Ctrl+Shift+G` ungroups.
|
|
256
|
+
- ↔️ **Flip horizontal / vertical** with `Shift+H` / `Shift+V` (also available in the menu), rendered identically on canvas and in exports.
|
|
257
|
+
- 🖐️ **Drag to size while drawing**: press and drag past 5px on any shape tool to grow the shape live; circles take the longer drag edge as their diameter, and `Shift` locks each shape's default aspect ratio.
|
|
258
|
+
- 📦 Bundled `drawui-core` is bumped to `0.4.2`.
|
|
259
|
+
|
|
218
260
|
### v0.4.1
|
|
219
261
|
|
|
220
262
|
- 📊 **New `table` shape with a full editing experience**: a dedicated toolbar button with an 8×6 picker inserts a table; selecting it reveals a **floating table toolbar** (insert / delete rows & columns, merge / split cells), and double-clicking a cell opens the in-place editor.
|