import { nothing, TemplateResult, PropertyValueMap } from 'lit'; import { Ref } from 'lit/directives/ref.js'; import { WeavySubAppComponent } from '../classes/weavy-sub-app-component'; import { ShadowPartsController } from '../controllers/shadow-parts-controller'; import { MetadataType } from '../types/lists.types'; import { FileType } from '../types/files.types'; import { ThemeModeType } from '../types/ui.types'; import { WyEditorCore } from './wy-editor-core'; declare global { interface HTMLElementTagNameMap { "wy-editor-file": WyEditorFile; } } /** * Rich text editor used for posts, messages and comments. * * **Used sub components:** * * - [``](./ui/wy-avatar.ts) * - [``](./ui/wy-dropdown.ts) * - [``](./ui/wy-item.ts) * - [``](./ui/wy-button.ts) * - [``](./ui/wy-icon.ts) * * @csspart wy-editor - Root editor container * @csspart wy-editor-msg-inputs - Container for inputs/buttons * @csspart wy-editor-msg-buttons - Container for action buttons * * @fires {MsgEditorSubmitEventType} submit - Emitted when the editor content is submitted * @fires {CustomEvent} edit-last - Emitted when the last message should be edited. */ export declare class WyEditorFile extends WeavySubAppComponent { #private; static styles: import('lit').CSSResult[]; /** * Controller for exporting named shadow parts. * * @internal */ protected exportParts: ShadowPartsController; /** * Whether the editor is disabled. */ disabled: boolean; /** * Parent id for context (message/comment/post). */ parentId?: number; /** * Placeholder text for the editor input. */ placeholder: string; /** * Initial editor text content (draft or loaded content). */ text: string; /** * The file info if applicable. Required for full functionality. */ file?: FileType; /** * Current file text content (loaded content). */ fileContent?: string; /** * Optionally display the editor as a code editor or as a document layout. */ appearance: "default" | "code" | "document" | "text"; /** Override the theme mode. */ mode: ThemeModeType; /** * Metadata associated with the editor content (e.g. agent instructions). * */ metadata?: MetadataType; /** * Text for the submit button. */ buttonText: string; /** * Whether this instance should persist drafts. */ draft: boolean; /** * Id used for handling drafts. * @internal */ draftKey?: string; /** * Initial draft text. */ draftText?: string; /** * Reactive state for markdown loading. */ get markdownIsLoading(): boolean; /** * Query controller for getting file draft. * @internal */ private draftQuery; /** * Select all content in the editor. */ selectAllContent(): Promise; /** * Place cursor at the end of the editor content. */ setCursorFirst(): Promise; /** * Place cursor at the end of the editor content. */ setCursorLast(): Promise; /** * Focus the editor input. */ focusInput(): Promise; /** * Resolves when the editor is available. * * @returns {Promise} */ whenEditor(): Promise; /** * Whether to show a live markdown preview in an overlay. */ showLive: boolean; /** * Markdown text rendered as a html string. */ liveRender?: Uint8Array | string | null; /** * Reference to the editor DOM node wrapper. * * @internal */ protected editorRef: Ref; /** * Gets the displayed document, including restored drafts and edits not yet saved by the draft throttle. */ getText(): Promise; willUpdate(changedProperties: PropertyValueMap): Promise; /** * Persist draft to storage if draft mode is enabled. * * Saves editor text, embeds, poll options and ongoing file uploads to localStorage. * * @internal */ protected saveDraft(): void; /** * Submit the editor content by dispatching a `submit` event. * * Validates that there is content to submit and that no uploads/embeds are still processing. * * @internal */ protected submit(): void; /** * Reset the editor state after a successful submit. * * Clears editor content, removes pending uploads from the query cache and deletes the stored draft. * * @internal */ protected resetEditor(): void; /** * Clear the editor UI and internal state (text, embeds, attachments, metadata). * * @internal */ protected clearEditor(): void; /** * Checks if the editor has a dirty internal state (text, embeds, attachments, metadata). * * @internal */ protected hasChanged(): boolean; /** * Throttled drafting saver to minimize writes. * * @internal */ private throttledDrafting; /** * Prevents trailing writes from recreating a draft after Publish or Discard removes the editor. */ disconnectedCallback(): void; /** * CodeMirror editor * @internal */ protected get editor(): import('@codemirror/view').EditorView | undefined; protected renderEditor(): (TemplateResult | typeof nothing)[] | TemplateResult | typeof nothing; protected renderLiveView(): import('../../node_modules/lit-html/node/directive.js').DirectiveResult; protected renderTopSlot(): (TemplateResult | typeof nothing)[] | TemplateResult | typeof nothing; protected renderMiddleSlot(): (TemplateResult | typeof nothing)[] | TemplateResult | typeof nothing; /** * Render the bottom slot which aggregates lists (polls, meetings, file uploads, attachments, embeds). * * @internal */ protected renderBottomSlot(): (TemplateResult | typeof nothing)[] | TemplateResult | typeof nothing; /** * Render the lists section (poll options, meetings, file uploads, attachments, embeds). * * @internal */ protected renderLists(): TemplateResult | typeof nothing; protected render(): TemplateResult<1>; updated(changedProperties: PropertyValueMap): void; } //# sourceMappingURL=wy-editor-file.d.ts.map