Skip to content

Commit

Permalink
style: 完善amis暗黑主题
Browse files Browse the repository at this point in the history
  • Loading branch information
qkiroc committed Feb 4, 2024
1 parent 98f2bb2 commit eff8cbb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
6 changes: 3 additions & 3 deletions packages/amis-ui/scss/components/form/_excel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
padding: var(--gap-md);
border-width: 2px;
border-radius: 2px;
border-color: #eeeeee;
border-color: var(--colors-neutral-line-8);
border-style: dashed;
background-color: #fafafa;
color: #bdbdbd;
background-color: var(--colors-neutral-fill-10);
color: var(--colors-neutral-text-6);
outline: none;
transition: border 0.24s ease-in-out;
}
Expand Down
6 changes: 2 additions & 4 deletions packages/amis/src/renderers/Code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ export default class Code extends React.Component<CodeProps> {

static defaultProps: Partial<CodeProps> = {
language: 'plaintext',
editorTheme: 'vs',
tabSize: 4,
wordWrap: true
};
Expand Down Expand Up @@ -267,12 +266,11 @@ export default class Code extends React.Component<CodeProps> {

return language;
}

/** 注册并返回当前主题名称,如果未自定义主题,则范围editorTheme值,默认为'vs' */
registerAndGetTheme() {
const monaco = this.monaco;
const {editorTheme = 'vs'} = this.props;

let {theme, editorTheme} = this.props;
editorTheme = editorTheme || (theme === 'dark' ? 'vs-dark' : 'vs');
if (!monaco) {
return editorTheme;
}
Expand Down
1 change: 0 additions & 1 deletion packages/amis/src/renderers/Form/DiffEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ function normalizeValue(value: any, language?: string) {
export class DiffEditor extends React.Component<DiffEditorProps, any> {
static defaultProps: Partial<DiffEditorProps> = {
language: 'javascript',
theme: 'vs',
options: {
automaticLayout: false,
selectOnLineNumbers: true,
Expand Down
5 changes: 3 additions & 2 deletions packages/amis/src/renderers/Form/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export interface EditorProps extends FormControlProps {
export default class EditorControl extends React.Component<EditorProps, any> {
static defaultProps: Partial<EditorProps> = {
language: 'javascript',
editorTheme: 'vs',
editorTheme: '',
allowFullscreen: true,
options: {
automaticLayout: true,
Expand Down Expand Up @@ -285,6 +285,7 @@ export default class EditorControl extends React.Component<EditorProps, any> {
disabled,
options,
editorTheme,
theme,
size,
data,
allowFullscreen,
Expand Down Expand Up @@ -325,7 +326,7 @@ export default class EditorControl extends React.Component<EditorProps, any> {
onFocus={this.handleFocus}
onBlur={this.handleBlur}
language={language}
editorTheme={editorTheme}
editorTheme={editorTheme || (theme === 'dark' ? 'vs-dark' : 'vs')}
editorDidMount={this.handleEditorMounted}
childProps={{
placeholder: placeholder
Expand Down

0 comments on commit eff8cbb

Please sign in to comment.