diff --git a/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php b/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
index 90fb5c116..72c384cd8 100644
--- a/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
+++ b/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
@@ -78,8 +78,7 @@ class TinyMCECombinedGenerator implements TinyMCEScriptGenerator, Flushable
{
$tinymceDir = $config->getTinyMCEPath();
- // Core JS file
- $files = [ $tinymceDir . '/tinymce' ];
+ $files = [ ];
// Add core languages
$language = $config->getOption('language');
@@ -137,18 +136,43 @@ class TinyMCECombinedGenerator implements TinyMCEScriptGenerator, Flushable
return null;
}, $files));
- // Set base URL for where tinymce is loaded from
- $buffer = "var tinyMCEPreInit={base:'" . Convert::raw2js($tinymceDir) . "',suffix:'.min'};\n";
+ $libContent = $this->getFileContents(Director::baseFolder() . '/' . $tinymceDir . '/tinymce.min.js');
+
+ // Register vars for config
+ $baseDirJS = Convert::raw2js(Director::absoluteBaseURL());
+ $buffer = [];
+ $buffer[] = <<