Commit 16d683b3 authored by Stefan Galinski's avatar Stefan Galinski 🎮

Merge branch 'master' into 'master'

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

See merge request !2
parents 8699929e 5ba81fc6
...@@ -136,7 +136,7 @@ class Loader { ...@@ -136,7 +136,7 @@ class Loader {
} }
}; };
SG.initTinyMceLoadFunction(); SG.initTinyMceLoadFunction();
SG.initTinyMceLoadInterval = window.setInterval(SG.initTinyMceLoadFunction, 1000); SG.initTinyMceLoadInterval = window.setInterval(SG.initTinyMceLoadFunction, 333);
'; ';
$configuration .= $this->tinymceConfiguration['postJS']; $configuration .= $this->tinymceConfiguration['postJS'];
...@@ -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]);
......
...@@ -16,7 +16,7 @@ tinymce.PluginManager.add('shy', function(editor) { ...@@ -16,7 +16,7 @@ tinymce.PluginManager.add('shy', function(editor) {
editor.addButton('shy', { editor.addButton('shy', {
title: 'Soft hyphen', title: 'Soft hyphen',
image: tinyMCE.baseURL + '/plugins/shy/icon.png', image: tinyMCE.baseURL + '/../../Resources/Public/JavaScript/TinymcePlugins/shy/icon.png',
cmd: 'mceShy' cmd: 'mceShy'
}); });
......
tinymce.PluginManager.requireLangPack("shy","de");tinymce.PluginManager.add("shy",function(e){e.addCommand("mceShy",function(){e.insertContent(e.plugins.visualchars&&e.plugins.visualchars.state?'<span class="mce-shy">&shy;</span>':"&shy;");e.dom.setAttrib(e.dom.select("span.mce-shy"),"data-mce-bogus","1")});e.addButton("shy",{title:"Soft hyphen",image:tinyMCE.baseURL+"/plugins/shy/icon.png",cmd:"mceShy"});e.addMenuItem("shy",{text:"Soft hyphen",cmd:"mceShy",context:"insert"})}) tinymce.PluginManager.requireLangPack("shy","de");tinymce.PluginManager.add("shy",function(e){e.addCommand("mceShy",function(){e.insertContent(e.plugins.visualchars&&e.plugins.visualchars.state?'<span class="mce-shy">&shy;</span>':"&shy;");e.dom.setAttrib(e.dom.select("span.mce-shy"),"data-mce-bogus","1")});e.addButton("shy",{title:"Soft hyphen",image:tinyMCE.baseURL+"/../../Resources/Public/JavaScript/TinymcePlugins/shy/icon.png",cmd:"mceShy"});e.addMenuItem("shy",{text:"Soft hyphen",cmd:"mceShy",context:"insert"})})
\ No newline at end of file \ No newline at end of file
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