rojects/source/editor/editor-panel.ts

28 lines
654 B
TypeScript

import { ContextMenuDirectory } from '../components/context-menu/context-menu.js';
export class EditorPanelDefinition
{
static readonly type = 'EditorPanel';
}
export class FileEditorPanelDefinition
{
static readonly type = 'FileEditorPanel';
}
export interface EditorPanel extends HTMLElement
{
__interfaces__: string[];
addContextMenuEntries( dir: ContextMenuDirectory ): void;
}
export interface FileEditorPanel extends EditorPanel
{
hasUnsavedChanges(): boolean;
}
export function implementsInterface( el: any, def: { type: string } ): boolean
{
return Array.isArray( el.__interfaces__ ) && el.__interfaces__.includes( def.type );
}