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
93754419
Commit
93754419
authored
Aug 26, 2017
by
Alexander Zobnin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ace: add default light theme
parent
ef3c5436
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
3 deletions
+21
-3
public/app/core/components/code_editor/code_editor.ts
+21
-3
No files found.
public/app/core/components/code_editor/code_editor.ts
View file @
93754419
...
...
@@ -29,10 +29,12 @@
///<reference path="../../../headers/common.d.ts" />
import
_
from
'lodash'
;
import
coreModule
from
'app/core/core_module'
;
import
config
from
'app/core/config'
;
import
ace
from
'ace'
;
const
ACE_SRC_BASE
=
"public/vendor/npm/ace-builds/src-noconflict/"
;
const
DEFAULT_THEME
=
"grafana-dark"
;
const
DEFAULT_THEME_DARK
=
"grafana-dark"
;
const
DEFAULT_THEME_LIGHT
=
"textmate"
;
const
DEFAULT_MODE
=
"text"
;
const
DEFAULT_MAX_LINES
=
10
;
const
DEFAULT_TAB_SIZE
=
2
;
...
...
@@ -66,11 +68,14 @@ setModuleUrl("snippets", "text");
let
editorTemplate
=
`<div></div>`
;
function
link
(
scope
,
elem
,
attrs
)
{
let
lightTheme
=
config
.
bootData
.
user
.
lightTheme
;
let
default_theme
=
lightTheme
?
DEFAULT_THEME_LIGHT
:
DEFAULT_THEME_DARK
;
// Options
let
langMode
=
attrs
.
mode
||
DEFAULT_MODE
;
let
maxLines
=
attrs
.
maxLines
||
DEFAULT_MAX_LINES
;
let
showGutter
=
attrs
.
showGutter
!==
undefined
;
let
theme
=
attrs
.
theme
||
DEFAULT_THEME
;
let
theme
=
attrs
.
theme
||
default_theme
;
let
tabSize
=
attrs
.
tabSize
||
DEFAULT_TAB_SIZE
;
let
behavioursEnabled
=
attrs
.
behavioursEnabled
?
attrs
.
behavioursEnabled
===
'true'
:
DEFAULT_BEHAVIOURS
;
...
...
@@ -158,7 +163,20 @@ function link(scope, elem, attrs) {
function
setThemeMode
(
theme
)
{
setModuleUrl
(
"theme"
,
theme
);
codeEditor
.
setTheme
(
`ace/theme/
${
theme
}
`
);
let
themeModule
=
`ace/theme/
${
theme
}
`
;
ace
.
config
.
loadModule
(
themeModule
,
(
theme_module
)
=>
{
// Check is theme light or dark and fix if needed
let
lightTheme
=
config
.
bootData
.
user
.
lightTheme
;
let
fixedTheme
=
theme
;
if
(
lightTheme
&&
theme_module
.
isDark
)
{
fixedTheme
=
DEFAULT_THEME_LIGHT
;
}
else
if
(
!
lightTheme
&&
!
theme_module
.
isDark
)
{
fixedTheme
=
DEFAULT_THEME_DARK
;
}
setModuleUrl
(
"theme"
,
fixedTheme
);
themeModule
=
`ace/theme/
${
fixedTheme
}
`
;
codeEditor
.
setTheme
(
themeModule
);
});
}
function
setEditorContent
(
value
)
{
...
...
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