Options
All
  • Public
  • Public/Protected
  • All
Menu

@saber2pr/monaco

Index

Type aliases

CompilerOptions

CompilerOptions: Parameters<IMonaco["languages"]["typescript"]["typescriptDefaults"]["setCompilerOptions"]>[0]

DiffEditorAPI

DiffEditorAPI: PromiseType<ReturnType<typeof createDiffEditor>>

EditorAPI

EditorAPI: PromiseType<ReturnType<typeof createEditor>>

EditorOptions

EditorOptions: Parameters<IMonaco["editor"]["create"]>[1]

FileInfo

FileInfo: { content: string; name: string; type: string }

Type declaration

  • content: string
  • name: string
  • type: string

ICodeEditorViewState

ICodeEditorViewState: ReturnType<IStandaloneCodeEditor["saveViewState"]>

IMonaco

IMonaco: Monaco

IStandaloneCodeEditor

IStandaloneCodeEditor: ReturnType<IMonaco["editor"]["create"]>

ITextModel

ITextModel: ReturnType<IMonaco["editor"]["createModel"]>

PromiseType

PromiseType<T>: T extends Promise<infer P> ? P : never

Type parameters

  • T

ThemeNames

ThemeNames: "active4d" | "all-hallows-eve" | "amy" | "birds-of-paradise" | "blackboard" | "brilliance-black" | "brilliance-dull" | "chrome-devtools" | "clouds-midnight" | "clouds" | "cobalt" | "cobalt2" | "dawn" | "dracula" | "dreamweaver" | "eiffel" | "espresso-libre" | "github" | "idle" | "katzenmilch" | "kuroir-theme" | "lazy" | "magicwb--amiga-" | "merbivore-soft" | "merbivore" | "monokai-bright" | "monokai" | "night-owl" | "oceanic-next" | "pastels-on-dark" | "slush-and-poppies" | "solarized-dark" | "solarized-light" | "spacecadet" | "sunburst" | "textmate--mac-classic-" | "tomorrow-night-blue" | "tomorrow-night-bright" | "tomorrow-night-eighties" | "tomorrow-night" | "tomorrow" | "twilight" | "upstream-sunburst" | "vibrant-ink" | "xcode-default" | "zenburnesque" | "iplastic" | "idlefingers" | "krtheme" | "monoindustrial"

Variables

Const DiffEditor

DiffEditor: React.FC<DiffEditorProps> = ...

Const Editor

Editor: ForwardRefExoticComponent<EditorProps & RefAttributes<{ addExtraLib: (content: string, filePath?: string) => IDisposable; addModuleDeclaration: (url: string, moduleName?: string) => Promise<any>; changeModel: (fileName: string) => void; compileTS: (uri?: Uri) => Promise<{ diagnostics: Diagnostic[]; output: string }>; getData: () => EditorData; getInstance: () => IStandaloneCodeEditor; getMarkers: (fileName?: string) => IMarker[]; getModel: (fileName?: string) => ITextModel; getNavigationBarItems: (uri?: Uri) => Promise<NavigationBarItem[]>; getOutput: (fileName?: string) => Promise<{ diagnostics: Diagnostic[]; markers: IMarker[]; output: string }>; getSize: () => EditorLayoutInfo; getState: (fileName: string) => ICodeEditorViewState; getThemeConfig: (themeFile: string) => Promise<any>; getThemeList: () => Promise<any>; getTypescriptDefaults: () => LanguageServiceDefaults; getValue: (fileName?: string) => string; hasTheme: (theme: string) => any; monaco: __module; setSize: (width: number, height: number) => void; setState: (fileName: string, state: any) => void; setTheme: (themeName: ThemeNames) => Promise<void>; setValue: (value: string, fileName?: string) => void; updateCompilerOptions: (options: CompilerOptions) => void }>> = ...

Const ThemesUri

ThemesUri: "https://cdn.jsdelivr.net/npm/monaco-themes/themes/" = 'https://cdn.jsdelivr.net/npm/monaco-themes/themes/'

Const commonOptions

commonOptions: { tabSize: number } = ...

Type declaration

  • tabSize: number

Functions

Const addDragListener

  • addDragListener(target: HTMLElement, callback: (event: MouseEvent) => void, onDragStart?: (event: MouseEvent) => void, onDragEnd?: (event: MouseEvent) => void): void
  • Parameters

    • target: HTMLElement
    • callback: (event: MouseEvent) => void
        • (event: MouseEvent): void
        • Parameters

          • event: MouseEvent

          Returns void

    • Optional onDragStart: (event: MouseEvent) => void
        • (event: MouseEvent): void
        • Parameters

          • event: MouseEvent

          Returns void

    • Optional onDragEnd: (event: MouseEvent) => void
        • (event: MouseEvent): void
        • Parameters

          • event: MouseEvent

          Returns void

    Returns void

Const addExtraLib

  • addExtraLib(monaco: __module, content: string, filePath?: string): IDisposable
  • Parameters

    • monaco: __module
    • content: string
    • Optional filePath: string

    Returns IDisposable

Const addModuleDeclaration

  • addModuleDeclaration(monaco: __module, url: string, moduleName?: string, isGlobal?: boolean): Promise<any>
  • Parameters

    • monaco: __module
    • url: string
    • Optional moduleName: string
    • Optional isGlobal: boolean

    Returns Promise<any>

Const addUploadListener

  • addUploadListener(callback: (res: FileInfo) => void): void

Const compileTS

  • compileTS(monaco: __module, uri: Uri): Promise<{ diagnostics: Diagnostic[]; output: string }>
  • Parameters

    • monaco: __module
    • uri: Uri

    Returns Promise<{ diagnostics: Diagnostic[]; output: string }>

createDiffEditor

  • createDiffEditor(container: HTMLElement, original: string, modified: string, language?: string, loaderConfig?: Parameters<typeof loader.config>[0]): Promise<{ instance: IStandaloneDiffEditor; modifiedModel: ITextModel; monaco: __module; originalModel: ITextModel; setSize: (width: number, height: number) => void }>
  • Parameters

    • container: HTMLElement
    • original: string
    • modified: string
    • language: string = 'text/plain'
    • Optional loaderConfig: Parameters<typeof loader.config>[0]

    Returns Promise<{ instance: IStandaloneDiffEditor; modifiedModel: ITextModel; monaco: __module; originalModel: ITextModel; setSize: (width: number, height: number) => void }>

createEditor

  • createEditor(editorContainer: HTMLElement, modalFiles: ModalFiles, options?: EditorOptions, loaderConfig?: Parameters<typeof loader.config>[0]): Promise<{ addExtraLib: (content: string, filePath?: string) => IDisposable; addModuleDeclaration: (url: string, moduleName?: string) => Promise<any>; changeModel: (fileName: string) => void; compileTS: (uri?: Uri) => Promise<{ diagnostics: Diagnostic[]; output: string }>; getData: () => EditorData; getInstance: () => IStandaloneCodeEditor; getMarkers: (fileName?: string) => IMarker[]; getModel: (fileName?: string) => ITextModel; getNavigationBarItems: (uri?: Uri) => Promise<NavigationBarItem[]>; getOutput: (fileName?: string) => Promise<{ diagnostics: Diagnostic[]; markers: IMarker[]; output: string }>; getSize: () => EditorLayoutInfo; getState: (fileName: string) => ICodeEditorViewState; getThemeConfig: (themeFile: string) => Promise<any>; getThemeList: () => Promise<any>; getTypescriptDefaults: () => LanguageServiceDefaults; getValue: (fileName?: string) => string; hasTheme: (theme: string) => any; monaco: __module; setSize: (width: number, height: number) => void; setState: (fileName: string, state: any) => void; setTheme: (themeName: ThemeNames) => Promise<void>; setValue: (value: string, fileName?: string) => void; updateCompilerOptions: (options: CompilerOptions) => void }>
  • Parameters

    • editorContainer: HTMLElement
    • modalFiles: ModalFiles
    • options: EditorOptions = {}
    • Optional loaderConfig: Parameters<typeof loader.config>[0]

    Returns Promise<{ addExtraLib: (content: string, filePath?: string) => IDisposable; addModuleDeclaration: (url: string, moduleName?: string) => Promise<any>; changeModel: (fileName: string) => void; compileTS: (uri?: Uri) => Promise<{ diagnostics: Diagnostic[]; output: string }>; getData: () => EditorData; getInstance: () => IStandaloneCodeEditor; getMarkers: (fileName?: string) => IMarker[]; getModel: (fileName?: string) => ITextModel; getNavigationBarItems: (uri?: Uri) => Promise<NavigationBarItem[]>; getOutput: (fileName?: string) => Promise<{ diagnostics: Diagnostic[]; markers: IMarker[]; output: string }>; getSize: () => EditorLayoutInfo; getState: (fileName: string) => ICodeEditorViewState; getThemeConfig: (themeFile: string) => Promise<any>; getThemeList: () => Promise<any>; getTypescriptDefaults: () => LanguageServiceDefaults; getValue: (fileName?: string) => string; hasTheme: (theme: string) => any; monaco: __module; setSize: (width: number, height: number) => void; setState: (fileName: string, state: any) => void; setTheme: (themeName: ThemeNames) => Promise<void>; setValue: (value: string, fileName?: string) => void; updateCompilerOptions: (options: CompilerOptions) => void }>

Const debounce

  • debounce(callback: Function, delta?: number, id?: string): void
  • Parameters

    • callback: Function
    • delta: number = 500
    • id: string = 'default'

    Returns void

Const enClosure

  • enClosure(code: string): string

Const getNavigationBarItems

  • getNavigationBarItems(monaco: __module, uri: Uri): Promise<NavigationBarItem[]>

getReferencePaths

  • getReferencePaths(input: string): any[]

Const getTsCompilerOptions

  • getTsCompilerOptions(monaco: __module): { allowJs: boolean; allowSyntheticDefaultImports: boolean; downlevelIteration: boolean; emitDecoratorMetadata: boolean; esModuleInterop: boolean; experimentalDecorators: boolean; jsx: JsxEmit; lib: string[]; module: ModuleKind; removeComments: boolean; target: ScriptTarget }
  • Parameters

    • monaco: __module

    Returns { allowJs: boolean; allowSyntheticDefaultImports: boolean; downlevelIteration: boolean; emitDecoratorMetadata: boolean; esModuleInterop: boolean; experimentalDecorators: boolean; jsx: JsxEmit; lib: string[]; module: ModuleKind; removeComments: boolean; target: ScriptTarget }

    • allowJs: boolean
    • allowSyntheticDefaultImports: boolean
    • downlevelIteration: boolean
    • emitDecoratorMetadata: boolean
    • esModuleInterop: boolean
    • experimentalDecorators: boolean
    • jsx: JsxEmit
    • lib: string[]
    • module: ModuleKind
    • removeComments: boolean
    • target: ScriptTarget

Const getTypescriptDefaults

  • getTypescriptDefaults(monaco: __module): LanguageServiceDefaults

Const initKeyBoard

  • initKeyBoard(__namedParameters: { onSave: Function }): void
  • Parameters

    • __namedParameters: { onSave: Function }
      • onSave: Function

    Returns void

Const loadMonaco

  • loadMonaco(): Promise<__module>

Const makeSandCode

Const readFile

  • readFile(file: File): Promise<FileInfo>

resolvePath

  • resolvePath(base: string, relative: string): string

Const updateCompilerOptions

  • updateCompilerOptions(monaco: __module, options: CompilerOptions): void

Generated using TypeDoc