lead-ext / wysiwyg-editor-plugin
Sylius 的 WYSIWYG 编辑器。
dev-master
2017-06-07 19:15 UTC
Requires
- php: ^7.1
- sylius/sylius: dev-master
This package is not auto-updated.
Last update: 2024-09-29 03:47:05 UTC
README
Sylius 的 WYSIWYG 编辑器。
默认情况下,插件为产品描述和简短描述添加文本编辑器。
使用方法
-
安装包
$ composer.phar require lead-ext/wysiwyg-editor-plugin
-
将包添加到
AppKernel.php
new LeadExt\WysiwygEditorPlugin\LeadExtWysiwygEditorPlugin(),
-
在
app/config/config.yml
中配置包lead_ext_wysiwyg_editor: api_key: 'your_api_key' #please read official web site for more information https://www.tinymce.com/
-
在具有所需选项的页面上添加 WYSIWYG 编辑器的初始化脚本
{{ wysiwyg_init({ browser_spellcheck: true, branding: false, elementpath: false, statusbar: false, menubar: false, language: app.request.locale })}}
请查看官方文档了解所有可用选项: https://www.tinymce.com/docs/
-
使用
TextWysiwygType
表单类型为您的字段public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('text', TextWysiwygType::class, [ 'required' => false, ]) }
手动步骤
- 为渲染的字段添加
raw
过滤器。例如:{{ product.shortDescription|raw }}