question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can I add Custom Plugin to tinymce.v4

See original GitHub issue

I am using tinymce version4 with vue js , after i follow tinymce official documentations and implementd in my project i get error field to load "../plugins/example/plugin.js"

so here is my code

<template>
    <div class="container">
        <h2 class="">Tinymce-Vue</h2>
        <editor id="app-editor" 
                api-key="jh5j9j89wyv5mbctvucc67e0o5ba3q7v4xkldjfoaqv74glt" 
                :init="inital" 
                v-model="content">
        </editor>
    </div>
</template>

<script>
import editor from '@tinymce/tinymce-vue';
import tinymceConfig from './config/tinymce';

export default {
    data(){
        return {
            content: '',
        }
    },
    components: {
        editor
    },
    computed: {
        inital(){
            return tinymceConfig.config;
        }
    }
}
</script>

and config.js file look like so …

const config = {
    select: "#app-editor",
    plugins:"wordcount  example",
    toolbar1: "wordcount |  example",
    external_plugins: {
        example: "../plugins/example/plugin.js",
    },
}

export default {config};

and plugin.js file also look like so :

tinymce.create('tinymce.plugins.
   init: function(editor, url) {
            editor.addButton( 'example', {
    text: 'example',
    icon: false,
    type: 'menubutton',
    menu: [
          {
           text: 'Menu 1',
           onclick:function() {
                 alert("I am Menu 1);
               }
           },
          {
           text: 'Menu 2',
           onclick:  function() {
                  alert("I am Menu 2);
               }
          }
          ]
 });
   },
      
   createControl: function() {
          return null
   },
      
tinymce.PluginManager.add('example', tinymce.plugins.example)

so how to fix it…

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
OmdaMukhtarcommented, Sep 3, 2019

Thank you very much @lnewson to help me understand this issue as I expected.

1reaction
lnewsoncommented, Sep 2, 2019

@OmdaMukhtar the docs for external plugins is here: https://www.tiny.cloud/docs-4x/configure/integration-and-setup/#external_plugins The purpose of it is when you want to load a plugin that’s outside the normal plugins directory or when it isn’t bundled as part of your application. Custom plugins generally fall into this category, which is why you’ve probably seen it suggested before.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create a plugin for TinyMCE
Register a custom plugin with TinyMCE using the PluginManager. PluginManager.add() takes a string for the plugin identifier and a function that contains the ......
Read more >
Create a Plugin for TinyMCE
To create a plugin, you need to create a directory in the TinyMCE plugins directory. TinyMCE will load the plugin.js file if you...
Read more >
Creating a plugin - TinyMCE
There is an example plugin that is made to be easy to modify and has the basic things you need for a custom...
Read more >
tinymce.Plugin | Docs
This is a pseudo class that describes how to create a custom plugin for TinyMCE. A custom plugin registered using PluginManager.add should either...
Read more >
Create a plugin for a text editor - TinyMCE
How to implement your TinyMCE plug-in · Download TinyMCE · Set up the website · Create a plug-in · Add the plug-in to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found