Skip to content

Commit

Permalink
feat: ✨ can set menubar: false to prevent the button from rendering…
Browse files Browse the repository at this point in the history
… in the menubar (#53)

close #53
  • Loading branch information
Leecason committed May 5, 2020
1 parent 103ef46 commit 644d3dd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export default {
new Paragraph(),
new Heading({ level: 5 }),
new Bold({ bubble: true }), // render command-button in bubble menu.
new Underline(),
new Underline({ bubble: true, menubar: false }), // render command-button in bubble menu but not in menubar.
new Italic(),
new Strike(),
new ListItem(),
Expand Down
2 changes: 1 addition & 1 deletion README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export default {
new Paragraph(),
new Heading({ level: 5 }),
new Bold({ bubble: true }), // 在气泡菜单中渲染菜单按钮
new Underline(),
new Underline({ bubble: true, menubar: false }), // 在气泡菜单而不在菜单栏中渲染菜单按钮
new Italic(),
new Strike(),
new ListItem(),
Expand Down
1 change: 1 addition & 0 deletions src/components/MenuBar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default class Menubar extends Vue {
private generateCommandButtonComponentSpecs (editorContext: MenuData): MenuBtnViewType[] {
const extensionManager = this.editor.extensions;
return extensionManager.extensions.reduce <MenuBtnViewType[]>((acc, extension) => {
if (extension.options.menubar === false) return acc;
if (typeof extension.menuBtnView !== 'function') return acc;
const menuBtnComponentSpec = extension.menuBtnView({
Expand Down

0 comments on commit 644d3dd

Please sign in to comment.