Skip to content

Instantly share code, notes, and snippets.

@Weiyuan-Lane
Last active January 20, 2019 16:14
Show Gist options
  • Save Weiyuan-Lane/1f65acdb89b1ab93b286b6f4ca682e4a to your computer and use it in GitHub Desktop.
Save Weiyuan-Lane/1f65acdb89b1ab93b286b6f4ca682e4a to your computer and use it in GitHub Desktop.
Root menu item implementation modularized with MenuItem
'use strict'
import CONSTANTS from 'scripts/constants/Constants'
import MenuItem from 'scripts/context-menus/MenuItem'
// The following contains other menu items created and exported in their own files
// They too will either contain a callback or even more child menu items
import PreviewPageMenuItem from 'scripts/context-menus/PreviewPageMenuItem'
import EditPageMenuItem from 'scripts/context-menus/EditPageMenuItem'
import ForumsMenuItem from 'scripts/context-menus/ForumsMenuItem'
import Separator from 'scripts/context-menus/Separator' // This is a factory for creating menu items that functions as separator
const rootProps = {
id: CONSTANTS.ContextMenus.Root.ID,
title: CONSTANTS.ContextMenus.Root.TITLE,
contexts: [ "all" ],
childMenuItems: [
EditPageMenuItem,
PreviewPageMenuItem,
Separator('sep1'),
ForumsMenuItem
]
}
const RootMenuItem = new MenuItem(rootProps)
export default RootMenuItem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment