1.1 KiB
1.1 KiB
| title | description |
|---|---|
| useMenuModel | Build app and canvas menu models from the current editor state. |
useMenuModel
useMenuModel() builds higher-level menu structures on top of editor commands and selection state.
It is useful when you want ready-to-render menu groups instead of composing commands manually.
Usage
import { useMenuModel } from '@open-pencil/vue'
const { appMenu, canvasMenu, selectionLabelMenu } = useMenuModel()
Basic example
const { canvasMenu } = useMenuModel()
Render canvasMenu.value into your context menu component.
Practical examples
App-style top menu
appMenu groups entries into:
- Edit
- View
- Object
- Arrange
Context menu with page moves
canvasMenu includes dynamic items like “Move to page” based on current selection and available pages.
Selection labels
selectionLabelMenu exposes context-sensitive labels like:
Hide/ShowLock/Unlock