Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(type): type error in config #839

Merged
merged 10 commits into from
Aug 14, 2024
Merged

fix(type): type error in config #839

merged 10 commits into from
Aug 14, 2024

Conversation

RSS1102
Copy link
Collaborator

@RSS1102 RSS1102 commented Jul 10, 2024

toolbar中 设置包含二级菜单栏的时候,遇到一级菜单栏错误。
这里设置成了string类型进行通配,但是感觉这种失去了约束力。
你有空给看下,怎么设置这个类型比较好@lyngai

a9b29c57fd2a1770c6b697bbffc81e5
cab7e2e1efa2605d2c97d1e3916f4ea

@tencent-adm
Copy link
Member

tencent-adm commented Jul 10, 2024

CLA assistant check
All committers have signed the CLA.

@Saraph1nes
Copy link
Collaborator

toolbar中 设置包含二级菜单栏的时候,遇到一级菜单栏错误。 这里设置成了string类型进行通配,但是感觉这种失去了约束力。 你有空给看下,怎么设置这个类型比较好@lyngai

a9b29c57fd2a1770c6b697bbffc81e5 cab7e2e1efa2605d2c97d1e3916f4ea

image

这样可以吗

@RSS1102
Copy link
Collaborator Author

RSS1102 commented Jul 13, 2024

toolbar中 设置包含二级菜单栏的时候,遇到一级菜单栏错误。 这里设置成了string类型进行通配,但是感觉这种失去了约束力。 你有空给看下,怎么设置这个类型比较好@lyngai
a9b29c57fd2a1770c6b697bbffc81e5 cab7e2e1efa2605d2c97d1e3916f4ea

image 这样可以吗

但是还有一个就是自定义的按钮咋办,他们不在这个范围内。。

@Saraph1nes
Copy link
Collaborator

toolbar中 设置包含二级菜单栏的时候,遇到一级菜单栏错误。 这里设置成了string类型进行通配,但是感觉这种失去了约束力。 你有空给看下,怎么设置这个类型比较好@lyngai
a9b29c57fd2a1770c6b697bbffc81e5 cab7e2e1efa2605d2c97d1e3916f4ea

image 这样可以吗

但是还有一个就是自定义的按钮咋办,他们不在这个范围内。。

image

看下这样是否可以解决,获取customMenu中用户自定义的key值,用于CherryInsertToolbar的校验

@RSS1102
Copy link
Collaborator Author

RSS1102 commented Jul 13, 2024

toolbar中 设置包含二级菜单栏的时候,遇到一级菜单栏错误。 这里设置成了string类型进行通配,但是感觉这种失去了约束力。 你有空给看下,怎么设置这个类型比较好@lyngai
a9b29c57fd2a1770c6b697bbffc81e5 cab7e2e1efa2605d2c97d1e3916f4ea

image 这样可以吗

但是还有一个就是自定义的按钮咋办,他们不在这个范围内。。

image 看下这样是否可以解决,获取customMenu中用户自定义的key值,用于CherryInsertToolbar的校验

我试一下

@RSS1102
Copy link
Collaborator Author

RSS1102 commented Jul 14, 2024

😞😞目前怎么推导customMenu都是一个string类型

type CherryTopToolbarKeys =
  | 'bold'
  | 'italic'
  | 'strikethrough'
  | 'color'
  | 'header'
  | 'list'
  | 'image'
  | 'audio'
  | 'video'
  | 'link'
  | 'hr'
  | 'br'
  | 'code'
  | 'formula'
  | 'toc'
  | 'table'
  | 'pdf'
  | 'word'
  | 'graph'
  | 'settings'
  | 'insert';

export type CherryToolbarSeparator = '|';

type CustomToolbarKeys = keyof CherryToolbarOptions['customMenu'];

export type CherryDefaultToolbar =
  | CherryInsertToolbar
  | CherryToolbarSeparator
  | CherryTopToolbarKeys;


export type CherryInsertToolbar = {
  [key in CherryTopToolbarKeys & CustomToolbarKeys]?: string[];
};

@RSS1102
Copy link
Collaborator Author

RSS1102 commented Jul 25, 2024

@Saraph1nes
已经将自定义工具栏类型添加进去了,但是目前还出现这个错误,请帮忙看下。
image

Copy link

【预览链接】

1 similar comment
Copy link

【预览链接】

Copy link

github-actions bot commented Aug 4, 2024

【预览链接】

Copy link

github-actions bot commented Aug 4, 2024

【预览链接】

Copy link

github-actions bot commented Aug 7, 2024

【预览链接】

Copy link

【预览链接】

2 similar comments
Copy link

【预览链接】

Copy link

【预览链接】

@RSS1102 RSS1102 merged commit 10a226c into Tencent:dev Aug 14, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants