0.1.5 • Published 9 months ago
embed-drawio v0.1.5
FlowChartEditor
流程图编辑器,支持独立的流程图编辑器包以及DrawIO
嵌入通信方案。
# Install
$ npm i embed-drawio
# Development
$ npm run build:dist
$ npm run dev
独立编辑器
支持独立的流程图编辑器编辑与渲染。
使用方法可参考example/index.tsx
,由于包体积原因,强烈建议以懒加载方式引入。
import type { DiagramEditor } from "embed-drawio/dist/es/core/editor";
import type { DiagramViewer } from "embed-drawio/dist/es/core/viewer";
let editor: typeof DiagramEditor | null = null;
export const loadEditor = async (): Promise<typeof DiagramEditor> => {
if (editor) return Promise.resolve(editor);
const res = await Promise.all([
import(/* webpackChunkName: "embed-drawio-editor" */ "embed-drawio/dist/es/core/editor"),
// @ts-expect-error css declaration
import(/* webpackChunkName: "embed-drawio-css" */ "embed-drawio/dist/es/index.css"),
]);
editor = res[0].DiagramEditor;
return editor;
};
let viewer: typeof DiagramViewer | null = null;
export const loadViewer = async (): Promise<typeof DiagramViewer> => {
if (viewer) return Promise.resolve(viewer);
const res = await Promise.all([
import(/* webpackChunkName: "embed-drawio-viewer" */ "embed-drawio/dist/es/core/viewer"),
]);
viewer = res[0].DiagramViewer;
return viewer;
};
嵌入DrawIO
支持DrawIO
的嵌入通信方案。
使用方法可参考example/index.tsx
,由于sideEffects
原因,强烈建议以路径方式引入。
import { EditorEvent } from "embed-drawio/dist/es/event/basic";
import { EditorBus } from "embed-drawio/dist/es/event/index";
// ...
0.1.0
9 months ago
0.1.2
9 months ago
0.1.1
9 months ago
0.1.4
9 months ago
0.1.3
9 months ago
0.1.5
9 months ago
0.0.17
1 year ago
0.0.18
1 year ago
0.0.16
1 year ago
0.0.15
2 years ago
0.0.14
2 years ago
0.0.13
3 years ago
0.0.12
3 years ago
0.0.11
3 years ago
0.0.10
3 years ago
0.0.9
3 years ago
0.0.8
3 years ago
0.0.7
3 years ago
0.0.6
3 years ago
0.0.5
3 years ago
0.0.4
3 years ago
0.0.3
3 years ago
0.0.2
3 years ago