Skip to content

Commit

Permalink
Add hook for removing tinyce instance
Browse files Browse the repository at this point in the history
Fix an issue when using inside a repeater
  • Loading branch information
howdu authored Jul 28, 2023
1 parent faf3bf4 commit ae3a9f7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions resources/dist/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ document.addEventListener('DOMContentLoaded', function () {
'filament-forms-repeater-component',
];

Livewire.hook('element.removed', (el, component) => {
if (el && el.getAttribute('x-ref') === 'tinymce') {
tinymce.execCommand('mceRemoveEditor', false, el.id)
window.tinySettingsCopy = window.tinySettingsCopy.filter(tinySetting => tinySetting.id !== el.id);
}
});

Livewire.hook('element.updated', (el) => {
if (!window.tinySettingsCopy) {
return;
Expand Down

0 comments on commit ae3a9f7

Please # to comment.