feat: update new feature temp for panel

This commit is contained in:
2025-03-04 01:20:55 +08:00
parent 6e96247b50
commit fd3288cb5b
45 changed files with 2559 additions and 954 deletions

View File

@@ -0,0 +1,42 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
export class ReactRenderer {
component: any;
element: HTMLElement;
ref: React.RefObject<any>;
props: any;
editor: any;
root: any;
constructor(component: any, { props, editor }: any) {
this.component = component;
this.element = document.createElement('div');
this.ref = React.createRef();
this.props = {
...props,
ref: this.ref,
};
this.editor = editor;
this.root = createRoot(this.element);
this.render();
}
updateProps(props: any) {
this.props = {
...this.props,
...props,
};
this.render();
}
render() {
this.root.render(React.createElement(this.component, this.props));
}
destroy() {
this.root.unmount();
}
}
export default ReactRenderer;