UNPKG

@selenite/graph-editor

Version:

A graph editor for visual programming, based on rete and svelte.

13 lines (12 loc) 504 B
import { getContext } from 'svelte'; export function getEditorFromContext() { const editorContext = getContext('editor'); return { get editor() { return editorContext.activeEditor || editorContext.editor || editorContext.activeFactory?.editor || editorContext.factory?.editor; }, get factory() { return editorContext.activeFactory || editorContext.factory || editorContext.activeEditor?.factory || editorContext.editor?.factory; } }; }