Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4049cf75
Commit
4049cf75
authored
Feb 15, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
emit event instead of directly importing editor instance
parent
20dfb127
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
7 deletions
+16
-7
app/assets/javascripts/ide/eventhub.js
app/assets/javascripts/ide/eventhub.js
+3
-0
app/assets/javascripts/ide/lib/common/model.js
app/assets/javascripts/ide/lib/common/model.js
+11
-0
app/assets/javascripts/ide/stores/modules/commit/actions.js
app/assets/javascripts/ide/stores/modules/commit/actions.js
+2
-7
No files found.
app/assets/javascripts/ide/eventhub.js
0 → 100644
View file @
4049cf75
import
Vue
from
'
vue
'
;
export
default
new
Vue
();
app/assets/javascripts/ide/lib/common/model.js
View file @
4049cf75
/* global monaco */
import
Disposable
from
'
./disposable
'
;
import
eventHub
from
'
../../eventhub
'
;
export
default
class
Model
{
constructor
(
monaco
,
file
)
{
...
...
@@ -22,6 +23,9 @@ export default class Model {
);
this
.
events
=
new
Map
();
this
.
updateContent
=
this
.
updateContent
.
bind
(
this
);
eventHub
.
$on
(
`editor.update.model.content.
${
this
.
file
.
path
}
`
,
this
.
updateContent
);
}
get
url
()
{
...
...
@@ -61,8 +65,15 @@ export default class Model {
);
}
updateContent
(
content
)
{
this
.
getModel
().
setValue
(
content
);
this
.
getOriginalModel
().
setValue
(
content
);
}
dispose
()
{
this
.
disposable
.
dispose
();
this
.
events
.
clear
();
eventHub
.
$off
(
`editor.update.model.content.
${
this
.
file
.
path
}
`
,
this
.
updateContent
);
}
}
app/assets/javascripts/ide/stores/modules/commit/actions.js
View file @
4049cf75
...
...
@@ -6,7 +6,7 @@ import router from '../../../ide_router';
import
service
from
'
../../../services
'
;
import
flash
from
'
../../../../flash
'
;
import
{
stripHtml
}
from
'
../../../../lib/utils/text_utility
'
;
import
e
ditor
from
'
../../../lib/editor
'
;
import
e
ventHub
from
'
../../../eventhub
'
;
export
const
updateCommitMessage
=
({
commit
},
message
)
=>
{
commit
(
types
.
UPDATE_COMMIT_MESSAGE
,
message
);
...
...
@@ -71,11 +71,7 @@ export const updateFilesAfterCommit = (
reference
:
data
.
id
,
},
{
root
:
true
});
const
cachedEditorModels
=
editor
.
editorInstance
.
modelManager
.
models
;
rootState
.
changedFiles
.
forEach
((
entry
)
=>
{
const
editorModel
=
cachedEditorModels
.
get
(
entry
.
path
);
commit
(
rootTypes
.
SET_LAST_COMMIT_DATA
,
{
entry
,
lastCommit
,
...
...
@@ -86,8 +82,7 @@ export const updateFilesAfterCommit = (
raw
:
entry
.
content
,
},
{
root
:
true
});
editorModel
.
originalModel
.
setValue
(
entry
.
raw
);
editorModel
.
model
.
setValue
(
entry
.
raw
);
eventHub
.
$emit
(
`editor.update.model.content.
${
entry
.
path
}
`
,
entry
.
raw
);
});
commit
(
rootTypes
.
REMOVE_ALL_CHANGES_FILES
,
null
,
{
root
:
true
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment