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
ad5667ae
Commit
ad5667ae
authored
Feb 03, 2021
by
Denys Mishunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved out decoration functions to external fns
Aslso re-named some functions to match the naming
parent
3f079d84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
12 deletions
+20
-12
app/assets/javascripts/editor/editor_lite.js
app/assets/javascripts/editor/editor_lite.js
+20
-12
No files found.
app/assets/javascripts/editor/editor_lite.js
View file @
ad5667ae
...
...
@@ -137,26 +137,34 @@ export default class EditorLite {
static
convertMonacoToELInstance
=
(
inst
)
=>
{
const
decoratedInstance
=
inst
;
decoratedInstance
.
updateModelLanguage
=
(
path
)
=>
{
const
lang
=
EditorLite
.
getModelLanguage
(
path
);
const
model
=
decoratedInstance
.
getModel
();
return
monacoEditor
.
setModelLanguage
(
model
,
lang
);
return
EditorLite
.
instanceUpdateLanguage
(
inst
,
path
);
};
decoratedInstance
.
use
=
(
exts
=
[])
=>
{
const
extensions
=
Array
.
isArray
(
exts
)
?
exts
:
[
exts
];
extensions
.
forEach
((
extension
)
=>
{
EditorLite
.
mixIntoInstance
(
extension
,
decoratedInstance
);
});
return
decoratedInstance
;
return
EditorLite
.
instanceApplyExtension
(
inst
,
exts
);
};
return
decoratedInstance
;
};
static
removeInstanceFromRegistry
(
editor
,
instance
)
{
static
instanceUpdateLanguage
(
inst
,
path
)
{
const
lang
=
EditorLite
.
getModelLanguage
(
path
);
const
model
=
inst
.
getModel
();
return
monacoEditor
.
setModelLanguage
(
model
,
lang
);
}
static
instanceApplyExtension
(
inst
,
exts
=
[])
{
const
extensions
=
Array
.
isArray
(
exts
)
?
exts
:
[
exts
];
extensions
.
forEach
((
extension
)
=>
{
EditorLite
.
mixIntoInstance
(
extension
,
inst
);
});
return
inst
;
}
static
instanceRemoveFromRegistry
(
editor
,
instance
)
{
const
index
=
editor
.
instances
.
findIndex
((
inst
)
=>
inst
===
instance
);
editor
.
instances
.
splice
(
index
,
1
);
}
static
disposeInstanc
eModels
(
editor
,
instance
,
model
)
{
static
instanceDispos
eModels
(
editor
,
instance
,
model
)
{
const
instanceModel
=
instance
.
getModel
()
||
model
;
if
(
!
instanceModel
)
{
return
;
...
...
@@ -216,8 +224,8 @@ export default class EditorLite {
}
instance
.
onDidDispose
(()
=>
{
EditorLite
.
removeInstanc
eFromRegistry
(
this
,
instance
);
EditorLite
.
disposeInstanc
eModels
(
this
,
instance
,
model
);
EditorLite
.
instanceRemov
eFromRegistry
(
this
,
instance
);
EditorLite
.
instanceDispos
eModels
(
this
,
instance
,
model
);
});
EditorLite
.
manageDefaultExtensions
(
instance
,
el
,
extensions
);
...
...
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