From ae3a9f7077bbfeae687ee482ed22ef92d650b01c Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 28 Jul 2023 13:37:41 +0100 Subject: [PATCH] Add hook for removing tinyce instance Fix an issue when using inside a repeater --- resources/dist/js/app.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/resources/dist/js/app.js b/resources/dist/js/app.js index fe58462..5774da3 100644 --- a/resources/dist/js/app.js +++ b/resources/dist/js/app.js @@ -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;