@sanity/visual-editing
Version:
[](https://npm-stat.com/charts.html?package=@sanity/visual-editing) [](https://
35 lines (34 loc) • 1.07 kB
JavaScript
import { jsx } from "react/jsx-runtime";
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { VisualEditing } from "./VisualEditing.js";
let node = null, root = null, cleanup = null;
function renderVisualEditing(signal, {
components,
history,
refresh,
zIndex,
plugins,
onPerspectiveChange
}) {
cleanup && clearTimeout(cleanup), signal.addEventListener("abort", () => {
cleanup = setTimeout(() => {
root && (root.unmount(), root = null), node && (node.parentNode.removeChild(node), node = null);
}, 1e3);
}), node || (node = document.createElement("sanity-visual-editing"), document.body.parentNode.insertBefore(node, document.body.nextSibling)), root || (root = createRoot(node)), root.render(/* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(
VisualEditing,
{
components,
plugins,
history,
refresh,
zIndex,
onPerspectiveChange,
portal: !1
}
) }));
}
export {
renderVisualEditing
};
//# sourceMappingURL=renderVisualEditing.js.map