Skip to content

Commit

Permalink
fix(type): add key name declaration for custom toolbar
Browse files Browse the repository at this point in the history
Added some usage notes
  • Loading branch information
RSS1102 authored Sep 29, 2024
1 parent 1193729 commit 78364a8
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions types/cherry.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,27 @@ import SyntaxBase from '../src/core/SyntaxBase';
import { FormulaMenu } from '@/toolbars/BubbleFormula';

export interface CherryExternalsOptions {
[key: symbol]: any;
[key: string]: any;
}

/**
* 自定义toolbar键名[key]
*/
export interface CustomMenuType {
[key: string]: any;
}


/**
* 自定义按钮功能
* example:
* `customMenu:{
* customMenu_fileUpload: any,
* }`
* 其中`customMenu`是自定按钮的固定属性,`customMenu_fileUpload`是自定义按钮的键名
*/
type CherryToolbarsCustomType = {
CustomMenuType: CherryExternalsOptions
CustomMenuType: CustomMenuType
}

type CherryCustomOptions = {
Expand Down Expand Up @@ -532,6 +548,7 @@ export interface CherryToolbarsOptions<F extends CherryToolbarsCustomType = Cher
toolbar?:
| (CherryDefaultBubbleToolbar |
CherryDefaultToolbar |
keyof Partial<F['CustomMenuType']> |
{ [K in (keyof Partial<F['CustomMenuType']>) | CherryDefaultToolbar]?: (keyof F['CustomMenuType'] | CherryDefaultToolbar)[] })[]
| false;
toolbarRight?:
Expand Down

0 comments on commit 78364a8

Please sign in to comment.