@ngstack/code-editor
Version:
Code editor component for Angular applications.
47 lines (46 loc) • 1.62 kB
TypeScript
import { InjectionToken } from '@angular/core';
import { Subject, BehaviorSubject } from 'rxjs';
import { CodeEditorSettings } from '../editor-settings';
import { editor } from 'monaco-editor';
import * as i0 from "@angular/core";
export declare const EDITOR_SETTINGS: InjectionToken<CodeEditorSettings>;
export interface TypingsInfo {
entryPoints: {
[key: string]: string;
};
files: Array<{
content: string;
name: string;
url: string;
path: string;
}>;
}
export declare class CodeEditorService {
readonly baseUrl: string;
readonly typingsWorkerUrl: string;
typingsLoaded: Subject<TypingsInfo>;
loaded: BehaviorSubject<{
monaco: any;
}>;
loadingTypings: BehaviorSubject<boolean>;
private typingsWorker;
private _monaco;
/**
* Returns the global `monaco` instance
*/
get monaco(): any;
constructor(settings: CodeEditorSettings);
private loadTypingsWorker;
loadTypings(dependencies: string[]): void;
loadEditor(): Promise<void>;
/**
* Switches to a theme.
* @param themeName name of the theme
*/
setTheme(themeName: string): void;
createEditor(containerElement: HTMLElement, options?: editor.IEditorConstructionOptions): editor.ICodeEditor;
createModel(value: string, language?: string, uri?: string): editor.ITextModel;
setModelLanguage(model: editor.ITextModel, mimeTypeOrLanguageId: string): void;
static ɵfac: i0.ɵɵFactoryDeclaration<CodeEditorService, [{ optional: true; }]>;
static ɵprov: i0.ɵɵInjectableDeclaration<CodeEditorService>;
}