## class: `WyEditorComment`, `wy-editor-comment`

Comment editor used for composing comments.

**Used sub components:**

*   [`<wy-dropdown>`](./ui/wy-dropdown)
*   [`<wy-dropdown-item>`](./ui/wy-dropdown)
*   [`<wy-icon>`](./ui/wy-icon)
*   [`<wy-button>`](./ui/wy-button)

### Fields

| Name             | Type                                         | Default               | Description                                                            | Inherited From        |
| ---------------- | -------------------------------------------- | --------------------- | ---------------------------------------------------------------------- | --------------------- |
| `editorType`     | `"messages" \| "posts" \| "comments"`        | `"comments"`          | Editor usage context, used to adjust behavior and styling.             | WyEditorMsg           |
| `editorClass`    | `string`                                     | `"wy-editor-comment"` | CSS class applied to the editor container.                             | WyEditorMsg           |
| `disabled`       | `boolean`                                    | `false`               | Whether the editor is disabled.                                        | WyEditorMsg           |
| `parentId`       | `number \| undefined`                        |                       | Parent id for context (message/comment/post).                          | WyEditorMsg           |
| `placeholder`    | `string`                                     | `""`                  | Placeholder text for the editor input.                                 | WyEditorMsg           |
| `text`           | `string`                                     | `""`                  | Initial editor text content (draft or loaded content).                 | WyEditorMsg           |
| `metadata`       | `MetadataType \| undefined`                  | `{}`                  | Metadata associated with the editor content (e.g. agent instructions). | WyEditorMsg           |
| `embed`          | `EmbedType \| undefined`                     |                       | Optional single embed to prefill the editor.                           | WyEditorMsg           |
| `pollOptions`    | `PollOptionType[]`                           | `[]`                  | Poll option templates passed to the editor.                            | WyEditorMsg           |
| `attachments`    | `FileType[]`                                 | `[]`                  | Attached file references (ids/resolved) shown in the editor.           | WyEditorMsg           |
| `meeting`        | `MeetingType \| undefined`                   |                       | Meeting object attached to the editor (if any).                        | WyEditorMsg           |
| `buttonText`     | `string`                                     | `""`                  | Text for the submit button.                                            | WyEditorMsg           |
| `typing`         | `boolean`                                    | `true`                | Whether typing indicators should be emitted.                           | WyEditorMsg           |
| `draft`          | `boolean`                                    | `false`               | Whether this instance should persist drafts.                           | WyEditorMsg           |
| `editorLocation` | `"messages" \| "posts" \| "apps" \| "files"` | `"apps"`              | Location context to use for file uploads and embeds.                   | WyEditorMsg           |
| `embeds`         |                                              |                       |                                                                        | WyEditorMsg           |
| `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.                    |            |                              | WyEditorMsg           |
| `setCursorLast`    | Place cursor at the end of the editor content.       |            |                              | WyEditorMsg           |
| `focusInput`       | Focus the editor input.                              |            |                              | WyEditorMsg           |
| `whenEditor`       | Resolves when the editor is available.               |            | `Promise<WyEditorCore>`      | WyEditorMsg           |
| `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     |

### Events

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

### Attributes

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

### CSS Parts

| Name                       | Description                                                               |
| -------------------------- | ------------------------------------------------------------------------- |
| `wy-editor-comment-inputs` | Container for the editor inputs and add menu                              |
| `wy-editor-comment-text`   | Wrapper for the editor text area                                          |
| `wy-is-invalid`            | Applied to the editor text wrapper when there is a validation/error state |
| `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`                      |                                                                                       |                                                                   | WyEditorMsg           |
| `#whenEditor`               | private   |                                                                    | `new Promise<WyEditorCore>((r) => { this.#resolveEditor = r; })`                      |                                                                   | WyEditorMsg           |
| `authWindow`                | protected | `WindowProxy \| null \| undefined`                                 |                                                                                       | Reference to oauth authentication window when attaching meetings. | WyEditorMsg           |
| `#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 |             |            |                                                                            | WyEditorMsg    |
| `editLast`            | protected |             |            |                                                                            | WyEditorMsg    |
| `renderEditor`        | protected |             |            | `(TemplateResult \| typeof nothing)[] \| TemplateResult \| typeof nothing` | WyEditorMsg    |
| `renderTopSlot`       | protected |             |            | `(TemplateResult \| typeof nothing)[] \| TemplateResult \| typeof nothing` | WyEditorMsg    |
| `renderMiddleSlot`    | protected |             |            | `(TemplateResult \| typeof nothing)[] \| TemplateResult \| typeof nothing` | WyEditorMsg    |

</details>

<hr/>

## Exports

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