diff options
author | Phil Hughes <me@iamphill.com> | 2018-08-28 10:01:14 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-09-07 08:24:00 +0100 |
commit | 7465f62eb559d10902f478be7a51b9661d1f89be (patch) | |
tree | 9b4dcef390c84f1689c02769e9ec4dc5679b4e1f /app/assets/javascripts/ide/stores/modules/file_templates/actions.js | |
parent | 843467b8c4be9ff1658d18d606f7fd5b149cbec9 (diff) | |
download | gitlab-ce-7465f62eb559d10902f478be7a51b9661d1f89be.tar.gz |
fixed action name changes after rebase
fixed content not updating in editor when changing template
Diffstat (limited to 'app/assets/javascripts/ide/stores/modules/file_templates/actions.js')
-rw-r--r-- | app/assets/javascripts/ide/stores/modules/file_templates/actions.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/assets/javascripts/ide/stores/modules/file_templates/actions.js b/app/assets/javascripts/ide/stores/modules/file_templates/actions.js index 43237a29466..a4da2ac5c04 100644 --- a/app/assets/javascripts/ide/stores/modules/file_templates/actions.js +++ b/app/assets/javascripts/ide/stores/modules/file_templates/actions.js @@ -1,6 +1,7 @@ import Api from '~/api'; import { __ } from '~/locale'; import * as types from './mutation_types'; +import eventHub from '../../../eventhub'; export const requestTemplateTypes = ({ commit }) => commit(types.REQUEST_TEMPLATE_TYPES); export const receiveTemplateTypesError = ({ commit, dispatch }) => { @@ -69,6 +70,7 @@ export const setFileTemplate = ({ dispatch, commit, rootGetters }, template) => { root: true }, ); commit(types.SET_UPDATE_SUCCESS, true); + eventHub.$emit(`editor.update.model.new.content.${rootGetters.activeFile.key}`, template.content); }; export const undoFileTemplate = ({ dispatch, commit, rootGetters }) => { @@ -76,6 +78,8 @@ export const undoFileTemplate = ({ dispatch, commit, rootGetters }) => { dispatch('changeFileContent', { path: file.path, content: file.raw }, { root: true }); commit(types.SET_UPDATE_SUCCESS, false); + + eventHub.$emit(`editor.update.model.new.content.${file.key}`, file.raw); }; // prevent babel-plugin-rewire from generating an invalid default during karma tests |