rich-text-editor
Version:
Rich text editor
21 lines (20 loc) • 1.25 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeRichText = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const client_1 = __importDefault(require("react-dom/client"));
const app_1 = __importDefault(require("./app"));
const react_1 = require("react");
const defaultProps = {
container: document.getElementById('rich-text-editor-root'),
};
const makeRichText = (props) => {
const ref = (0, react_1.createRef)();
const { container, initialValue, baseUrl, language, editorStyle, allowedFileTypes, textAreaProps, onValueChange, invalidImageSelector, onLatexUpdate, } = Object.assign(Object.assign({}, defaultProps), props);
client_1.default.createRoot(container).render((0, jsx_runtime_1.jsx)(app_1.default, { ref: ref, language: language, editorStyle: editorStyle, onValueChange: onValueChange, initialValue: initialValue, baseUrl: baseUrl, allowedFileTypes: allowedFileTypes, textAreaProps: textAreaProps, invalidImageSelector: invalidImageSelector, onLatexUpdate: onLatexUpdate }));
return ref;
};
exports.makeRichText = makeRichText;