Skip to content

Instantly share code, notes, and snippets.

@michael
Last active September 24, 2019 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michael/c194f47c6fbc43a2873a9db3475db6b6 to your computer and use it in GitHub Desktop.
Save michael/c194f47c6fbc43a2873a9db3475db6b6 to your computer and use it in GitHub Desktop.
// menu spec for user menu
const userMenuSpec = {
 name: ‘user-menu’,
 items: [
   { type: ‘command’, label: ‘My documents’ },
   { type: ‘command’, label: ‘User Settings’ },
   { type: ‘separator’ },
   { type: ‘command’, label: ‘Log out’ }
 ]
}
// menu spec for insert menu (should be shown when disabled)
const insertMenu = {
 name: ‘insert-menu’,
 items: [
   {
     type: ‘submenu’,
     label: ‘Table’,
     hideDisabled: false,
     items: [
       { type: ‘custom’, command: ‘insert-table’, componentName: ‘CreateTablePrompt’ }
     ]
   },
   {
     command: ‘insert-figure’, label: ‘Insert Figure’
   }
 ]
}
// menu spec for text type switcher (should not be rendered when all text-types are disabled)
const switchTextType = {
 name: ‘switch-text-type’,
 items: [
   {
     command: ‘switch-to-heading-1’, label: ‘Heading 1’
   },
   {
     command: ‘switch-to-heading-2’, label: ‘Heading 2’
   }
 ]
}
const editorToolsMenu = {
name: 'editor-toolbar',
items: [
{ command: ‘strong’, label: ‘Bold’ },
{ command: ‘emphasis’, label: ‘Italic’ },
{ command: ‘link’, label: ‘Link’ },
{ type: ’submenu’, items: insertMenu, label: 'Insert' },
{ type: ’text-type’, items: switchTextType, label: 'Insert' }
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment