无框架依赖的思维导图内核 Mind Elixir 开源啦

2019-08-01 09:27:01 +08:00
 ssshooter

Github 地址: https://github.com/ssshooter/mind-elixir-core

试用地址: https://mindelixir.ink/

Mind elixir 是一个免费开源的思维导图内核

立即试用

https://mindelixir.ink/#/

在项目中使用

安装

NPM

npm i mind-elixir -S
import MindElixir, { E } from 'mind-elixir'

script 标签引入

<script src="https://cdn.jsdelivr.net/npm/mind-elixir@0.6.1/dist/mind-elixir.js"></script>

HTML 结构

<div class="outer">
  <div id="map"></div>
</div>
<style>
  .outer {
    position: relative;
    margin: 50px;
  }
  #map {
    height: 500px;
    width: 100%;
    overflow: auto;
  }
</style>

初始化

let mind = new MindElixir({
  el: '#map',
  direction: MindElixir.LEFT,
  data: MindElixir.new('new topic'), // 也可以把 getDataAll 得到的数据初始化
  draggable: true, // 启用拖动 default true
  contextMenu: true, // 启用右键菜单 default true
  toolBar: true, // 启用工具栏 default true
  nodeMenu: true, // 启用节点菜单 default true
  keypress: true, // 启用快捷键 default true
})
mind.init()

// get a node
E('node-id')

Data Export

mind.getAllData()
// see src/example.js

使用提示

direction 选项

direction 选项可选 MindElixir.LEFTMindElixir.RIGHTMindElixir.SIDE

HTML 结构

挂载的目标需要定宽高,可以是百分百;外层元素建议设置 position: relative;,否则菜单位置以视窗为标准分布。

E 函数

在使用节点操作方法时需要传入的参数可以借助 E 函数获得。

mind.insertSibling(E('bd4313fbac40284b'))

文档

https://inspiring-golick-3c01b9.netlify.com/

依赖

hotkeys-js

5528 次点击
所在节点    分享创造
26 条回复
ssshooter
2019-08-02 12:41:19 +08:00
@haozes emmm 其实也不是主推在线思维导图服务,而是希望这个项目能让前端开发者方便地在自己的项目使用思维导图
netnr
2019-08-02 14:17:23 +08:00
支持,顶顶顶

前面接触了 mxgraph 和百度脑图,集成的效果
//www.netnr.com/draw/discover
ssshooter
2019-08-02 15:10:52 +08:00
@netnr 哇这个功能真的丰富😂
netnr
2019-08-02 15:57:00 +08:00
但你造轮子,赞
ssshooter
2019-08-02 21:41:34 +08:00
@netnr 👌谢谢
Jex
2019-08-03 14:35:19 +08:00
我也以为是 Elixir 写的。。。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/588055

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX