summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/stores/modules/editor/getters.js
blob: dabaafa453a745cf4f02d431637afcdcf73fcdcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { getFileEditorOrDefault } from './utils';

export const activeFileEditor = (state, getters, rootState, rootGetters) => {
  const { activeFile } = rootGetters;

  if (!activeFile) {
    return null;
  }

  const { path } = rootGetters.activeFile;

  return getFileEditorOrDefault(state.fileEditors, path);
};