I have a Nuxt3 app with TinyMCE for which I already created a standalone plugin for inserting LaTeX that works (latex.min.js).
Is it possible to create a TinyMCE plugin that interacts with my web app instead of being a standalone package in the public folder? Specifically, I want to create a glossary plugin that inserts words from a list in my app.
I am trying to insert my latex plugin through Vue as a test by following this blog post (outdated?) but it doesn't work. I used window.tinymce.PluginManager.add() but nothing shows up and I don't get any warning or error.
I need interactivity between my web app and the plugin
Here is my code:
<template>
[...]
<tinymce-editor
api-key="someKey"
v-model="tinycontent"
:init="tinyconfig"
/>
[...]
</template>
<script>
import Editor from "@tinymce/tinymce-vue";
export default {
components: {
"tinymce-editor": Editor,
},
data() {
return {
tinycontent: '',
tinyconfig: {
toolbar: "bold italic underline code | latex",
plugins: "lists link image table code help wordcount",
selector: "textarea",
content_css:
"https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css",
setup: () => {
window.tinymce.PluginManager.add("latex", latex);
},
},
};
},
computed: {},
methods: {},
mounted() {},
};
</script>

Solution:
I finally found out how to add my plugin using the TinyMCE API. The value of
tinyconfigin my question is almost good. I needed to add-latexto the plugins:I also needed to load the tinyMCE script in
<head>through mynuxt.config.ts. Not my preferred way of doing this, but according to tinyMCE doc I need to reference the node_modules tinyMCE folder. I went for a quick solution to test and simply copied the whole folder topublic/(If anyone has a better solution, let me know)I removed the
window.from setup to directly reference the tinyMCE script from<head>:Also, a bit of information missing from my question is that the latex object in
PluginManager.add("latex", latex);is my plugin from a js script in composablesI also moved my TinyMCE config to
tinymce.config.tsat the root of the project to keep the code cleaner.Result
/pages/index.vue:
/tinymce.config.ts:
/composables/latex.ts
/nuxt.config.ts: