Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
b74fe05f
Commit
b74fe05f
authored
Aug 07, 2017
by
Alexander Zobnin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code-editor: support language mode
parent
ecb66e76
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletions
+15
-1
public/app/core/components/code_editor/code_editor.ts
+15
-1
No files found.
public/app/core/components/code_editor/code_editor.ts
View file @
b74fe05f
...
...
@@ -4,8 +4,15 @@
import
coreModule
from
'app/core/core_module'
;
import
ace
from
'ace'
;
const
ACE_SRC_BASE
=
"public/vendor/npm/ace-builds/src-noconflict/"
;
// Trick for loading additional modules
ace
.
config
.
setModuleUrl
(
"ace/theme/solarized_dark"
,
"public/vendor/npm/ace-builds/src-noconflict/theme-solarized_dark.js"
);
function
fixModuleUrl
(
moduleType
,
name
)
{
let
aceModeName
=
`ace/
${
moduleType
}
/
${
name
}
`
;
ace
.
config
.
setModuleUrl
(
aceModeName
,
ACE_SRC_BASE
+
`
${
moduleType
}
-
${
name
}
.js`
);
}
fixModuleUrl
(
"theme"
,
"solarized_dark"
);
let
editorTemplate
=
`
<div class="gf-code-editor"></div>
...
...
@@ -19,6 +26,7 @@ function link(scope, elem, attrs) {
codeEditor
.
setHighlightActiveLine
(
false
);
codeEditor
.
setShowPrintMargin
(
false
);
codeEditor
.
$blockScrolling
=
Infinity
;
setLangMode
();
codeEditor
.
setValue
(
scope
.
content
);
codeEditor
.
clearSelection
();
...
...
@@ -35,6 +43,12 @@ function link(scope, elem, attrs) {
});
});
function
setLangMode
()
{
let
lang
=
attrs
.
mode
||
'text'
;
let
aceModeName
=
`ace/mode/
${
lang
}
`
;
fixModuleUrl
(
"mode"
,
lang
);
editorSession
.
setMode
(
aceModeName
);
}
}
export
function
codeEditorDirective
()
{
...
...
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