Skip to content

Commit bb2cedf

Browse files
committed
default license_key to 'gpl' so legacy profiles work on TinyMCE 8
1 parent 79be985 commit bb2cedf

4 files changed

Lines changed: 11 additions & 1 deletion

File tree

assets/scripts/base.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,10 @@ function tiny_init(container) {
505505
}
506506
}
507507

508+
if (!options.hasOwnProperty('license_key')) {
509+
options.license_key = 'gpl';
510+
}
511+
508512
if (!options.hasOwnProperty('convert_newlines_to_brs')) {
509513
options.convert_newlines_to_brs = false;
510514
}

assets/scripts/profiles-list.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@
177177
var c = Object.assign({}, window.tinyprofiles[profileKey]);
178178
c.selector = '#tinymcePreviewEditor';
179179
c.height = c.height || 300;
180+
if (!c.license_key) { c.license_key = 'gpl'; }
180181
window.tinymce.init(c);
181182
}
182183
} catch (e) {
@@ -193,6 +194,7 @@
193194
// final fallback: call tinymce.init with parsed conf
194195
conf.selector = '#tinymcePreviewEditor';
195196
conf.height = conf.height || 300;
197+
if (!conf.license_key) { conf.license_key = 'gpl'; }
196198
window.tinymce.init(conf);
197199
} else if (modalBody) {
198200
modalBody.innerHTML += '<div class="text-danger">TinyMCE not available — please run the build or check vendor/tinymce is present.</div>';

assets/scripts/tests/mblock-integration-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
tiny_init(window.jQuery(wrapper));
2828
log('called tiny_init on mblock wrapper — waiting for tinymce instance...');
2929
} else if (window.tinymce && typeof window.tinymce.init === 'function') {
30-
window.tinymce.init({ selector: '#mblockIntegrationTestEditor' });
30+
window.tinymce.init({ selector: '#mblockIntegrationTestEditor', license_key: 'gpl' });
3131
log('called tinymce.init fallback — waiting for tinymce instance...');
3232
} else {
3333
log('tinymce not found on page — ensure vendor build is loaded');

lib/TinyMce/Creator/Profiles.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ public static function mapProfile(array $profile): string
151151
}
152152
}
153153

154+
if (1 !== preg_match('/(?:^|[,\{\r\n])\s*license_key\s*:/', $extra)) {
155+
$extra = "license_key: 'gpl',\n" . $extra;
156+
}
157+
154158
return $extra;
155159
}
156160
return $jsonProfile;

0 commit comments

Comments
 (0)