CodeMirrorEditorComment.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { jsx as a } from "react/jsx-runtime";
  2. import { useEffect as s } from "react";
  3. import { scrollPastEnd as l, keymap as f } from "@codemirror/view";
  4. import { GlobalCodeMirrorEditorKey as m } from "../consts/global-code-mirror-editor-key.js";
  5. import { useCodeMirrorEditorIsolated as r } from "../stores/codemirror-editor.js";
  6. import { CodeMirrorEditor as C } from "./CodeMirrorEditor/CodeMirrorEditor.js";
  7. import "./CodeMirrorEditorMain.js";
  8. const i = [
  9. l()
  10. ], N = (p) => {
  11. const {
  12. onComment: e,
  13. onChange: u
  14. } = p, { data: n } = r(m.COMMENT);
  15. return s(() => {
  16. var t;
  17. return (t = n == null ? void 0 : n.appendExtensions) == null ? void 0 : t.call(n, i);
  18. }, [n]), s(() => {
  19. var o;
  20. if (e == null)
  21. return;
  22. const t = f.of([
  23. {
  24. key: "Mod-Enter",
  25. preventDefault: !0,
  26. run: () => ((n == null ? void 0 : n.getDoc()) != null && e(), !0)
  27. }
  28. ]);
  29. return (o = n == null ? void 0 : n.appendExtensions) == null ? void 0 : o.call(n, t);
  30. }, [n, e]), /* @__PURE__ */ a(
  31. C,
  32. {
  33. editorKey: m.COMMENT,
  34. onChange: u
  35. }
  36. );
  37. };
  38. export {
  39. N as CodeMirrorEditorComment
  40. };
  41. //# sourceMappingURL=CodeMirrorEditorComment.js.map