zt-react-milkdown 0.1.19 → 0.1.20
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 +12 -0
- package/dist/index.cjs +35 -35
- package/dist/index.mjs +2956 -2952
- package/dist/src/plugins/custom/image/image-resizable-schema.d.ts +1 -1
- package/dist/src/plugins/custom/image/image-resizable-schema.d.ts.map +1 -1
- package/dist/src/types/editor.d.ts +2 -0
- package/dist/src/types/editor.d.ts.map +1 -1
- package/dist/src/utils/security.d.ts +6 -2
- package/dist/src/utils/security.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -140,8 +140,20 @@ export default function Demo() {
|
|
|
140
140
|
- `ImageUploadConfig`
|
|
141
141
|
- `upload?: (file: File) => string | Promise<string>`:自定义上传函数,返回最终图片 URL。
|
|
142
142
|
- `maxFileSize?: number`:允许上传的最大文件体积(字节)。
|
|
143
|
+
- `allowedProtocols?: string[]`:图片解析与序列化额外允许的 URL 协议,协议名需包含末尾冒号,例如 `inkdown-file:`。仅配置受信任且由宿主应用安全处理的协议。
|
|
143
144
|
- 未提供 `upload` 时,默认走内置本地读取流程(返回 data URL)。
|
|
144
145
|
|
|
146
|
+
Electron 应用可为受主进程权限校验保护的本地图片协议显式放行:
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
<MilkdownEditor
|
|
150
|
+
imageUpload={{
|
|
151
|
+
upload: importImage,
|
|
152
|
+
allowedProtocols: ['inkdown-file:']
|
|
153
|
+
}}
|
|
154
|
+
/>
|
|
155
|
+
```
|
|
156
|
+
|
|
145
157
|
## 本地开发
|
|
146
158
|
|
|
147
159
|
```bash
|