Skip to content
Snippets Groups Projects
Commit a4f9dd6d authored by Sigfried Arnold's avatar Sigfried Arnold
Browse files

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

parent 8699929e
No related branches found
No related tags found
1 merge request!2parsing for markers in TSConfig / JavaScript to allow complex setups with nested parenthesis
...@@ -228,10 +228,15 @@ class Loader { ...@@ -228,10 +228,15 @@ class Loader {
$configuration = file_get_contents($configurationFile); $configuration = file_get_contents($configurationFile);
} }
// split config into first and last javascript parts (applied later again into the config variables) // first try to find the configuration via the "subpart" ###TINYMCE_INIT###
// additionally the config part is matched to get the options $pattern = '/(.*)?tinymce\.init\s*\(\s*\{\s*\/\*\s?###TINYMCE_INIT###.*?\*\/(.*)\/\*\s*###TINYMCE_INIT###.*?\*\/\s*\}\s*\);*(.*)?/is';
$pattern = '/(.*)tinymce\.init\s*\(\s*\{(.*?)\}\s*\)\s*;?(.*)/is'; if (@preg_match($pattern, $configuration, $matches)) {
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 // add preJS and postJS
$configurationArray['preJS'] = trim($matches[1]); $configurationArray['preJS'] = trim($matches[1]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment