nmb / tinymce-bundle
将 TinyMCE 4.x 编辑器集成到 symfony2
dev-master
2013-10-26 20:54 UTC
Requires
- php: >=5.3.2
- symfony/symfony: >=2.0
This package is not auto-updated.
Last update: 2024-09-23 14:39:00 UTC
README
将 TinyMCE 4.x 编辑器集成到 symfony2
安装
将 NmbTinymceBundle 添加到您的 composer.json 文件中
{ "require": { "nmb/tinymce-bundle": "dev-master" } }
运行以下命令下载包
$php composer.phar update nmb/tinymce-bundle
将包添加到您的 app/AppKernel.php 文件中
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Nmb\TinymceBundle\NmbTinymceBundle(), ); }
配置
您可以在 nmb_tinymce 键下添加任意数量的配置,您可以任意命名,并选择每个 tinymce 实例想要使用哪一个。关于配置本身的详细信息,请参考 tinymce 文档: http://www.tinymce.com/wiki.php/Installation
# app/config/config.yml nmb_tinymce: configs: my_basic_config: selector: textarea advanced_config: selector: "textarea#elm1" theme: "modern" width: 300 height: 300 plugins: ["advlist autolink link image lists","searchreplace wordcount visualblocks code","save table contextmenu directionality textcolor"] content_css: "css/content.css" toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | l ink image | print preview media fullpage | forecolor backcolor emoticons" style_formats: [ [title: 'Bold text', inline: 'b'], [title: 'exmample 2', inline: 'span', styles: [color: '#fff000']] ] other_config: ...
使用
在您的 twig 模板中
{{ nmb_tinymce_init('my_config_key') }}