GGEditor icon indicating copy to clipboard operation
GGEditor copied to clipboard

求问大牛,在新版本中withPropsAPI无法使用之后,如何save保存流程图数据data

Open xuan-max opened this issue 5 years ago • 9 comments

这个功能解决了什么问题

你所期望的 API 是怎样的

求助:期望能够通过如withPropsAPI一样可以保存数据的API

xuan-max avatar Feb 28 '20 13:02 xuan-max

新版本需要用withEditorContext,和withPropsAPI

licong1995 avatar Mar 03 '20 13:03 licong1995

新版本需要用withEditorContext,和withPropsAPI用法一样

licong1995 avatar Mar 03 '20 13:03 licong1995

我自定义的节点不能连线,鼠标移入节点不会显示锚点,你知道该怎么写吗

licong1995 avatar Mar 03 '20 13:03 licong1995

为什么我加上withEditorContext之后页面就空白了

mrrllbb avatar Mar 23 '20 08:03 mrrllbb

同样自定义节点没有锚点,文档也没有,官方demo也跑不起,demo代码拷贝下来,EditorItemPanel 也没有锚点。

eevin avatar Apr 22 '20 02:04 eevin

@licong1995 @mrrllbb @eevin

withEditorContext 的使用可以参照这个 Demo,获取 graph 对象之后,即可使用 save() 方法获取图数据,另外关于自定义锚点之前做过一次重构,可以参考这个 Demo 中的 customInternalNode :)

gaoli avatar Apr 23 '20 05:04 gaoli

为什么我加上withEditorContext之后页面就空白了

@mrrllbb 被包裹的组件需要放在 GGEditor 内部

zoeykk avatar Apr 27 '20 04:04 zoeykk

为什么我加上withEditorContext之后页面就空白了

@mrrllbb 被包裹的组件需要放在 GGEditor 内部

用ES6单独写一个子组件 import React from 'react'; import { withEditorContext } from 'gg-editor';

@withEditorContext class WrappedClassComponent extends React.Component { componentDidMount() { console.log('wrappedClassComponentProps:', this.props); }

handleClick = () => { const {onSave, graph} =this.props; console.log('save...api...',graph.save()); onSave && onSave(graph.save()); }; render() { console.log('this props save...',this.props) return <div ref={this.props.forwardRef} onClick={this.handleClick}>save...; } }

export default WrappedClassComponent; 然后父组件调用子组件 <Save onSave={this.handleSave} >

zhy1516 avatar May 12 '20 09:05 zhy1516

使用ggEditor只能编写class组件吗,看了withPropsAPI函数入参必须是类组件

web-zlinc avatar Apr 13 '21 10:04 web-zlinc