Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
SigNoz
Commits
a238123e
Unverified
Commit
a238123e
authored
3 years ago
by
palash-signoz
Committed by
GitHub
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
feat: monaco editor is updated (#851)
parent
4337ab5c
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
frontend/package.json
+1
-1
frontend/package.json
frontend/src/components/Editor/index.tsx
+11
-36
frontend/src/components/Editor/index.tsx
frontend/src/components/Editor/styles.ts
+0
-8
frontend/src/components/Editor/styles.ts
frontend/yarn.lock
+1757
-2042
frontend/yarn.lock
with
1769 additions
and
2087 deletions
+1769
-2087
frontend/package.json
+
1
-
1
View file @
a238123e
...
...
@@ -22,6 +22,7 @@
"license"
:
"ISC"
,
"dependencies"
:
{
"@ant-design/icons"
:
"^4.6.2"
,
"@monaco-editor/react"
:
"^4.3.1"
,
"@grafana/data"
:
"^8.4.3"
,
"@testing-library/jest-dom"
:
"^5.11.4"
,
"@testing-library/react"
:
"^11.1.0"
,
...
...
@@ -52,7 +53,6 @@
"less"
:
"^4.1.2"
,
"less-loader"
:
"^10.2.0"
,
"mini-css-extract-plugin"
:
"2.4.5"
,
"monaco-editor"
:
"^0.30.0"
,
"react"
:
"17.0.0"
,
"react-dom"
:
"17.0.0"
,
"react-force-graph"
:
"^1.41.0"
,
...
...
This diff is collapsed.
Click to expand it.
frontend/src/components/Editor/index.tsx
+
11
-
36
View file @
a238123e
import
*
as
monaco
from
'
monaco-editor
'
;
import
React
,
{
useEffect
,
useRef
}
from
'
react
'
;
import
{
Container
}
from
'
./styles
'
;
import
MEditor
from
'
@monaco-editor/react
'
;
import
React
from
'
react
'
;
const
Editor
=
({
value
}:
EditorProps
):
JSX
.
Element
=>
{
const
divEl
=
useRef
<
HTMLDivElement
>
(
null
);
const
editorRef
=
useRef
<
monaco
.
editor
.
IStandaloneCodeEditor
>
();
useEffect
(()
=>
{
let
editor
=
editorRef
.
current
;
if
(
divEl
.
current
)
{
editor
=
monaco
.
editor
.
create
(
divEl
.
current
,
{
value
:
value
.
current
||
''
,
useShadowDOM
:
true
,
theme
:
'
vs-dark
'
,
automaticLayout
:
true
,
fontSize
:
16
,
minimap
:
{
enabled
:
false
,
},
language
:
'
yaml
'
,
});
}
editor
?.
getModel
()?.
onDidChangeContent
(()
=>
{
value
.
current
=
editor
?.
getValue
()
||
''
;
});
return
():
void
=>
{
if
(
editor
)
{
editor
.
dispose
();
}
};
},
[
value
]);
return
<
Container
ref
=
{
divEl
}
/>;
return
(
<
MEditor
theme
=
"vs-dark"
defaultLanguage
=
"yaml"
value
=
{
value
.
current
}
options
=
{
{
fontSize
:
16
,
automaticLayout
:
true
}
}
height
=
{
'
40vh
'
}
/>
);
};
interface
EditorProps
{
...
...
This diff is collapsed.
Click to expand it.
frontend/src/components/Editor/styles.ts
deleted
100644 → 0
+
0
-
8
View file @
4337ab5c
import
styled
from
'
styled-components
'
;
export
const
Container
=
styled
.
div
`
&&& {
min-height: 40vh;
width: 100%;
}
`
;
This diff is collapsed.
Click to expand it.
frontend/yarn.lock
+
1757
-
2042
View file @
a238123e
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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