简体   繁体   中英

Tinymce plugins load from cdn instead of local directory

I have TinceMCE installed for Angular. So when using tiny, I have to do something like the following:

Controller:

vm.tinymceOptions = {
        plugins:'layer image hr imagetools',
        toolbar: 'undo redo | bold italic | alignleft aligncenter alignright | code',
        height:'480'
    };

And in my view:

<form class = "MCEeditor" method="post">
         <textarea ui-tinymce="vm.tinymceOptions" ng-model="vm.tinymceModel"></textarea>
</form>

My problem is that when I try to use an external plugin, a GET request is made to an external CDN instead of my local plugin files. This is the GET request:

Request URL:http://cdn.tinymce.com/4/plugins/ss/plugin.min.js
Request Method:GET

So essentially, I need a way to point that request to my internal TinyMCE plugin directory instead of this CDN.

By default, TinyMCE looks in its own plugins folder for the plugin files so if you are loading TinyMCE from a CDN it will look there.

What you can do is use the external_plugins option in the configuration and point TinyMCE to the exact location of your plugin file:

https://www.tinymce.com/docs/configure/integration-and-setup/#external_plugins

For example:

tinymce.init({
  selector: 'textarea',
  ...
  external_plugins: {
    'testing': 'http://www.testing.com/plugin.min.js',
    'maths': 'http://www.maths.com/plugin.min.js'
  }
});

Since you are using the TinyMCE / Angular plugin this external_plugins code goes in your vm.tinymceOptions object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM