Giter Site home page Giter Site logo

agangle / vue-minder-editor-plus Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fudax/vue-mindeditor

31.0 0.0 16.0 2.24 MB

基于fex-team/kityminder-core和Vue2封装的在线脑图编辑功能

License: BSD 3-Clause "New" or "Revised" License

JavaScript 59.77% HTML 0.13% Vue 31.87% SCSS 8.22%

vue-minder-editor-plus's Introduction

Vue-MindEditor based on fex-team/kityminder-core

该项目是参考 vue-mindeditor 以及 kityminder-editor 源码,基于 kityminder-core 实现

install

npm install vue-minder-editor-plus --save

Usage

import vueMinderEditor from 'vue-minder-editor-plus'
import Vue from 'vue'
Vue.use(vueMinderEditor)

component

<template>
  <div>
    <minder-editor :progress-enable="false" :import-json="importJson"/>
  </div>
</template>

<script>
import minderEditor from '../../dist/static/js/vueMinderEditor'
import vue from 'vue'
vue.use(minderEditor);
export default {
  name: "test-plugin",
  data() {
    return {
      importJson: {
          // 节点数据
          root: {
            data: {
              // 文本内容
              text: 'vue-minder-editor-plus',
              // 标签
              resource: ['模块1'],
              // 是否禁止修改
              disable: true,
              // 默认展开或折叠,默认是展开的,collapse 可设为折叠
              // expandState: 'collapse',
              // 在 disable 为 true 的情况下,允许添加标签
              tagEnable: true,
              // 在 disable 为 true 的情况下,允许删除节点
              allowDelete: true,
              // 在 disable 为 true 的情况下,允许添加标签,优先级比 tagEnable 高
              allowDisabledTag: true,
            },
            // 子节点
            children: [
              {
                data: {
                  text: 'child1',
                  disable: true,
                  expandState: 'collapse',
                  resource: ['模块2']
                },
                children: [
                  {
                    data: {
                      text: 'child11',
                      disable: true,
                      resource: ['模块2']
                    },
                  },
                  {
                    data: {
                      text: 'child12',
                    }
                  }
                ]
              },
              {
                data: {
                  text: 'child2',
                }
              }
            ]
          },
        },
        tags:  ['模块1','模块2']
      }
    }
  }
}
</script>

Build Setup

# install npm dependencies
    npm install

# serve with hot reload at localhost:8088
    npm run dev

# build for plugin with minification
    npm run build

# License
    BSD-3-Clause License

国际化

// 方式一
import locale from '/src/locale/lang/en-US'
Vue.use(vueMinderEditorPlus, {
  locale
});

// 方式二
import lang from '/src/locale/lang/en-US'
import locale from '/src/locale'
locale.use(lang)
Vue.use(vueMinderEditorPlus);

// 方式三
import Vue from 'vue';
import VueI18n from 'vue-i18n';
import enLocale from 'vue-minder-editor-plus/src/locale/lang/en-US';
import zhLocale from 'vue-minder-editor-plus/src/locale/lang/zh-CN';
import vueMinderEditor from 'vue-minder-editor-plus';

const messages = {
  en: {
    message: 'hello',
    ...enLocale
  },
  zh: {
    message: '你好',
    ...zhLocale
  }
}

Vue.use(VueI18n);

const i18n = new VueI18n({
  locale: 'en', // set locale
  messages, // set locale messages
})

Vue.use(vueMinderEditor, {
  i18n: (key, value) => i18n.t(key, value)
});

Props

以下配置部分为 kityminder-core 扩展的功能,kityminder-core 本身的 minder 对象提供了丰富的功能,使用该组件时可通过 window.minder 对象获取 minder 对象具体的使用方法,可以参考它的文档扩展 kityminder-core wiki

基础配置

importJson

type Object
Default: null

需要脑图解析的 js 对象,参数详情可参考上文 demo,或者调用 minder.exportJson() 查看具体参数

height

type: Number
default: 500

显示高度,默认 500px

disabled

type: Boolean
default: null

是否禁止编辑

defaultMold

type: Number
default: 3

外观设置中样式的默认值

启用配置

sequenceEnable

type: Boolean
default: true

是否启用优先级功能

tagEnable

type: Boolean
default: true

是否启用标签功能

progressEnable

type: Boolean
default: true

是否启用完成进度功能

moveEnable

type: Boolean
default: true

是否启用上移下移功能

viewMenuEnable

type: Boolean
default: true

是否启用外观样式

moldEnable

type: Boolean
default: true

是否启用展示模式

arrangeEnable

type: Boolean
default: true

是否启用整理布局

styleEnable

type: Boolean
default: true

是否启用样式编辑

fontEnable

type: Boolean
default: true

是否启用字体编辑

优先级配置

priorityCount

type Number
default: 4

优先级最大显示数量,最多支持显示 9 个级别

priorityStartWithZero

type: Boolean
default: true

优先级是否从 0 开始

priorityPrefix

type: String
default: 'P' 优先级显示的前缀

priorityDisableCheck

type: Function
default: null

优先级设置的回调函数,如果返回 false 则无法设置优先级

标签配置

tags

type: Array
default: []

标签选项

distinctTags

type: Array
default: []

定义排他标签,比如 ['tag1','tag2'] ,则 tag1 不能和 tag2 共存

tagDisableCheck

type: Function
default: null

菜单栏是否允许打标签的回调函数,返回 false 则不允许打标签

tagEditCheck

type: Function
default: null

打标签时的回调函数,返回 false 则打标签不成功

vue-minder-editor-plus's People

Contributors

agangle avatar fudax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-minder-editor-plus's Issues

撤回功能存在问题

version:1.1.3
场景:删除节点
kityminder.core.js?f21e:2413 Uncaught TypeError: Cannot read properties of undefined (reading 'parent')
at Minder.removeNode (kityminder.core.js?f21e:2413:1)
at applyPatch (kityminder.core.js?f21e:2617:1)
at Minder.applyPatches (kityminder.core.js?f21e:2653:1)
at Object.undo [as action] (history.js?1417:128:1)
at execute (hotbox.js?1895:608:1)
at eval (hotbox.js?1895:535:1)
at Array.forEach ()
at HotBoxState.handleKeyEvent (hotbox.js?1895:522:1)
at HotBox._dispatchKey (hotbox.js?1895:174:1)
at eval (hotbox.js?8316:29:1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.