import { EventEmitter, InjectionToken, ViewContainerRef } from '@angular/core'; import { ThemeService, DialogService, LazyLoaderService, CommandPaletteService } from '@dotglitch/ngx-common'; import { MermaidConfig } from 'mermaid'; import { ToolbarComponent } from './components/toolbar/toolbar.component'; import { Editor } from './editor'; import { MatDialog } from '@angular/material/dialog'; import { DomSanitizer } from '@angular/platform-browser'; import * as i0 from "@angular/core"; type StackEditConfig = Partial<{ /** * Mermaid chart configuration */ mermaid: MermaidConfig; /** * Set to `true` to disable loading Mermaid. * Will automatically reduce bundle */ disableMermaid: boolean; /** * Markdown-it configuration */ markdownIt: { "emoji": boolean; "emojiShortcuts": boolean; "abc": boolean; "math": boolean; "abbr": boolean; "breaks": boolean; "deflist": boolean; "del": boolean; "fence": boolean; "footnote": boolean; "imgsize": boolean; "linkify": boolean; "mark": boolean; "sub": boolean; "sup": boolean; "table": boolean; "tasklist": boolean; "typographer": boolean; }; /** * */ emojiConfig: {}; /** * */ disableEmoji: boolean; }>; type Hook = ({ /** * Runs immediately before a chunk of markdown is rendered. Output will be sanitized by Angular's sanitizer. */ kind: "beforeRender"; fn: (markdown: string) => string; }) & { options: Object; }; export declare const NGX_STACKEDIT_CONFIG: InjectionToken>; export declare class StackEditorComponent { private readonly viewContainer; private readonly lazyLoader; private readonly commandPalette; readonly themeService: ThemeService; readonly dialog: DialogService; readonly matDialog: MatDialog; readonly sanitizer: DomSanitizer; private config; toolbar: ToolbarComponent; get $el(): HTMLElement; /** * Dictates the theme of the editor. */ theme: "light" | "dark"; /** * What mode should the editor be in. * - Possible values are `edit` | `view` | `viewonly` * - Default `edit` * view mode **disables** the editor view & toolbar. */ mode: "edit" | "view" | "viewonly"; /** * Should the table of contents be viewable? * `true` shown by default * `false` hidden by default * `"off"` disable the TOC altogether * * Default `false` */ showToc: boolean | "off"; /** * Controls whether the preview is open on initialization * `true` visible * `false` hidden * `"off"` disabled * Default `true` */ showPreview: boolean | "off"; /** * Controls whether a "run" button is shown for applicable * code blocks in the editor view. */ showCodeRunButton: boolean; /** * Control the execution runtime for code blocks. * > only valid for `showCodeRunButton` = true. * - If set to `eval`, only javascript code blocks will have a run button * - If set to `piston`, a HTTP request will be made to check the * available runtimes * - If set to `custom`, you need to define the runnable languages in * `customCodeLanguages` and hook onto `onCustomCodeExecute`. */ codeRunner: "piston" | "eval" | "custom"; /** * If `codeRunner` is set to true */ customCodeLanguages: string[]; /** * Controls whether a "copy" button is shown for applicable * code blocks in the editor view. */ showCodeCopyButton: boolean; /** * Controls whether the mermaid insert button is visible * `true` visible * `false` hidden * Default `true` */ showMermaid: boolean; showLineNumbers: boolean; allowImageUpload: boolean; tabSize: number; tabChar: ' ' | '\t'; /** * ! WIP -- this feature is not supported * Hide punctuation markings in the editor * * This requires improved editor table, mermaid, * and code block rendering */ hideWritingSymbols: boolean; /** * Event hooks that may be provided to perform mutations */ hooks: Hook[]; private _value; /** * Initial value of the editor. * 2-way binding capable. */ set value(value: string); get value(): string; /** * Emits when the value of the editor changed. * Can be used standalone or in 2-way binding. */ valueChange: EventEmitter; /** * Emits when a file is pasted and needs to be uploaded. */ onFileUpload: EventEmitter; /** * Emits when the user uploads an image via file upload. */ onImageUpload: EventEmitter; /** * */ onCustomCodeExecute: EventEmitter<{ content: string; language: string; }>; editorSvc: Editor; options: StackEditConfig; private resizeChecker; private width; private height; private subscriptions; private keyCommands; constructor(viewContainer: ViewContainerRef, lazyLoader: LazyLoaderService, commandPalette: CommandPaletteService, themeService: ThemeService, dialog: DialogService, matDialog: MatDialog, sanitizer: DomSanitizer, config?: StackEditConfig); ngOnChanges(): void; ngAfterViewInit(): Promise; ngOnDestroy(): void; finalizeImageUpload({ label, link }: { label: any; link: any; }): void; private triggerResize; toggleEditor(): void; onPointerDown(e: PointerEvent): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } export declare const renderMarkdown: (input: string) => void; export {}; //# sourceMappingURL=editor.component.d.ts.map