Commit a4f9dd6d authored by Sigfried Arnold's avatar Sigfried Arnold

parsing for markers in TSConfig / JavaScript to allow complex setups with nested parenthesis

parent 8699929e
......@@ -228,10 +228,15 @@ class Loader {
$configuration = file_get_contents($configurationFile);
}
// split config into first and last javascript parts (applied later again into the config variables)
// additionally the config part is matched to get the options
$pattern = '/(.*)tinymce\.init\s*\(\s*\{(.*?)\}\s*\)\s*;?(.*)/is';
preg_match($pattern, $configuration, $matches);
// first try to find the configuration via the "subpart" ###TINYMCE_INIT###
$pattern = '/(.*)?tinymce\.init\s*\(\s*\{\s*\/\*\s?###TINYMCE_INIT###.*?\*\/(.*)\/\*\s*###TINYMCE_INIT###.*?\*\/\s*\}\s*\);*(.*)?/is';
if (@preg_match($pattern, $configuration, $matches)) {
// fine :)
} else {
// if nothing is found, try it the legacy way (note: this may cause problems with a complex setups, since parenthesis-matching is not perfect here)
$pattern = '/(.*)tinymce\.init\s*\(\s*\{(.*?)\}\s*\)\s*;?(.*)/is';
preg_match($pattern, $configuration, $matches);
}
// add preJS and postJS
$configurationArray['preJS'] = trim($matches[1]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment