I am experiencing an issue where HTML entities (such as `&` being converted to `&`) are being re-encoded each time the content is edited with the live edit. This issue occurs when a text field is edited and then reloaded. Each time I click into the field to edit, existing entities like `&` are encoded again, resulting in `amp;`, and on subsequent edits, it becomes `&`, leading to unwanted duplication of entity encoding. I've included some screenshots.
Suggested Solution:
The issue may be related to the use of innerHTML when handling content retrieval inside the module. Switching to textContent instead of innerHTML might help resolve the unintended entity encoding, as textContent returns plain text without converting or introducing HTML entities.
For example, the current code in `js/inline-editors/basic.js`:
field.addEventListener('click', () => {
if (!field.hasAttribute('data-me-field-is-editable')) {
const text = field.innerHTML;
field.setAttribute('data-me-field-is-editable', 'true');
makeContentEditable(element, text);
}
});
could be switched to:
field.addEventListener('click', () => {
if (!field.hasAttribute('data-me-field-is-editable')) {
const text = field.textContent;
field.setAttribute('data-me-field-is-editable', 'true');
makeContentEditable(element, text);
}
});
This change could prevent unwanted encoding.