@sanity/visual-editing
Version:
[](https://npm-stat.com/charts.html?package=@sanity/visual-editing) [](https://
33 lines (32 loc) • 1.02 kB
JavaScript
import { jsx } from "react/jsx-runtime";
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { VisualEditing } from "../react/index.js";
let node = null, root = null, cleanup = null;
function renderVisualEditing(signal, {
components,
history,
refresh,
zIndex,
plugins
}) {
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,
portal: !1
}
) }));
}
export {
renderVisualEditing
};
//# sourceMappingURL=renderVisualEditing.js.map