Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions assets/scripts/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,10 @@ function tiny_init(container) {
}
}

if (!options.hasOwnProperty('license_key')) {
options.license_key = 'gpl';
}

if (!options.hasOwnProperty('convert_newlines_to_brs')) {
options.convert_newlines_to_brs = false;
}
Expand Down
2 changes: 2 additions & 0 deletions assets/scripts/profiles-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
var c = Object.assign({}, window.tinyprofiles[profileKey]);
c.selector = '#tinymcePreviewEditor';
c.height = c.height || 300;
if (!c.license_key) { c.license_key = 'gpl'; }
window.tinymce.init(c);
}
} catch (e) {
Expand All @@ -193,6 +194,7 @@
// final fallback: call tinymce.init with parsed conf
conf.selector = '#tinymcePreviewEditor';
conf.height = conf.height || 300;
if (!conf.license_key) { conf.license_key = 'gpl'; }
window.tinymce.init(conf);
} else if (modalBody) {
modalBody.innerHTML += '<div class="text-danger">TinyMCE not available — please run the build or check vendor/tinymce is present.</div>';
Expand Down
2 changes: 1 addition & 1 deletion assets/scripts/tests/mblock-integration-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
tiny_init(window.jQuery(wrapper));
log('called tiny_init on mblock wrapper — waiting for tinymce instance...');
} else if (window.tinymce && typeof window.tinymce.init === 'function') {
window.tinymce.init({ selector: '#mblockIntegrationTestEditor' });
window.tinymce.init({ selector: '#mblockIntegrationTestEditor', license_key: 'gpl' });
log('called tinymce.init fallback — waiting for tinymce instance...');
} else {
log('tinymce not found on page — ensure vendor build is loaded');
Expand Down
4 changes: 4 additions & 0 deletions lib/TinyMce/Creator/Profiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ public static function mapProfile(array $profile): string
}
}

if (1 !== preg_match('/(?:^|[,\{\r\n])\s*license_key\s*:/', $extra)) {
$extra = "license_key: 'gpl',\n" . $extra;
}

return $extra;
}
return $jsonProfile;
Expand Down