mind-tree-editor
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -1,3 +0,3 @@ | ||
import React from 'react'; | ||
declare const EditorContext: React.Context<any>; | ||
/// <reference types="react" /> | ||
declare const EditorContext: import("react").Context<any>; | ||
export default EditorContext; |
@@ -5,3 +5,3 @@ import Menu from 'antd/es/menu'; | ||
import { __assign, __rest } from 'tslib'; | ||
import React, { useEffect, useRef, useState, useContext } from 'react'; | ||
import React, { createContext, useEffect, useRef, useState, useContext } from 'react'; | ||
import TextArea from 'antd/es/input/TextArea'; | ||
@@ -30,3 +30,3 @@ import 'antd/es/input/style/index.css'; | ||
var EditorContext = React.createContext({}); | ||
var EditorContext = createContext({}); | ||
@@ -626,3 +626,4 @@ function Overlay(_a, ref) { | ||
y: height / 2, | ||
r: cr | ||
r: cr, | ||
cursor: 'pointer' | ||
}, nodeStyle.default), | ||
@@ -635,3 +636,4 @@ className: 'collapse-icon' | ||
path: collapsed ? collapseIcon : expandIcon, | ||
stroke: nodeStyle.default.stroke | ||
stroke: nodeStyle.default.stroke, | ||
cursor: 'pointer' | ||
}, | ||
@@ -1133,6 +1135,9 @@ className: 'collapse-icon' | ||
var graph = this.graph; | ||
graph.emit('node-drag', evt); | ||
this._update(this.target, evt.x, evt.y); | ||
}, | ||
onDragEnd: function onDragEnd(e) { | ||
if (!this.shouldEnd.call(this, e)) { | ||
onDragEnd: function onDragEnd(evt) { | ||
if (!this.shouldEnd.call(this, evt)) { | ||
return; | ||
@@ -1172,2 +1177,3 @@ } | ||
graph.emit('node-dragend', evt); | ||
graph.changeData(); | ||
@@ -1356,2 +1362,21 @@ }, | ||
var edCursor = { | ||
getEvents: function getEvents() { | ||
return { | ||
'canvas:drag': 'onDrag', | ||
'canvas:dragend': 'onDragend', | ||
'node-drag': 'onDrag', | ||
'node-dragend': 'onDragend' | ||
}; | ||
}, | ||
onDrag: function onDrag() { | ||
var el = this.graph.get('canvas').get('el'); | ||
el.style.cursor = 'grabbing'; | ||
}, | ||
onDragend: function onDragend() { | ||
var el = this.graph.get('canvas').get('el'); | ||
el.style.cursor = 'default'; | ||
} | ||
}; | ||
function registerCustomBehavior(G6$$1) { | ||
@@ -1364,2 +1389,3 @@ G6$$1.registerBehavior('ed-contextmenu', edContextmenu); | ||
G6$$1.registerBehavior('ed-drag-node', edDragNode); | ||
G6$$1.registerBehavior('ed-cursor', edCursor); | ||
} | ||
@@ -1461,4 +1487,4 @@ | ||
}] | ||
}, 'ed-drag-node', 'ed-contextmenu', 'ed-edit', 'ed-result-edit', 'drag-canvas', 'zoom-canvas'], | ||
lock: [] | ||
}, 'ed-drag-node', 'ed-contextmenu', 'ed-edit', 'ed-result-edit', 'drag-canvas', 'zoom-canvas', 'ed-cursor'], | ||
lock: ['ed-cursor'] | ||
}, | ||
@@ -1465,0 +1491,0 @@ mode: 'default' |
@@ -37,3 +37,3 @@ 'use strict'; | ||
var EditorContext = React__default.createContext({}); | ||
var EditorContext = React.createContext({}); | ||
@@ -633,3 +633,4 @@ function Overlay(_a, ref) { | ||
y: height / 2, | ||
r: cr | ||
r: cr, | ||
cursor: 'pointer' | ||
}, nodeStyle.default), | ||
@@ -642,3 +643,4 @@ className: 'collapse-icon' | ||
path: collapsed ? collapseIcon : expandIcon, | ||
stroke: nodeStyle.default.stroke | ||
stroke: nodeStyle.default.stroke, | ||
cursor: 'pointer' | ||
}, | ||
@@ -1140,6 +1142,9 @@ className: 'collapse-icon' | ||
var graph = this.graph; | ||
graph.emit('node-drag', evt); | ||
this._update(this.target, evt.x, evt.y); | ||
}, | ||
onDragEnd: function onDragEnd(e) { | ||
if (!this.shouldEnd.call(this, e)) { | ||
onDragEnd: function onDragEnd(evt) { | ||
if (!this.shouldEnd.call(this, evt)) { | ||
return; | ||
@@ -1179,2 +1184,3 @@ } | ||
graph.emit('node-dragend', evt); | ||
graph.changeData(); | ||
@@ -1363,2 +1369,21 @@ }, | ||
var edCursor = { | ||
getEvents: function getEvents() { | ||
return { | ||
'canvas:drag': 'onDrag', | ||
'canvas:dragend': 'onDragend', | ||
'node-drag': 'onDrag', | ||
'node-dragend': 'onDragend' | ||
}; | ||
}, | ||
onDrag: function onDrag() { | ||
var el = this.graph.get('canvas').get('el'); | ||
el.style.cursor = 'grabbing'; | ||
}, | ||
onDragend: function onDragend() { | ||
var el = this.graph.get('canvas').get('el'); | ||
el.style.cursor = 'default'; | ||
} | ||
}; | ||
function registerCustomBehavior(G6$$1) { | ||
@@ -1371,2 +1396,3 @@ G6$$1.registerBehavior('ed-contextmenu', edContextmenu); | ||
G6$$1.registerBehavior('ed-drag-node', edDragNode); | ||
G6$$1.registerBehavior('ed-cursor', edCursor); | ||
} | ||
@@ -1468,4 +1494,4 @@ | ||
}] | ||
}, 'ed-drag-node', 'ed-contextmenu', 'ed-edit', 'ed-result-edit', 'drag-canvas', 'zoom-canvas'], | ||
lock: [] | ||
}, 'ed-drag-node', 'ed-contextmenu', 'ed-edit', 'ed-result-edit', 'drag-canvas', 'zoom-canvas', 'ed-cursor'], | ||
lock: ['ed-cursor'] | ||
}, | ||
@@ -1472,0 +1498,0 @@ mode: 'default' |
{ | ||
"name": "mind-tree-editor", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "mind editor", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -46,6 +46,8 @@ import { delegateStyle } from '../editor/style'; | ||
} | ||
const graph = this.graph; | ||
graph.emit('node-drag', evt); | ||
this._update(this.target, evt.x, evt.y); | ||
}, | ||
onDragEnd(e) { | ||
if (!this.shouldEnd.call(this, e)) { | ||
onDragEnd(evt) { | ||
if (!this.shouldEnd.call(this, evt)) { | ||
return; | ||
@@ -73,2 +75,3 @@ } | ||
} | ||
graph.emit('node-dragend', evt); | ||
graph.changeData(); | ||
@@ -75,0 +78,0 @@ }, |
@@ -7,2 +7,3 @@ import edContextmenu from './edContextmenu'; | ||
import edDragNode from './edDragNode'; | ||
import edCursor from './edCursor'; | ||
@@ -16,2 +17,3 @@ export function registerCustomBehavior(G6) { | ||
G6.registerBehavior('ed-drag-node', edDragNode); | ||
G6.registerBehavior('ed-cursor', edCursor); | ||
} |
@@ -87,5 +87,6 @@ /* eslint-disable class-methods-use-this */ | ||
'drag-canvas', | ||
'zoom-canvas' | ||
'zoom-canvas', | ||
'ed-cursor' | ||
], | ||
lock: [] | ||
lock: ['ed-cursor'] | ||
}, | ||
@@ -92,0 +93,0 @@ mode: 'default' |
@@ -1,5 +0,5 @@ | ||
import React from 'react'; | ||
import { createContext } from 'react'; | ||
const EditorContext = React.createContext<any>({} as any); | ||
const EditorContext = createContext<any>({} as any); | ||
export default EditorContext; |
@@ -64,2 +64,3 @@ import { | ||
r: cr, | ||
cursor: 'pointer', | ||
...nodeStyle.default | ||
@@ -73,3 +74,4 @@ }, | ||
path: collapsed ? collapseIcon : expandIcon, | ||
stroke: nodeStyle.default.stroke | ||
stroke: nodeStyle.default.stroke, | ||
cursor: 'pointer' | ||
}, | ||
@@ -76,0 +78,0 @@ className: 'collapse-icon' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
320142
46
4841