Skip to content

Commit 43b3903

Browse files
committed
DOC-3329: Add mention of lazy loading extra resources, and how to handle language pack imports per plugin.
1 parent f11e533 commit 43b3903

File tree

4 files changed

+53
-5
lines changed

4 files changed

+53
-5
lines changed

modules/ROOT/pages/bundling-icons.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ import 'tinymce-premium/icons/material';
8888
----
8989
* After bundling, set `+icons: 'material'+` (or any imported icon pack) in the editor configuration.
9090

91+
=== Non-bundling methods
92+
9193
*Non-bundling with file layering*
9294

9395
* When hosting directly from `+node_modules+`, copy `+node_modules/tinymce-premium/icons/+` into `+node_modules/tinymce/icons/+` as part of the build or deployment step (for example, in a `+postinstall+` script).

modules/ROOT/pages/bundling-plugins.adoc

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,55 @@ For more information, see: xref:editor-important-options.adoc#external_plugins[`
174174

175175
include::partial$module-loading/bundling-plugin-files.adoc[]
176176

177+
[[plugin-language-files-bundling]]
178+
=== Bundling plugin language files
179+
180+
Plugin language files are separate from the main {productname} UI language files. Each plugin has its own language files located in `+plugins/<plugincode>/langs/+`.
181+
182+
* **Core UI language files**: Located in `+langs/+` (e.g., `+tinymce-premium/langs/ar.js+`)
183+
* **Premium plugin language files**: Located in `+plugins/<plugincode>/langs/+` (e.g., `+tinymce-premium/plugins/advcode/langs/ar.js+`)
184+
185+
To bundle premium plugin language files, import them using the same module syntax as bundling plugins, but append `+/langs/<language>.js+` to the import path:
186+
187+
[source, js]
188+
----
189+
// Import the plugin
190+
import 'tinymce-premium/plugins/advcode';
191+
// Import the premium plugin's Arabic language file
192+
import 'tinymce-premium/plugins/advcode/langs/ar.js';
193+
// Import the main UI Arabic language file (if needed)
194+
import 'tinymce-premium/langs/ar.js';
195+
196+
tinymce.init({
197+
selector: 'textarea',
198+
language: 'ar',
199+
plugins: 'advcode',
200+
// ... other configuration
201+
});
202+
----
203+
204+
[NOTE]
205+
====
206+
For premium plugins from `+tinymce-premium+`, the language file path must include the `.js` extension.
207+
====
208+
209+
[[plugin-lazy-loading]]
210+
=== Plugin lazy-loading and additional resources
211+
212+
[IMPORTANT]
213+
====
214+
Plugins lazy-load additional resources (JS and CSS files) at runtime for optimal performance. These resources must be:
215+
216+
* **Included in the bundle** along with the plugin (recommended for bundled applications)
217+
* **Placed as static assets** in the expected location (for non-bundled deployments)
218+
219+
Missing resources may cause plugins to fail or display errors.
220+
====
221+
222+
When bundling, explicitly import any additional resources that plugins require. The module bundler includes these files in the application bundle, making them available at runtime.
223+
224+
For non-bundled deployments using `+external_plugins+`, ensure all required resource files (CSS, JS, and language files) are accessible at the expected paths relative to the plugin file location.
225+
226+
See <<plugin-resources,Additional plugin resources>> for specific examples of plugins that require additional resources.
227+
177228
include::partial$module-loading/bundling-plugin-resources.adoc[]

modules/ROOT/partials/module-loading/bundling-plugin-files.adoc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
[[premium-plugins]]
22
=== Premium plugins
33

4-
5-
Premium plugins are available via the `+tinymce-premium+` NPM package (recommended) or from ZIP downloads. The NPM package is the recommended method for easier installation and upgrades.
6-
74
include::partial$plugin-files/plugin-file-bundling-message.adoc[]
85

96
include::partial$module-loading/bundling-premium-plugins-npm.adoc[]

modules/ROOT/partials/module-loading/bundling-premium-plugins-npm.adoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
=== Premium plugins from NPM
2-
31
The `+tinymce-premium+` package is the recommended way to install and use premium plugins with {productname}. It includes all premium plugins, skins, icons, and language packs.
42

53
To bundle premium plugins from the NPM package, import the individual plugins you need.

0 commit comments

Comments
 (0)