API for rete-context-menu-plugin package - Rete.js

API for rete-context-menu-plugin package

ContextMenuExtra

index.ts

Signal types produced by ContextMenuPlugin instance

ts
type ContextMenuExtra = RenderSignal<
  "contextmenu",
  { items: Item[]; searchBar: boolean; onHide: unknown }
>;

ContextMenuPlugin

index.ts

Plugin for context menu. Responsible for initialing rendering of context menu with predefined items.

ts
class ContextMenuPlugin<Schemes extends BaseSchemes>
ParameterExtendsDescription
SchemesBaseSchemes

Extends Scope<never, Requires | ContextMenuExtra>

Emits render unmount

Listens unmount contextmenu pointerdown

constructor

index.ts

ts
constructor(props: Props<Schemes>): ContextMenuPlugin<Schemes>
ParameterTypeDescription
propsProps<Schemes>Properties

Returns ContextMenuPlugin<Schemes>

Props

index.ts

Context menu plugin props

ts
type Props<Schemes extends BaseSchemes> = {
  delay: number;
  items: Items<Schemes>;
};
ParameterExtendsDescription
SchemesBaseSchemes

Presets

presets/index.ts

Presets that create items for root and node specific context menu.

classic

presets/classic/index.ts

setup

presets/classic/index.ts

Classic context menu preset. Configures nodes/actions items for root and Delete/Clone items for nodes

ts
setup(nodes: ItemDefinition<Schemes>[]): Items<Schemes>

Examples

ts
Presets.classic.setup([
 ["Math", [
   ["Number", () => new NumberNode()],
 ]]
])
ParameterTypeDescription
nodesItemDefinition<Schemes>[]List of items

Returns Items<Schemes>