codemirror-editor.js 850 B

1234567891011121314151617
  1. import { useRef as c, useMemo as d } from "react";
  2. import { useSWRStatic as m } from "../packages/core/dist/swr/use-swr-static.js";
  3. import a from "ts-deepmerge";
  4. import { useCodeMirrorEditor as f } from "../services/codemirror-editor/use-codemirror-editor/use-codemirror-editor.js";
  5. const p = (r) => r.state != null && r.view != null, y = (r, e) => Object.keys(r).every((t) => r[t] === e[t]), w = (r, e, o) => {
  6. const t = c(), s = t.current, i = r != null ? `codeMirrorEditor_${r}` : null, u = d(() => a(
  7. o ?? {},
  8. {
  9. container: e
  10. }
  11. ), [e, o]), n = f(u), l = i != null && e != null && o != null && (s == null || p(n) && !y(s, n));
  12. return l && (t.current = n, console.info("Initializing codemirror for main")), m(i, l ? n : void 0);
  13. };
  14. export {
  15. w as useCodeMirrorEditorIsolated
  16. };
  17. //# sourceMappingURL=codemirror-editor.js.map