# rete-options-menu-plugin

> Rete options menu plugin ==== #### Rete.js plugin

Latest version **1.3.5** (published 2019-04-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install rete-options-menu-plugin
pnpm add rete-options-menu-plugin
yarn add rete-options-menu-plugin
bun add rete-options-menu-plugin
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.5 |
| Published | 2019-04-23 |
| First published | 2019-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 381.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Vitaliy Stoliarov |
| Maintainers | radu.petrusan |

## Links

- npm: https://www.npmjs.com/package/rete-options-menu-plugin
- Repository: https://github.com/retejs/context-menu-plugin
- Homepage: https://github.com/retejs/context-menu-plugin#readme
- Issues: https://github.com/retejs/context-menu-plugin/issues
- npm.io page: https://npm.io/package/rete-options-menu-plugin

## Dependencies (2)

- [vue](https://npm.io/package/vue.md) ^2.5.17
- [lodash](https://npm.io/package/lodash.md) ^4.17.11

## Recent versions

- 1.3.5 (latest) — 2019-04-23
- 1.3.4 — 2019-04-22
- 1.3.3 — 2019-04-18
- 1.3.2 — 2019-04-18
- 1.3.1 — 2019-04-18
- 1.3.0 — 2019-04-18
- 1.2.9 — 2019-04-18
- 1.2.8 — 2019-04-18
- 1.2.7 — 2019-04-18
- 1.2.6 — 2019-04-18
- 1.2.5 — 2019-04-18
- 1.2.4 — 2019-04-18
- 1.2.3 — 2019-04-17
- 1.2.2 — 2019-04-17
- 1.2.1 — 2019-04-17
- … 21 more at https://npm.io/package/rete-options-menu-plugin/versions

## README

Rete options menu plugin
====
#### Rete.js plugin

```js
import OptionsMenuPlugin, { Menu, Item, Search } from 'rete-options-menu-plugin';

editor.use(OptionsMenuPlugin, {
    searchBar: false, // true by default
    searchKeep: title => true, // leave item when searching, optional. For example, title => ['Refresh'].includes(title)
    delay: 100,
    allocate(component) {
        return ['Submenu'];
    },
    rename(component) {
        return component.name;
    },
    items: [],
    vueComponent: CustomVueComponent // extends Menu
});
```
| Options | Description | Default |
|-|-|-|
| `searchBar` | Showing search bar | `true`
| `delay` | Delay hide, ms | `1000`
| `allocate` | function for placing of components into submenu | `() => []`
| `rename` | function for renaming of items| `component => component.name`
| `items` | custom items (`Object` with nested objects and functions) | `{}`


You can arbitrarily put a component in a submenu. Examples: 

```js
allocate() { return ["Single submenu"] }
```

```js
allocate(component) { return component.path } // where path is a stack of menu for every component
```


```js
allocate(component) { return null } // exclude component from menu items
```

To change the items that create nodes, you may need to change the name.

```js
class MyComponent {
    constructor() {
        super("My comp");
        this.optionsMenuName = "Add My comp";
    }
}
///
rename(component) { return component.optionsMenuName || component.name }
```

---
_Source: https://npm.io/package/rete-options-menu-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
