summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/blob/utils.js
blob: dc2ec642e59d33be065674e7a06aac0773ce5a01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* global ace */
import Editor from '~/editor/editor_lite';

export function initEditorLite({ el, blobPath, blobContent }) {
  if (!el) {
    throw new Error(`"el" parameter is required to initialize Editor`);
  }
  let editor;

  if (window?.gon?.features?.monacoSnippets) {
    editor = new Editor();
    editor.createInstance({
      el,
      blobPath,
      blobContent,
    });
  } else {
    editor = ace.edit(el);
  }

  return editor;
}

export default () => ({});