## class: `WyEditorCore`, `wy-editor-core`

Rich text editor used for posts, messages and comments.

**Used sub components:**

*   [`<wy-avatar>`](./ui/wy-avatar)
*   [`<wy-item>`](./ui/wy-item)

### Fields

| Name           | Type                                  | Default   | Description                                                     | Inherited From        |
| -------------- | ------------------------------------- | --------- | --------------------------------------------------------------- | --------------------- |
| `disabled`     | `boolean`                             | `false`   | Whether the editor is disabled.                                 |                       |
| `placeholder`  | `string`                              | `""`      | Placeholder text for the editor input.                          |                       |
| `text`         | `string \| undefined`                 | `""`      | Initial editor text content (draft or loaded content).          |                       |
| `typing`       | `boolean`                             | `true`    | Whether typing indicators should be emitted.                    |                       |
| `editorType`   | `"messages" \| "posts" \| "comments"` | `"posts"` | Editor usage context, used to adjust behavior and styling.      |                       |
| `showTooltips` | `boolean`                             | `false`   |                                                                 |                       |
| `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        |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ---------------------------- | --------------------- |
| `whenEditor` | Resolves when the editor is available.                                                                                                                           |            | `Promise<EditorView>`        |                       |
| `submit`     | Submit the editor content by dispatching a \`submit\` event.&#xA;&#xA;Validates that there is content to submit and that no uploads/embeds are still processing. |            |                              |                       |
| `clear`      | Clear the editor UI and internal state (text, embeds, attachments, metadata).                                                                                    |            |                              |                       |
| `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`     | `EditorSubmitEventType` | Emitted when the editor content is submitted  |                   |
| `edit`       | `EditorEditEventType`   | When an edit of a previous text is requested. |                   |
| `change`     | `EditorChangeEventType` | When the text changes.                        |                   |
| `clear`      | `EditorClearEventType`  | When clearing of the editor is requested.     |                   |
| `drop-files` | `DropFilesEventType`    | When files are pasted into the editor.        |                   |
| `ready`      | `CustomEvent`           | When the component has rendered.              | WeavySubComponent |

### Attributes

| Name          | Field       | Inherited From |
| ------------- | ----------- | -------------- |
| `disabled`    | disabled    |                |
| `placeholder` | placeholder |                |
| `text`        | text        |                |
| `typing`      | typing      |                |
| `editorType`  | editorType  |                |

### CSS Parts

| Name             | Description            |
| ---------------- | ---------------------- |
| `wy-core-editor` | Wrapper for the editor |

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

### Fields

| Name                        | Privacy   | Type                                                                                                                                                                                                          | Default                                                                               | Description | Inherited From        |
| --------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ----------- | --------------------- |
| `#resolveEditor`            | private   | `(editor: EditorView) => void \| undefined`                                                                                                                                                                   |                                                                                       |             |                       |
| `#whenEditor`               | private   |                                                                                                                                                                                                               | `new Promise<EditorView>((r) => { this.#resolveEditor = r; })`                        |             |                       |
| `keymapFacet`               | protected | `Facet<readonly KeyBinding[], readonly (readonly KeyBinding[])[]> \| undefined`                                                                                                                               |                                                                                       |             |                       |
| `keymaps`                   | protected | `{
    weavyEnterSendKeymap: KeyBinding[];
    weavyModifierEnterSendKeymap: KeyBinding[];
    weavyKeymap: KeyBinding[];
    defaultKeymap: KeyBinding[];
    historyKeymap: KeyBinding[];
  } \| undefined` |                                                                                       |             |                       |
| `placeholderExtension`      | protected | `(content: string \| HTMLElement \| ((view: EditorView) => HTMLElement)) => Extension \| undefined`                                                                                                           |                                                                                       |             |                       |
| `editorInitialized`         | protected | `boolean`                                                                                                                                                                                                     | `false`                                                                               |             |                       |
| `tooltipsRef`               | protected | `Ref<HTMLElement>`                                                                                                                                                                                            |                                                                                       |             |                       |
| `#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 |
| ------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------- | --------------- | ---------------------------------- | -------------- |
| `editLast`          | protected |                                                                                                                             |                 |                                    |                |
| `dispatchChange`    | protected |                                                                                                                             | `text: string`  |                                    |                |
| `dispatchFiles`     | protected |                                                                                                                             | `files: File[]` |                                    |                |
| `renderEditorDummy` | protected | Editor loading fallback dummy.&#xA;Hard copy of the rendered nodes when the editor is empty. Cleaned up to not be editable. |                 | `TemplateResult \| typeof nothing` |                |

</details>

<hr/>

## Exports

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