diff --git a/Controller/ElfinderController.php b/Controller/ElfinderController.php index 9254ac1..2637be2 100644 --- a/Controller/ElfinderController.php +++ b/Controller/ElfinderController.php @@ -32,6 +32,11 @@ public function showAction() 'tinymce_popup_path' => $this->getAssetsUrl($parameters['tinymce_popup_path']) )); break; + case 'tinymce4': + return $this->render('FMElfinderBundle:Elfinder:tinymce4.html.twig', array( + 'locale' => $locale, + )); + break; default: return $this->render('FMElfinderBundle:Elfinder:simple.html.twig', array('locale' => $locale, 'fullscreen' => $fullscreen)); } diff --git a/README.md b/README.md index 01748c5..37ab0ba 100644 --- a/README.md +++ b/README.md @@ -196,9 +196,8 @@ ElFinder will be available under Insert Image dialog You can integrate TinyMCE byself or use Bundles that already add TinyMCE functionality to your Symfony project. Below instruction how to integrate [FMElfinderBundle](https://github.com/helios-ag/FMElfinderBundle) with [TinyMCEBundle](https://github.com/stfalcon/TinymceBundle) -Currently compatible with version 0.2.1 of TinyMCE bundle (require: "stfalcon/tinymce-bundle": "v0.2.1") ## Using ElfinderBundle with [TinyMCEBundle](https://github.com/stfalcon/TinymceBundle) - +Instruction for bundle version 0.2.1 and below (TinyMCE 3.x) Download both bundles, configure, dump and install assets as written in installation steps ### Configuration @@ -228,6 +227,33 @@ as shown below {{ elfinder_tinymce_init() }} ``` +### Integrating with TinyMCE 4.x + + ### Configuration + + Update the editor property in your app/config.yml + ```yml + fm_elfinder: + editor: tinymce4 + ``` + Under tinymce configuration node, theme configuration, add: + file_browser_callback : 'elFinderBrowser' + + ```yml + stfalcon_tinymce: + theme: + simple: + file_browser_callback : elFinderBrowser + ``` + + before ( {{ tinymce_init() }} ) function call + place ElfinderBundle's function: {{ elfinder_tinymce_init4() }} + as shown below + ```jinja + {{ elfinder_tinymce_init4() }} + {{ tinymce_init() }} + ``` + Thats all, Elfinder is integrated into TinyMCE. Manual integration guide can be found [here](/INTEGRATION_GUIDE.md) diff --git a/Resources/views/Elfinder/_tinymce4.html.twig b/Resources/views/Elfinder/_tinymce4.html.twig new file mode 100644 index 0000000..d6c56b1 --- /dev/null +++ b/Resources/views/Elfinder/_tinymce4.html.twig @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/Resources/views/Elfinder/tinymce4.html.twig b/Resources/views/Elfinder/tinymce4.html.twig new file mode 100644 index 0000000..5d91584 --- /dev/null +++ b/Resources/views/Elfinder/tinymce4.html.twig @@ -0,0 +1,46 @@ + + + + {% stylesheets output='assetic/css/compiled/fmelfinder/main.css' + 'bundles/fmelfinder/css/*' filter='cssrewrite,?yui_css' %} + + {% endstylesheets %} + + +{% javascripts output='bundles/fmelfinder/js/main.js' filter='?yui_js' +'@FMElfinderBundle/Resources/public/js/jquery/jquery-1.8.0.min.js' +'@FMElfinderBundle/Resources/public/js/jquery/jquery-ui-1.8.23.custom.min.js' +'@FMElfinderBundle/Resources/public/js/elfinder.min.js' +'@FMElfinderBundle/Resources/public/js/i18n/*' +%} + +{% endjavascripts %} + +
+ + \ No newline at end of file diff --git a/Twig/Extension/FMElfinderTinymceExtension.php b/Twig/Extension/FMElfinderTinymceExtension.php index 78d1f46..b5b5680 100644 --- a/Twig/Extension/FMElfinderTinymceExtension.php +++ b/Twig/Extension/FMElfinderTinymceExtension.php @@ -29,7 +29,8 @@ public function __construct(ContainerInterface $container) public function getFunctions() { return array( - 'elfinder_tinymce_init' => new \Twig_Function_Method($this, 'tinymce', array('is_safe' => array('html'))) + 'elfinder_tinymce_init' => new \Twig_Function_Method($this, 'tinymce', array('is_safe' => array('html'))), + 'elfinder_tinymce_init4' => new \Twig_Function_Method($this, 'tinymce4', array('is_safe' => array('html'))) ); } @@ -41,6 +42,11 @@ public function tinymce() return $this->container->get('templating')->render('FMElfinderBundle:Elfinder:_tinymce.html.twig'); } + public function tinymce4() + { + return $this->container->get('templating')->render('FMElfinderBundle:Elfinder:_tinymce4.html.twig'); + } + /** * (non-PHPdoc) * @see Twig_ExtensionInterface::getName()