Skip to content

Commit fe2442c

Browse files
authored
Merge pull request #1239 from didoda/fix/richeditor
Fix tinymce richeditor unbind
2 parents 44096b8 + ff1e2d4 commit fe2442c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

resources/js/app/directives/richeditor.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ export default {
6767
});
6868
},
6969

70-
unbind() {
71-
tinymce.remove();
70+
unbind(element) {
71+
tinymce.remove(element.editor);
7272
},
7373

7474
/**
@@ -82,8 +82,12 @@ export default {
8282
if (binding?.value?.toolbar) {
8383
toolbar = binding.value.toolbar.join(' ');
8484
} else if (binding?.expression) {
85-
let exp = JSON.parse(binding.expression);
86-
toolbar = exp ? exp.join(' ') : toolbar;
85+
try {
86+
const exp = JSON.parse(binding.expression);
87+
toolbar = exp ? exp.join(' ') : toolbar;
88+
} catch (e) {
89+
// do nothing
90+
}
8791
}
8892
if (!binding.modifiers?.placeholders) {
8993
toolbar = toolbar.replace(/\bplaceholders\b/, '');

0 commit comments

Comments
 (0)