Skip to content

如果作为组件使用的话,当二次编辑的时候,不会再次渲染 #8

@loycoder

Description

@loycoder
require('@sugarteam/formula-editor/dist/index.min.css');
require('@sugarteam/formula-editor/dist/npmBundle');
require('@sugarteam/formula-editor/dist/kitygraph.all.min');
require('@sugarteam/formula-editor/dist/kity-formula-render.all.min');
require('@sugarteam/formula-editor/dist/kity-formula-parser.all.min');
require('@sugarteam/formula-editor/dist/kityformula-editor.all.min');

componentDidMount() {
   
    document.addEventListener('documentMessage', this.listener); 
    const factory = window.kf.EditorFactory.create(this.editorRef.current, {
      render: {
        fontsize: 30,
      },
      ui: {
        device: 'pc',
        scale: 1,
        protocol: 'documentEvent',
      }
    });

    factory.ready(function() {
      this.execCommand('render', '\\placeholder');
      this.execCommand('focus');
    });
  }

``
当关闭时,再次打开,dom元素未插入。这样以来,组件只能做不销毁处理,能否优化呢

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions