Skip to content

Commit 51d3675

Browse files
authored
Fix cleaning textarea content after adding another textarea element (#106)
| Q | A | --------------- | ----- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Related tickets | fixes #104 | License | MIT
2 parents 158fabc + 9380fa9 commit 51d3675

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

assets/admin/js/trix/trix-editor.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ document.querySelectorAll('select').forEach(select => {
5151
});
5252
});
5353

54+
document.querySelectorAll('button[data-live-action-param="addCollectionItem"]').forEach(button => {
55+
button.addEventListener('click', (event) => {
56+
document.querySelectorAll('trix-editor').forEach((editor) => {
57+
const innerInput = document.getElementById(editor.attributes.input.value);
58+
59+
editor.innerHTML = innerInput.value;
60+
});
61+
62+
updateToolbars();
63+
});
64+
});
5465

5566
document.addEventListener('trix-blur', (event) => {
5667
const innerInput = document.getElementById(event.target.attributes.input.value);

0 commit comments

Comments
 (0)