partial$module-loading/bundling-ref-example.adoc :!editorcomponent:
|
Note
|
If using {productname} 7.0.1 or earlier, please refer to Bundling {productname} plugins using module loading from the {productname} v6 documentation guide. |
Example syntax for including the example "<plugincode>" plugin in a bundle using `content.js`for bundling:
| Module Syntax | Source | Example |
|---|---|---|
ES6+ |
npm (community plugins) |
import 'tinymce/plugins/<plugincode>'; |
npm (premium plugins) |
import 'tinymce-premium/plugins/<plugincode>'; |
|
|
import '../tinymce/plugins/<plugincode>'; |
|
|
import '../tinymce-premium/plugins/<plugincode>'; |
|
Common JS |
npm (community plugins) |
require('tinymce/plugins/<plugincode>'); |
npm (premium plugins) |
require('tinymce-premium/plugins/<plugincode>'); |
|
|
require('../tinymce/plugins/<plugincode>'); |
|
|
require('../tinymce-premium/plugins/<plugincode>'); |
|
Note
|
When using |
After installing the tinymce-premium package, you need to configure the plugins in your editor. There are two main approaches:
For most modern applications, bundling premium plugins is recommended. This includes the plugin code directly in your application bundle.
-
Import the premium plugins you need:
import 'tinymce-premium/plugins/advcode'; import 'tinymce-premium/plugins/licensekeymanager'; import 'tinymce-premium/plugins/tinycomments';
-
Add the plugins to your editor configuration:
tinymce.init({ selector: 'textarea', license_key: 'T8LK:...', // Your commercial license key plugins: 'advcode tinycomments', // ... other configuration });
For complete bundling examples, see the [Contents] section below.
When bundling is not available or you want to lazy-load plugins, use the external_plugins option:
tinymce.init({
selector: 'textarea',
license_key: 'T8LK:...', // Your commercial license key
external_plugins: {
'advcode': '/node_modules/tinymce-premium/plugins/advcode/plugin.min.js',
'licensekeymanager': '/node_modules/tinymce-premium/plugins/licensekeymanager/plugin.min.js',
'tinycomments': '/node_modules/tinymce-premium/plugins/tinycomments/plugin.min.js'
},
plugins: 'advcode tinycomments',
// ... other configuration
});|
Note
|
The
For more information, see: |
|
Important
|
Always include the |
When bundling:
import 'tinymce-premium/plugins/licensekeymanager';When using external_plugins:
external_plugins: {
'licensekeymanager': '/node_modules/tinymce-premium/plugins/licensekeymanager/plugin.min.js'
}