adnedelcu/summernote-bundle
Summernote bundle,为您的 Symfony2 项目添加 Summernote WYSIWYG 编辑器
0.1
2015-09-23 16:51 UTC
Requires
- php: >=5.3.3
- symfony/framework-bundle: ~2.4
- symfony/twig-bundle: ~2.4
Suggests
- helios-ag/fm-elfinder-bundle: Elfinder bundle, file manager
This package is auto-updated.
Last update: 2024-09-16 03:31:24 UTC
README
SummernoteBundle 添加了 summernote 扩展包
安装
步骤 1:安装
使用 Composer,只需将以下配置添加到您的 composer.json
或者您可以使用 Composer 安装此扩展包:在您的 composer.json 中添加 SummernoteBundle
composer require adnedelcu/summernote-bundle --no-update
现在运行以下命令让 Composer 下载扩展包
composer update adnedelcu/summernote-bundle
步骤 2:启用扩展包
最后,在 kernel 中启用扩展包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new ADN\SummernoteBundle\ADNSummernoteBundle(), ); }
配置
您可以按照以下方式配置扩展包
adn_summernote: plugins: - video selector: .summernote #defines summernote selector for apply to toolbar: # define toolbars, if no toolbar configured, default toolbars defined ['style', ['style']] extra_toolbar: # extra toolbar can be used for plugins toolbar and as additional toolbar setings, when 'toolbar' option is omitted elfinder: [elfinder] width: 600 height: 400 include_jquery: true #include js libraries, if your template already have them, set to false include_bootstrap: true include_fontawesome: true
为了上传编辑器中粘贴的图片,您可以向扩展包添加以下配置
adn_summernote: # ... upload_images: true # set to false if you don't want to upload images # used for the image upload (so that the images will not be saved as base64 in the content) max_upload_size: 1048576 # this route must be implemented if you want to use the image upload feature image_upload_route: acme_image_upload # ...
##用法
Twig 模板示例
{{ summernote_init() }} <textarea class="summernote"></textarea>