GG-Editor flow 的节点 "删除"接口, 如何调用 ?

GG-Editor flow 如下图,工具栏的删除,或是右键菜单的删除,如何调用 ?

Screenshot from 2020-03-03 19-47-25.png

查看部分源码,"删除"用法与"保存"类同".于是将其写在一个组件里,可以调用,如下. 但如何与操作面板上的删除关联起来?

import React from "react";
import { Button } from "antd";
import { withPropsAPI } from "gg-editor";

class Remove extends React.Component {
  handleClick = () => {
    const { propsAPI } = this.props;
    const GgeditorRemove = propsAPI.remove()
    console.log(propsAPI.remove());
    return GgeditorRemove;
  };

  render() {
    return (
      <div style={{ padding: 8 }}>
        <Button onClick={this.handleClick}>删除</Button>
      </div>
    );
  }
}

export default withPropsAPI(Remove);

在父组件中调用,能打印相关信息:

//在父组件方法中调用
  handleSubmit = e => {
    e.preventDefault();
    const GgeditorRemove = this.refs.GgeditorRemove.handleClick()
    console.log(GgeditorRemove);
    ... ... 
    }
    
//在父组件中引用子组件
<Remove 
 ref="GgeditorRemove"
/>
阅读 2.4k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题