Formula-Editor icon indicating copy to clipboard operation
Formula-Editor copied to clipboard

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

Open loycoder opened this issue 5 years ago • 0 comments

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元素未插入。这样以来,组件只能做不销毁处理,能否优化呢

loycoder avatar Nov 29 '20 10:11 loycoder