## class: `WyEditorMsg`, `wy-editor-msg`

Rich text editor used for posts, messages and comments.

**Used sub components:**

*   [`<wy-avatar>`](./ui/wy-avatar)
*   [`<wy-dropdown>`](./ui/wy-dropdown)
*   [`<wy-item>`](./ui/wy-item)
*   [`<wy-button>`](./ui/wy-button)
*   [`<wy-icon>`](./ui/wy-icon)
*   [`<wy-file-item>`](./wy-file-item)
*   [`<wy-embed>`](./wy-embed)
*   [`<wy-cloud-files>`](./wy-cloud-files)
*   [`<wy-embed-select>`](./wy-embed)

### Fields

| Name             | Type                                         | Default           | Description                                                            | Inherited From        |
| ---------------- | -------------------------------------------- | ----------------- | ---------------------------------------------------------------------- | --------------------- |
| `disabled`       | `boolean`                                    | `false`           | Whether the editor is disabled.                                        |                       |
| `parentId`       | `number \| undefined`                        |                   | Parent id for context (message/comment/post).                          |                       |
| `placeholder`    | `string`                                     | `""`              | Placeholder text for the editor input.                                 |                       |
| `text`           | `string`                                     | `""`              | Initial editor text content (draft or loaded content).                 |                       |
| `metadata`       | `MetadataType \| undefined`                  | `{}`              | Metadata associated with the editor content (e.g. agent instructions). |                       |
| `embed`          | `EmbedType \| undefined`                     |                   | Optional single embed to prefill the editor.                           |                       |
| `pollOptions`    | `PollOptionType[]`                           | `[]`              | Poll option templates passed to the editor.                            |                       |
| `attachments`    | `FileType[]`                                 | `[]`              | Attached file references (ids/resolved) shown in the editor.           |                       |
| `meeting`        | `MeetingType \| undefined`                   |                   | Meeting object attached to the editor (if any).                        |                       |
| `buttonText`     | `string`                                     | `""`              | Text for the submit button.                                            |                       |
| `typing`         | `boolean`                                    | `true`            | Whether typing indicators should be emitted.                           |                       |
| `draft`          | `boolean`                                    | `false`           | Whether this instance should persist drafts.                           |                       |
| `editorType`     | `"messages" \| "posts" \| "comments"`        | `"posts"`         | Editor usage context, used to adjust behavior and styling.             |                       |
| `editorClass`    | `string`                                     | `"wy-editor-msg"` | CSS class applied to the editor container.                             |                       |
| `editorLocation` | `"messages" \| "posts" \| "apps" \| "files"` | `"apps"`          | Location context to use for file uploads and embeds.                   |                       |
| `embeds`         |                                              |                   |                                                                        |                       |
| `app`            | `AppType \| undefined`                       |                   | The app data.                                                          | WeavySubAppComponent  |
| `apps`           | `AppListType \| undefined`                   |                   | Multiple apps data.                                                    | WeavySubAppComponent  |
| `link`           | `LinkType \| undefined`                      |                   | Any provided link that should be loaded, shown and highlighted.        | WeavySubTypeComponent |

### Methods

| Name               | Description                                          | Parameters                        | Return                       | Inherited From        |
| ------------------ | ---------------------------------------------------- | --------------------------------- | ---------------------------- | --------------------- |
| `selectAllContent` | Select all content in the editor.                    |                                   |                              |                       |
| `setCursorLast`    | Place cursor at the end of the editor content.       |                                   |                              |                       |
| `focusInput`       | Focus the editor input.                              |                                   |                              |                       |
| `whenEditor`       | Resolves when the editor is available.               |                                   | `Promise<WyEditorCore>`      |                       |
| `whenApp`          | Resolves when app data is available.                 |                                   | `Promise<AppType>`           | WeavySubAppComponent  |
| `whenApps`         | Resolves when multiple app data is available.        |                                   | `Promise<AppListType>`       | WeavySubAppComponent  |
| `whenLink`         | Resolves when a provided link is available.          |                                   | `Promise<LinkType>`          | WeavySubTypeComponent |
| `whenReady`        | Resolves when the component has rendered first time. |                                   | `Promise<WeavySubComponent>` | WeavySubComponent     |
| `dispatchAction`   | Dispatch a \`wy-action\` event on the component.     | `detail: WyActionEventDetailType` | `boolean`                    | WeavySubComponent     |

### Events

| Name        | Type                       | Description                                     | Inherited From    |
| ----------- | -------------------------- | ----------------------------------------------- | ----------------- |
| `submit`    | `MsgEditorSubmitEventType` | Emitted when the editor content is submitted    |                   |
| `edit-last` | `CustomEvent`              | Emitted when the last message should be edited. |                   |
| `ready`     | `CustomEvent`              | When the component has rendered.                | WeavySubComponent |

### Attributes

| Name             | Field          | Inherited From |
| ---------------- | -------------- | -------------- |
| `disabled`       | disabled       |                |
| `placeholder`    | placeholder    |                |
| `text`           | text           |                |
| `metadata`       | metadata       |                |
| `buttonText`     | buttonText     |                |
| `typing`         | typing         |                |
| `draft`          | draft          |                |
| `editorType`     | editorType     |                |
| `editorClass`    | editorClass    |                |
| `editorLocation` | editorLocation |                |

### CSS Parts

| Name                    | Description                                 |
| ----------------------- | ------------------------------------------- |
| `wy-editor`             | Root editor container                       |
| `wy-dragging`           | Applied when dragging files over the editor |
| `wy-editor-msg-inputs`  | Container for inputs/buttons                |
| `wy-editor-msg-buttons` | Container for action buttons                |
| `wy-poll-form`          | Poll options container                      |
| `wy-input`              | Inputs inside poll options                  |

<details><summary>Private API</summary>

### Fields

| Name                        | Privacy   | Type                                                               | Default                                                                               | Description                                                       | Inherited From        |
| --------------------------- | --------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | --------------------- |
| `#resolveEditor`            | private   | `(editor: WyEditorCore) => void \| undefined`                      |                                                                                       |                                                                   |                       |
| `#whenEditor`               | private   |                                                                    | `new Promise<WyEditorCore>((r) => { this.#resolveEditor = r; })`                      |                                                                   |                       |
| `authWindow`                | protected | `WindowProxy \| null \| undefined`                                 |                                                                                       | Reference to oauth authentication window when attaching meetings. |                       |
| `#resolveApp`               | private   | `(app: AppType) => void \| undefined`                              |                                                                                       |                                                                   | WeavySubAppComponent  |
| `#whenApp`                  | private   |                                                                    | `new Promise<AppType>((r) => { this.#resolveApp = r; })`                              |                                                                   | WeavySubAppComponent  |
| `#resolveApps`              | private   | `(apps: AppListType) => void \| undefined`                         |                                                                                       |                                                                   | WeavySubAppComponent  |
| `#whenApps`                 | private   |                                                                    | `new Promise<AppListType>((r) => { this.#resolveApps = r; })`                         |                                                                   | WeavySubAppComponent  |
| `#resolveContextDataBlobs`  | private   | `(blobs: ContextDataBlobsType) => void \| undefined`               |                                                                                       |                                                                   | WeavySubTypeComponent |
| `#whenContextDataBlobs`     | private   |                                                                    | `new Promise<ContextDataBlobsType>((r) => { this.#resolveContextDataBlobs = r; })`    |                                                                   | WeavySubTypeComponent |
| `#resolveComponentFeatures` | private   | `(componentFeatures: ComponentFeaturePolicy) => void \| undefined` |                                                                                       |                                                                   | WeavySubTypeComponent |
| `#whenComponentFeatures`    | private   |                                                                    | `new Promise<ComponentFeaturePolicy>((r) => { this.#resolveComponentFeatures = r; })` |                                                                   | WeavySubTypeComponent |
| `#resolveLink`              | private   | `(link: LinkType) => void \| undefined`                            |                                                                                       |                                                                   | WeavySubTypeComponent |
| `#whenLink`                 | private   |                                                                    | `new Promise<LinkType>((r) => { this.#resolveLink = r; })`                            |                                                                   | WeavySubTypeComponent |
| `#resolveSettings`          | private   | `(settings: WeavyComponentSettingsType) => void \| undefined`      |                                                                                       |                                                                   | WeavySubTypeComponent |
| `#whenSettings`             | private   |                                                                    | `new Promise<WeavyComponentSettingsType>((r) => { this.#resolveSettings = r; })`      |                                                                   | WeavySubTypeComponent |
| `#resolveContextId`         | private   | `(contextId: ContextIdType) => void \| undefined`                  |                                                                                       |                                                                   | WeavySubComponent     |
| `#whenContextId`            | private   |                                                                    | `new Promise<ContextIdType>((r) => { this.#resolveContextId = r; })`                  |                                                                   | WeavySubComponent     |
| `#resolveUser`              | private   | `(user: UserType) => void \| undefined`                            |                                                                                       |                                                                   | WeavySubComponent     |
| `#whenUser`                 | private   |                                                                    | `new Promise<UserType>((r) => { this.#resolveUser = r; })`                            |                                                                   | WeavySubComponent     |
| `#resolveWeavy`             | private   | `(weavy: WeavyType) => void \| undefined`                          |                                                                                       |                                                                   | WeavySubComponent     |
| `#whenWeavy`                | private   |                                                                    | `new Promise<WeavyType>((r) => { this.#resolveWeavy = r; })`                          |                                                                   | WeavySubComponent     |
| `#resolveReady`             | private   | `(component: WeavySubComponent) => void \| undefined`              |                                                                                       |                                                                   | WeavySubComponent     |
| `#whenReady`                | private   |                                                                    | `new Promise<WeavySubComponent>((r) => { this.#resolveReady = r; })`                  |                                                                   | WeavySubComponent     |

### Methods

| Name                  | Privacy   | Description | Parameters | Return                                                                     | Inherited From |
| --------------------- | --------- | ----------- | ---------- | -------------------------------------------------------------------------- | -------------- |
| `handleRemoveMeeting` | protected |             |            |                                                                            |                |
| `editLast`            | protected |             |            |                                                                            |                |
| `renderEditor`        | protected |             |            | `(TemplateResult \| typeof nothing)[] \| TemplateResult \| typeof nothing` |                |
| `renderTopSlot`       | protected |             |            | `(TemplateResult \| typeof nothing)[] \| TemplateResult \| typeof nothing` |                |
| `renderMiddleSlot`    | protected |             |            | `(TemplateResult \| typeof nothing)[] \| TemplateResult \| typeof nothing` |                |

</details>

<hr/>

## Exports

| Kind                        | Name            | Declaration | Module                          | Package |
| --------------------------- | --------------- | ----------- | ------------------------------- | ------- |
| `js`                        | `WyEditorMsg`   | WyEditorMsg | lib/components/wy-editor-msg.ts |         |
| `custom-element-definition` | `wy-editor-msg` | WyEditorMsg | lib/components/wy-editor-msg.ts |         |
