Mind elixir is a free open source mind map core.

Overview

mindelixir logo

version license code quality dependency-count dependency-count

Mind elixir is a free open source mind map core.

中文

Use now

mindelixir

https://mindelixir.ink/#/

Playground

https://codepen.io/ssshooter/pen/GVQRYK

with React https://codesandbox.io/s/mind-elixir-react-9sisb

with Vue https://codesandbox.io/s/mind-elixir-vue-nqjjl

Use in your project

Install

NPM

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

Script tag

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

HTML structure

">
<div id="map">div>
<style>
  #map {
    height: 500px;
    width: 100%;
  }
style>

Init

let options = {
  el: '#map',
  direction: MindElixir.LEFT,
  // create new map data
  data: MindElixir.new('new topic'),
  // the data return from `.getAllData()`
  data: {...},
  draggable: true, // default true
  contextMenu: true, // default true
  toolBar: true, // default true
  nodeMenu: true, // default true
  keypress: true, // default true
  locale: 'en', // [zh_CN,zh_TW,en,ja,pt] waiting for PRs
  overflowHidden: false, // default false
  primaryLinkStyle: 2, // [1,2] default 1
  primaryNodeVerticalGap: 15, // default 25
  primaryNodeHorizontalGap: 15, // default 65
  contextMenuOption: {
    focus: true,
    link: true,
    extend: [
      {
        name: 'Node edit',
        onclick: () => {
          alert('extend menu')
        },
      },
    ],
  },
  allowUndo: false,
  before: {
    insertSibling(el, obj) {
      return true
    },
    async addChild(el, obj) {
      await sleep()
      return true
    },
  },
}

let mind = new MindElixir(options)
mind.init()

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

Data Structure

// whole node data structure up to now
{
  topic: 'node topic',
  id: 'bd1c24420cd2c2f5',
  style: { fontSize: '32', color: '#3298db', background: '#ecf0f1' },
  parent: null,
  tags: ['Tag'],
  icons: ['😀'],
  hyperLink: 'https://github.com/ssshooter/mind-elixir-core',
}

Event Handling

mind.bus.addListener('operation', operation => {
  console.log(operation)
  // return {
  //   name: action name,
  //   obj: target object
  // }

  // name: [insertSibling|addChild|removeNode|beginEdit|finishEdit]
  // obj: target

  // name: moveNode
  // obj: {from:target1,to:target2}
})
mind.bus.addListener('selectNode', node => {
  console.log(node)
})

Data Export

mind.getAllData() // javascript object, see src/example.js
mind.getAllDataString() // stringify object
mind.getAllDataMd() // markdown

Export as image

import painter from 'mind-elixir/dist/painter'
painter.exportSvg()
painter.exportPng()

Operation Guards

let mind = new MindElixir({
  ...
  before: {
    insertSibling(el, obj) {
      console.log(el, obj)
      if (this.currentNode.nodeObj.parent.root) {
        return false
      }
      return true
    },
    async addChild(el, obj) {
      await sleep()
      if (this.currentNode.nodeObj.parent.root) {
        return false
      }
      return true
    },
  },
})

Doc

https://doc.mindelixir.ink/

Comments
  • How to init new mind map along with previous?

    How to init new mind map along with previous?

    I have initialized one mind map by following the code of the repo, now I want to initialize another mind map bu it throws the error- "Cannot read property 'className' of null at me.init".

    My source code is-

    // vue file

    <v-btn color="primary" @click="initializeSecond()">Add one more mind map</v-btn>
    <v-row no-gutters>
           <v-col sm="6">
             <div id="map-1" style="width: 100%; height: 500px"></div>
           </v-col>
           <v-col sm="6">
             <div id="map-2" style="width: 100%; height: 500px"></div>
           </v-col>
    </v-row>
    

    // Js code

    import MindElixir, { E } from "mind-elixir";
    
    data() {
        return {
        ME: null,
        ME_1: null   
     }
    },
    
    mounted() {
      let options = {
        el: '#map-1',
        direction: MindElixir.LEFT,
        // the data return from `.getAllData()`
        data: dummyData,
        draggable: true, // default true
        contextMenu: true, // default true
        toolBar: true, // default true
        nodeMenu: true, // default true
        keypress: true, // default true
        locale: 'en', // [zh_CN,zh_TW,en,ja] waiting for PRs
        overflowHidden: false, // default false
        primaryLinkStyle: 2, // [1,2] default 1
        primaryNodeVerticalGap: 15, // default 25
        primaryNodeHorizontalGap: 15, // default 65
        contextMenuOption: {
          focus: true,
          link: true,
          extend: [
            {
              name: 'Node edit',
              onclick: () => {
                alert('extend menu')
              },
            },
          ],
        },
        allowUndo: false
      }
    
      this.ME = new MindElixir(options);
      this.ME.init();
    },
    
    methods: {
        async initializeSecond() {
          try {
          let option = {
            el: '#map-2',
            direction: MindElixir.LEFT,
            // the data return from `.getAllData()`
            data: dummyData,
            draggable: true, // default true
            contextMenu: true, // default true
            toolBar: true, // default true
            nodeMenu: true, // default true
            keypress: true, // default true
            locale: 'en', // [zh_CN,zh_TW,en,ja] waiting for PRs
            overflowHidden: false, // default false
            primaryLinkStyle: 2, // [1,2] default 1
            primaryNodeVerticalGap: 15, // default 25
            primaryNodeHorizontalGap: 15, // default 65
            contextMenuOption: {
              focus: true,
              link: true,
              extend: [
                {
                  name: 'Node edit',
                  onclick: () => {
                    alert('extend menu')
                  },
                },
              ],
            },
            allowUndo: false
          }
          this.ME_1 = await new MindElixir(option);
          this.ME_1.init();
          } catch (error) {
            console.error('______', error)
          }
        }
    }
    

    // Error

    Screenshot from 2021-01-18 12-00-32

    Could you please help? @ssshooter

    opened by Nehasoni988 65
  • Try to disable or block the editing anymore

    Try to disable or block the editing anymore

    Hi, I have one more question while testing. I want to disable editing and wanna see current work as final, so tried to block it with disableEdit() like :

            mind.toCenter();
            mind.disableEdit();
    

    But I still can add new child and set new color for my nodes. Is there anyway to block to edit anymore ?

    opened by vkcorp 8
  • refresh is required after removing child (in context menu)

    refresh is required after removing child (in context menu)

    After removing a child there was no update in my screen, I guess I have to add refresh() at below code :

    remove_child.onclick = e => { if (isRoot) return mind.removeNode() mind.refresh(); menuContainer.hidden = true }

    opened by vkcorp 5
  • a line of each last node is pale or hidden

    a line of each last node is pale or hidden

    Hi, I found one more important issue while testing.

    image

    Each last line of nodes was pale or hidden, so I couldn't see it clearly. I guess there is a line but overwrited by node object's outline. Maybe we should increase the height of each node will solve it.

    opened by vkcorp 5
  • vue3 setup语法使用时提示init is not a function

    vue3 setup语法使用时提示init is not a function

    <template>
      <div id="map" class="map"></div>
    </template>
    <script lang="ts" setup>
      import MindElixir from 'mind-elixir';
      import { onMounted, ref } from 'vue';
    
      const me = ref<MindElixir>();
      onMounted(() => {
        me.value = new MindElixir({
          el: '#map',
          direction: MindElixir.LEFT,
        });
        me.value.init(MindElixir.new('demo'));
      });
    </script>
    <style lang="less" scoped>
      .map {
        width: 100%;
        height: 500px;
      }
    </style>
    

    在我尝试使用vue3.2中setup语法使用mind-elixir时,一直提示init is not a function image

    opened by tqq1994516 4
  • Some Lines are not displayed

    Some Lines are not displayed

    Screenshot_20220220-131726_Chrome

    Sometimes lines which connect nodes are not displayed. This often happens on nodes at the bottom. I think it is a bug. I will be glad if you have time to modify.

    opened by g150446 4
  • How to expand/collapse nodes in UI?

    How to expand/collapse nodes in UI?

    This is a fantastic library, one of the best I've seen for mind mapping. Excellent work. This might seem like a silly question but I could not see in demo how to collapse/expand nodes. Is that done by keystroke combination, mouse, or some or other configuration? :-)

    opened by shah 4
  • Possible to add arrow at line's start or end point ?

    Possible to add arrow at line's start or end point ?

    I'm trying to add arrow with lines but it's not easy to handle with svg. Do you have any idea to add it ? When I added the arrow it's hidden by node objects. Covered. Arrows are under that... Maybe need to make line short a few pixel to draw arrow..

    opened by vkcorp 4
  • How to import markdown ?

    How to import markdown ?

    Hello I'm looking for create a mind map from a markdown file which was import. And I am searching How to support markdown with title and bullet and export markdown with title and bullet from the mind map? @ssshooter

    opened by Bapt5 4
  • Data import Gives [object object]

    Data import Gives [object object]

          console.log('d', d)
          let mind = new MindElixir({
            el: '#map',
            direction: MindElixir.LEFT,
            data: MindElixir.new(d), // can also set data return from .getAllData()
            draggable: true, // default true
            contextMenu: true, // default true
            toolBar: true, // default true
            nodeMenu: true, // default true
            keypress: true, // default true
          })
          mind.init()
    

    Where d in console

    linkData: Object {  }
    nodeData: Object { id: "root", topic: "Solid Map", root: true, … }
    

    image

    Any ideas?

    opened by melvincarvalho 4
  • Unclear data structure and how to export and import the data

    Unclear data structure and how to export and import the data

    Do you have a complete JSON structure of the data? In the example I don't see 'children' for example, while I do see it in the examples.

    If I want to pass 'data' to the init function, what format does it need to be? That is very unclear to me.

    opened by bigwouter 3
  • build(deps): bump loader-utils from 2.0.2 to 2.0.4

    build(deps): bump loader-utils from 2.0.2 to 2.0.4

    Bumps loader-utils from 2.0.2 to 2.0.4.

    Release notes

    Sourced from loader-utils's releases.

    v2.0.4

    2.0.4 (2022-11-11)

    Bug Fixes

    v2.0.3

    2.0.3 (2022-10-20)

    Bug Fixes

    • security: prototype pollution exploit (#217) (a93cf6f)
    Changelog

    Sourced from loader-utils's changelog.

    2.0.4 (2022-11-11)

    Bug Fixes

    2.0.3 (2022-10-20)

    Bug Fixes

    • security: prototype pollution exploit (#217) (a93cf6f)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Releases(v1.1.3)
  • v1.1.3(Nov 22, 2022)

    What's Changed

    • added Russian translation by @Yurgeman in https://github.com/ssshooter/mind-elixir-core/pull/136
    • V1.1.3 by @ssshooter in https://github.com/ssshooter/mind-elixir-core/pull/143

    New Contributors

    • @Yurgeman made their first contribution in https://github.com/ssshooter/mind-elixir-core/pull/136

    Full Changelog: https://github.com/ssshooter/mind-elixir-core/compare/v1.1.2...v1.1.3

    Source code(tar.gz)
    Source code(zip)
  • v1.1.2(Nov 5, 2022)

  • v1.1.1(Oct 1, 2022)

    What's Changed

    • build(deps): bump terser from 5.12.1 to 5.14.2 by @dependabot in https://github.com/ssshooter/mind-elixir-core/pull/112
    • V1.1.1 by @ssshooter in https://github.com/ssshooter/mind-elixir-core/pull/130

    Full Changelog: https://github.com/ssshooter/mind-elixir-core/compare/v1.1.0...v1.1.1

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Jul 16, 2022)

    What's Changed

    • V1.1.0 by @ssshooter in https://github.com/ssshooter/mind-elixir-core/pull/111

    Full Changelog: https://github.com/ssshooter/mind-elixir-core/compare/v1.0.1...v1.1.0

    Source code(tar.gz)
    Source code(zip)
  • v1.0.1(Jul 7, 2022)

    What's Changed

    • V1.0.1 by @ssshooter in https://github.com/ssshooter/mind-elixir-core/pull/107

    Full Changelog: https://github.com/ssshooter/mind-elixir-core/compare/v1.0.0...v1.0.1

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Jul 6, 2022)

  • v0.19.8(Jul 6, 2022)

  • v0.19.6(Jun 10, 2022)

    What's Changed

    • build(deps): bump async from 2.6.3 to 2.6.4 by @dependabot in https://github.com/ssshooter/mind-elixir-core/pull/91

    Full Changelog: https://github.com/ssshooter/mind-elixir-core/compare/v0.19.5...v0.19.6

    Source code(tar.gz)
    Source code(zip)
  • v0.19.5(May 9, 2022)

  • v0.19.4(Apr 16, 2022)

  • v0.19.3(Mar 30, 2022)

Owner
DJJo
JavaScript, the BEST game
DJJo
jQuery Vector Map Library

This project is a heavily modified version of jVectorMap as it was in April of 2012. I chose to start fresh rather than fork their project as my inten

10 Best Design 1.8k Dec 28, 2022
jQuery Vector Map Library

This project is a heavily modified version of jVectorMap as it was in April of 2012. I chose to start fresh rather than fork their project as my inten

10 Best Design 1.8k Dec 28, 2022
JavaScript WebGL 3D map rendering engine

VTS Browser JS is a powerful JavaScript 3D map rendering engine with a very small footprint (about 163 kB of gziped JS code). It provides almost all f

Melown Technologies, SE 203 Dec 7, 2022
Mapbox Visual for Power BI - High performance, custom map visuals for Power BI dashboards

Mapbox Visual for Microsoft Power BI Make sense of your big & dynamic location data with the Mapbox Visual for Power BI. Quickly design high-performan

Mapbox 121 Nov 22, 2022
A Node.js map tile library for PostGIS and torque.js, with CartoCSS styling

Windshaft A Node.js map tile library for PostGIS and torque.js, with CartoCSS styling. Can render arbitrary SQL queries Generates image and UTFGrid in

CARTO 306 Dec 22, 2022
Add time dimension capabilities on a Leaflet map.

Leaflet TimeDimension Add time dimension capabilities on a Leaflet map. Examples and basic usage API L.Map L.TimeDimension L.TimeDimension.Layer L.Tim

SOCIB public code 379 Dec 23, 2022
Serverless raster and vector map tile generation using Mapnik and AWS Lambda

tilegarden ??️ ?? Contents About Usage Deployment to AWS Additional Configuration Options Required AWS Permissions Features Configuration Selection an

Azavea 89 Dec 22, 2022
Lightweight Node.js isochrone map server

Galton Lightweight Node.js isochrone server. Build isochrones using OSRM, Turf and concaveman. Francis Galton is the author of the first known isochro

Urbica 266 Dec 17, 2022
A pluggable Node.js map tile server.

TileStrata TileStrata is a pluggable "slippy map" tile server that emphasizes code-as-configuration. The primary goal is painless extendability. It's

Natural Atlas 409 Dec 30, 2022
A map tool with real-time collaboration 🗺️

Mapus Maps with real-time collaboration ??️ Mapus is a tool to explore and annotate collaboratively on a map. You can draw, add markers, lines, areas,

Alyssa X 3k Jan 4, 2023
3D web map rendering engine written in TypeScript using three.js

3D web map rendering engine written in TypeScript using three.js

HERE Technologies 1.2k Dec 30, 2022
Fast Map built for keys that are always fixed size uniformly distributed buffers.

turbo-hash-map Fast Map built for keys that are always fixed size uniformly distributed buffers. npm install turbo-hash-map Uses a prefix trie to map

Mathias Buus 39 Jun 20, 2022
A library that makes Image Map Area responsive

A library that makes Image Map Area responsive

elenh 1 Jan 21, 2022
Greasemonkey script to allow marking items on the interactive map of Elden Ring as completed.

Greasemonkey script (or Tampermonkey) to allow marking items on the interactive map of Elden Ring as completed. The interactive map is a Fextralife-project, all credits for the map go to them.

Daniel Tischner 6 Jun 19, 2022
Interactive map overlay for finding secrets hidden around the world of Lost Ark.

Lostark Map Overlay This is an interactive map overlay which is resizable, movable and can be kept up during gameplay for finding secrets hidden aroun

Omar Minaya 6 Dec 29, 2022
:ukraine: A self-hosted app for keeping track of employee wellbeing and dislocation during the Russo-Ukrainian war, with an interactive map.

Helping organizations stay together and help their members in times of disaster On February 24th, 2022, the lives of the entire Ukrainian nation were

MacPaw Inc. 111 Dec 15, 2022
Generates an embeddable map that displays business info from an OSM object id.

# OSM Business Card Generates an embeddable map that displays business info from an OSM object id. Loads object type (n/w/r) and id from url parameter

Will Bennett 6 May 26, 2022
Simple location picker on Leaflet map

Leaflet Location Picker Simple location picker with Leaflet map Usage: <label>Insert a Geo Location <input id="geoloc" type="text" value="" /> </lab

Stefano Cudini 37 Nov 17, 2022
An open-source JavaScript library for world-class 3D globes and maps :earth_americas:

CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin. It uses WebGL for hardware-accelerated graphics

Cesium 9.7k Dec 26, 2022