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
b038b2b8
Commit
b038b2b8
authored
Oct 16, 2020
by
Denys Mishunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Load Monaco on edit/new views only
When in Project=related areas, we should not load Monaco everywhere
parent
b8bd4850
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
8 deletions
+28
-8
app/assets/javascripts/blob_edit/blob_bundle.js
app/assets/javascripts/blob_edit/blob_bundle.js
+13
-8
spec/frontend/blob_edit/blob_bundle_spec.js
spec/frontend/blob_edit/blob_bundle_spec.js
+15
-0
No files found.
app/assets/javascripts/blob_edit/blob_bundle.js
View file @
b038b2b8
...
...
@@ -2,7 +2,7 @@
import
$
from
'
jquery
'
;
import
NewCommitForm
from
'
../new_commit_form
'
;
import
EditBlob
from
'
./edit_blob
'
;
import
{
deprecatedCreateFlash
as
createFlash
}
from
'
~/flash
'
;
import
BlobFileDropzone
from
'
../blob/blob_file_dropzone
'
;
import
initPopover
from
'
~/blob/suggest_gitlab_ci_yml
'
;
import
{
disableButtonIfEmptyField
,
setCookie
}
from
'
~/lib/utils/common_utils
'
;
...
...
@@ -24,6 +24,18 @@ export default () => {
const
commitButton
=
$
(
'
.js-commit-button
'
);
const
cancelLink
=
$
(
'
.btn.btn-cancel
'
);
import
(
'
./edit_blob
'
)
.
then
(({
default
:
EditBlob
}
=
{})
=>
{
new
EditBlob
({
assetsPath
:
`
${
urlRoot
}${
assetsPath
}
`
,
filePath
,
currentAction
,
projectId
,
isMarkdown
,
});
})
.
catch
(
e
=>
createFlash
(
e
));
cancelLink
.
on
(
'
click
'
,
()
=>
{
window
.
onbeforeunload
=
null
;
});
...
...
@@ -32,13 +44,6 @@ export default () => {
window
.
onbeforeunload
=
null
;
});
new
EditBlob
({
assetsPath
:
`
${
urlRoot
}${
assetsPath
}
`
,
filePath
,
currentAction
,
projectId
,
isMarkdown
,
});
new
NewCommitForm
(
editBlobForm
);
// returning here blocks page navigation
...
...
spec/frontend/blob_edit/blob_bundle_spec.js
View file @
b038b2b8
import
$
from
'
jquery
'
;
import
{
mockTracking
,
unmockTracking
}
from
'
helpers/tracking_helper
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
blobBundle
from
'
~/blob_edit/blob_bundle
'
;
import
EditorLite
from
'
~/blob_edit/edit_blob
'
;
jest
.
mock
(
'
~/blob_edit/edit_blob
'
);
describe
(
'
BlobBundle
'
,
()
=>
{
it
(
'
does not load EditorLite by default
'
,
()
=>
{
blobBundle
();
expect
(
EditorLite
).
not
.
toHaveBeenCalled
();
});
it
(
'
loads EditorLite for the edit screen
'
,
async
()
=>
{
setFixtures
(
`<div class="js-edit-blob-form"></div>`
);
blobBundle
();
await
waitForPromises
();
expect
(
EditorLite
).
toHaveBeenCalled
();
});
describe
(
'
No Suggest Popover
'
,
()
=>
{
beforeEach
(()
=>
{
setFixtures
(
`
...
...
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