coco-mxgraph-editor

基于 mxgraph,vue3,typescript 的 editor 组件
1,839 1
Install
npm install coco-mxgraph-editor
Latest Version:0.0.88
Vue:3
License:MIT
Last Updated:Jul 12, 2023
Links: GitHub  ·  npm
Maintainer: px_wlq

mxgraph editor

基于 mxgraph,vue3,typescript 的 editor 组件

<template>
  <MyDraw :nodes="[]" />
</template>
<script setup lang="ts">
  import { MyDraw } from "coco-mxgraph-editor"
  import "coco-mxgraph-editor/dist/style.css"
</script>

props

nodes

SidebarNode[] 出现在侧边栏的节点

interface SidebarNode {
  name: string
  nodes?: SidebarNodeConfig[]
  children?: SidebarNode[]
}


interface SidebarNodeConfig {
  name: string
  style: string
  type: ItemType
  width: number
  height: number
  value?: string
  info?: Record<string, any>
}

hideSidebar

隐藏侧边栏

boolean

toolbar

自定义 toolbar

string[]
//默认值
// ['undo', 'redo', 'zoomIn', 'zoomOut', 'delete']

handleAddVertex?

添加 vertex 节点触发

(
  cell: mxCell,
  x: number,
  y: number,
  target: mxCell
) => void

handleDeleteCell?

删除节点触发

(cell: mxCell) => void

handleAddEdge?

添加 edge 节点触发

(cell: mxCell) => void

handleMoveCell?

移动节点触发

(cell: mxCell) => void

cellRightClick?

自定义侧边栏

(cells: mxCell[], menu: mxPopupMenuHandler) => void

beforeDeleteCell?

删除节点前触发,返回false不会触发删除

(cell: mxCell) => boolean

beforeAddCell?

添加节点前触发,返回false不会添加节点

(cell: mxCell) => boolean

连接规则

mx.mxConnectionHandler.prototype.connect = function (
  source: mxCell,
  target: mxCell,
  evt: MouseEvent,
  dropTarget: mxCell
) {
  this.originConnect.apply(this, arguments as any)
}

outlineMap

鸟瞰图

boolean

Related Packages

@codemirror/lang-vue

Vue template support for the CodeMirror code editor

71,371,417 29
@gaoding/collage-editor

An editor to help user to create collage photos easily

4,989
@qht/editor

富文本编辑器

1,360

Version History

Version Released Vue License
0.0.88 ^3.2.41 MIT
0.0.87 ^3.2.41 MIT
0.0.86 ^3.2.41 MIT
0.0.84 ^3.2.41 MIT
0.0.83 ^3.2.41 MIT