diff --git a/CHANGELOG.md b/CHANGELOG.md index 19f9236..56b3a7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Fixed +- The `id` attribute was not being used as the id for the editor. + ## 2.0.2 - 2023-03-27 ### Fixed diff --git a/src/main/ts/component/Editor.ts b/src/main/ts/component/Editor.ts index 67a37a9..b71060a 100644 --- a/src/main/ts/component/Editor.ts +++ b/src/main/ts/component/Editor.ts @@ -230,6 +230,10 @@ class TinyMceEditor extends HTMLElement { // load const target = document.createElement('textarea'); target.value = this.textContent ?? ''; + const attrId = this.attributes.getNamedItem('id')?.value; + if (attrId) { + target.id = attrId; + } if (this.placeholder !== null) { target.placeholder = this.placeholder; }