Skip to content

Commit

Permalink
sdk支持
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsee committed Apr 18, 2024
1 parent d9637d1 commit d5ce053
Show file tree
Hide file tree
Showing 16 changed files with 768 additions and 41 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.0.2(2024-04-18)

- 新增颜色吸管
- 新增 SDK 包,支持 vue 引入

## 1.0.1(2024-04-15)

- 新增插件扩展功能
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

- 技术文档:<a href="./doc/技术文档.md" target="_blank">技术文档</a>
- 插件开发文档:<a href="./doc/插件开发文档.md" target="_blank">插件开发文档</a>
- 插件开发文档:<a href="./doc/SDK使用文档.md" target="_blank">SDK 使用文档</a>
- Leaferjs: <a href="https://www.leaferjs.com" target="_blank">Leaferjs</a>
- TypeScript: <a href="https://devblogs.microsoft.com/typescript/" target="_blank">TypeScript</a>
- React: <a href="https://react.dev/" target="_blank">React</a>
Expand Down
52 changes: 52 additions & 0 deletions doc/SDK使用文档.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# SDK 框架中的使用

为了方便大家在 vue 项目中快速使用渲染内核做二次开发,我们提供了一个 JS 的 SDK,下面是 vue 中使用渲染内核的案例:

具体完整代码请参考`sdk-test/vue.html`文件:

官网:[image.h5ds.com](https://image.h5ds.com)

### VUE

```javascript
import { ref } from 'vue';
import ImageEditorCore from 'image-editor-core';

export default {
async mounted() {
const core = new ImageEditorCore({
data: pageData,
target: document.getElementById('view'),
env: 'editor',
resourceHost: 'https://cdn.h5ds.com',
});
const store = await core.init();
console.log(store);
},
template: `<div id="view">loading...</div>`,
};
```

### React

```javascript
import React, { useRef } from 'react';
import ImageEditorCore from 'image-editor-core/coresdk.react.es';

export default function App() {
const ref = useRef();
useEffect(() => {
const core = new ImageEditorCore({
data: pageData,
target: ref.current,
env: 'editor',
resourceHost: 'https://cdn.h5ds.com',
});
core.init().then(store => {
console.log(store);
});
}, []);

return <div ref={ref}>loading...</div>;
}
```
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "image-editor",
"version": "1.0.1",
"version": "1.0.2",
"author": "mantou <[email protected]>",
"license": "MIT",
"scripts": {
"dev": "vite",
"build": "vite build",
"build": "vite build && yarn build:sdk",
"server": "node ./server/index.js",
"preview": "vite preview --port 8080",
"lint": "eslint src --fix",
Expand Down
Binary file removed public/assets/ai/matting/magic_touch.tflite
Binary file not shown.
20 changes: 0 additions & 20 deletions public/assets/ai/matting/vision_wasm_internal.js

This file was deleted.

Binary file removed public/assets/ai/matting/vision_wasm_internal.wasm
Binary file not shown.
Loading

0 comments on commit d5ce053

Please sign in to comment.