This reverts commit 682f0dfc30.
			
			
This commit is contained in:
		
							parent
							
								
									bab004f951
								
							
						
					
					
						commit
						1509893ebc
					
				@ -16,6 +16,8 @@ const locale = {
 | 
				
			|||||||
  'Edit based on current theme': '基于当前主题进行编辑',
 | 
					  'Edit based on current theme': '基于当前主题进行编辑',
 | 
				
			||||||
  'Create a brand new theme': '创建一个全新的主题',
 | 
					  'Create a brand new theme': '创建一个全新的主题',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // 内置主题的名字
 | 
				
			||||||
 | 
					  'Default theme of antd': 'antd 默认主题',
 | 
				
			||||||
  Dark: '暗黑',
 | 
					  Dark: '暗黑',
 | 
				
			||||||
  Compact: '紧凑',
 | 
					  Compact: '紧凑',
 | 
				
			||||||
  'Compact dark': '紧凑暗黑',
 | 
					  'Compact dark': '紧凑暗黑',
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,7 @@ import { ThemeItem } from '../types';
 | 
				
			|||||||
/** antd 默认主题 */
 | 
					/** antd 默认主题 */
 | 
				
			||||||
export const antd: Omit<ThemeItem, 'id'> = {
 | 
					export const antd: Omit<ThemeItem, 'id'> = {
 | 
				
			||||||
  config: {
 | 
					  config: {
 | 
				
			||||||
    name: 'Default',
 | 
					    name: 'Default theme of antd',
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  optional: true,
 | 
					  optional: true,
 | 
				
			||||||
  isBuiltIn: true,
 | 
					  isBuiltIn: true,
 | 
				
			||||||
 | 
				
			|||||||
@ -1,15 +0,0 @@
 | 
				
			|||||||
import { Migration } from '@nocobase/server';
 | 
					 | 
				
			||||||
import { antd, compact, compactDark, dark } from '../builtinThemes';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default class ThemeEditorMigration extends Migration {
 | 
					 | 
				
			||||||
  async up() {
 | 
					 | 
				
			||||||
    const theme = this.db.getCollection('themeConfig');
 | 
					 | 
				
			||||||
    if (theme) {
 | 
					 | 
				
			||||||
      await theme.repository.create({
 | 
					 | 
				
			||||||
        values: [antd, dark, compact, compactDark],
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  async down() {}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,6 +1,5 @@
 | 
				
			|||||||
import { Collection } from '@nocobase/database';
 | 
					import { Collection } from '@nocobase/database';
 | 
				
			||||||
import { InstallOptions, Plugin } from '@nocobase/server';
 | 
					import { InstallOptions, Plugin } from '@nocobase/server';
 | 
				
			||||||
import { resolve } from 'path';
 | 
					 | 
				
			||||||
import { antd, compact, compactDark, dark } from './builtinThemes';
 | 
					import { antd, compact, compactDark, dark } from './builtinThemes';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class ThemeEditorPlugin extends Plugin {
 | 
					export class ThemeEditorPlugin extends Plugin {
 | 
				
			||||||
@ -8,15 +7,7 @@ export class ThemeEditorPlugin extends Plugin {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  afterAdd() {}
 | 
					  afterAdd() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  beforeLoad() {
 | 
					  beforeLoad() {}
 | 
				
			||||||
    this.db.addMigrations({
 | 
					 | 
				
			||||||
      namespace: 'theme-editor',
 | 
					 | 
				
			||||||
      directory: resolve(__dirname, './migrations'),
 | 
					 | 
				
			||||||
      context: {
 | 
					 | 
				
			||||||
        plugin: this,
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async load() {
 | 
					  async load() {
 | 
				
			||||||
    this.theme = this.db.collection({
 | 
					    this.theme = this.db.collection({
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user