import { TemplateResult, PropertyValueMap } from 'lit'; import { ShadowPartsController } from '../controllers/shadow-parts-controller'; import { FileType } from '../types/files.types'; import { Ref } from 'lit/directives/ref.js'; import { WyEditorFile } from './wy-editor-file'; import { WeavySubAppComponent } from '../classes/weavy-sub-app-component'; import { DirectiveResult } from 'lit/async-directive.js'; declare global { interface HTMLElementTagNameMap { "wy-file-view-text": WyFileViewText; } } /** * Text / code / HTML preview component used in file previews. * * **Used sub components:** * * - [``](./wy-empty.ts) * - [``](./ui/wy-progress-circular.ts) * - [``](./ui/wy-container.ts) * * @csspart wy-content-progress - Progress indicator shown while loading. * @csspart wy-content-code - Container for rendered code content. * @csspart wy-code - Modifier for code styling. * @csspart wy-document - Document wrapper used for HTML/text rendering. * @csspart wy-content-html - Container for rendered HTML. * @csspart wy-content-text - Container for plain text content. * * @fires {FilePreviewLoadedEventType} file-preview-loaded - The file preview is considered loaded. */ export declare class WyFileViewText extends WeavySubAppComponent { #private; static styles: import('lit').CSSResult[]; protected exportParts: ShadowPartsController; /** * Source file. */ file?: FileType; edit: boolean; /** * Show the unsaved draft instead of the stored content. Ignored while editing, since the editor loads the draft itself. */ draft: boolean; /** * Query controller for the unsaved draft shown when `draft` is set. * @internal */ private draftQuery; display: "text" | "code" | "document"; /** * The unsaved draft rendered as HTML (markdown and highlighted code). Kept apart from the stored HTML so that * switching between the draft and a stored version is just a matter of which one `render()` picks. * @internal */ draftHtml?: string; /** * Id used for handling drafts. * @internal */ draftKey?: string; /** * Cached string content produced by the latest fetch. * * @internal */ text?: string; /** * Cached string content produced by the latest fetch. * * @internal */ fileContent?: string; /** * Content formatted as HTML. * @internal */ html?: string; /** * Loading indicator flag while fetching file content. * * @internal */ loadingText: boolean; /** * Loading indicator flag while fetching preview content. * * @internal */ loadingHtml: boolean; /** * Reference to the content DOM node wrapper. * * @internal */ protected contentRef: Ref; /** * Reference to the editor DOM node wrapper. * * @internal */ protected editorRef: Ref; /** * Identifies the loaded revision and representation independently of mutable query-cache file objects. */ private contentKey?; /** * Prevents an older content response from overwriting a newer revision or representation. */ private contentRequest; /** * Puts focus to the editor if available. */ setFocus(): void; /** * Dispatches the `file-preview-loaded` event when content becomes available. * * @internal * @returns {boolean} `true` if the event was not canceled. */ protected dispatchLoaded(): boolean; /** * Publishes the current text edit, or the unsaved draft when called outside the editor (from the preview menu). */ save(): Promise; /** @internal */ private uploadBlobMutation; /** * Mutation handling rename requests. * @internal */ private updateFileMutation; protected willUpdate(changedProperties: PropertyValueMap): void; /** * Renders the content to show, either the stored file content or the unsaved draft. * * @param content - Raw text, shown as is for plain text and while a markdown draft is being rendered. * @param contentHtml - Rendered HTML, used for documents and server-highlighted code. * @param isDraft - Whether the content is the unsaved draft rather than stored content. */ protected renderText(content?: string, contentHtml?: string, isDraft?: boolean): TemplateResult | DirectiveResult | string; render(): TemplateResult<1>; updated(changedProperties: PropertyValueMap): void; } //# sourceMappingURL=wy-file-view-text.d.ts.map