editorOptions.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.getAceInstance = exports.debounce = exports.editorEvents = exports.editorOptions = void 0;
  4. var editorOptions = [
  5. "minLines",
  6. "maxLines",
  7. "readOnly",
  8. "highlightActiveLine",
  9. "tabSize",
  10. "enableBasicAutocompletion",
  11. "enableLiveAutocompletion",
  12. "enableSnippets"
  13. ];
  14. exports.editorOptions = editorOptions;
  15. var editorEvents = [
  16. "onChange",
  17. "onFocus",
  18. "onInput",
  19. "onBlur",
  20. "onCopy",
  21. "onPaste",
  22. "onSelectionChange",
  23. "onCursorChange",
  24. "onScroll",
  25. "handleOptions",
  26. "updateRef"
  27. ];
  28. exports.editorEvents = editorEvents;
  29. var getAceInstance = function () {
  30. var ace;
  31. if (typeof window === "undefined") {
  32. // ace-builds just needs some window object to attach ace to.
  33. // During SSR even just an empty object will work.
  34. global.window = {};
  35. ace = require("ace-builds");
  36. // And it can be discarded immediately afterward to avoid confusing
  37. // other libraries that might detect SSR the same way we did.
  38. delete global.window;
  39. }
  40. else if (window.ace) {
  41. // Fallback for ace.require when vanilla ACE is hosted over a CDN
  42. ace = window.ace;
  43. ace.acequire = window.ace.require || window.ace.acequire;
  44. }
  45. else {
  46. ace = require("ace-builds");
  47. }
  48. return ace;
  49. };
  50. exports.getAceInstance = getAceInstance;
  51. var debounce = function (fn, delay) {
  52. var timer = null;
  53. // tslint:disable-next-line
  54. return function () {
  55. var context = this;
  56. var args = arguments;
  57. clearTimeout(timer);
  58. timer = setTimeout(function () {
  59. fn.apply(context, args);
  60. }, delay);
  61. };
  62. };
  63. exports.debounce = debounce;
  64. //# sourceMappingURL=editorOptions.js.map