@etsoo/reacteditor
Version:
EOEditor React Implementation
27 lines (26 loc) • 826 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { EOEditor } from "@etsoo/editor";
import React from "react";
// Make sure import the script
new EOEditor();
/**
* EOEditor React Component
*/
export const EOEditorEx = React.forwardRef((props, ref) => {
// Destruct
const { onBackup, cloneStyles = false, ...rest } = props;
return (_jsx("eo-editor", { cloneStyles: cloneStyles, ref: (r) => {
if (r == null)
return;
if (typeof ref === "function")
ref(r);
else if (ref)
ref.current = r;
if (onBackup) {
r.addEventListener("backup", (event) => {
const content = event.detail;
onBackup(content);
});
}
}, ...rest }));
});