bolt / 红actor
📝 Bolt 扩展,用于添加 Redactor 字段类型
Requires
- php: >=7.2.9
Requires (Dev)
- bolt/core: ^5.0
- symplify/easy-coding-standard: ^7.0
- dev-master
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.1.0
- 1.0.34
- 1.0.33
- 1.0.32
- 1.0.31
- 1.0.30
- 1.0.29
- 1.0.28
- 1.0.27
- 1.0.26
- 1.0.25
- 1.0.24
- 1.0.23
- 1.0.22
- 1.0.21
- 1.0.20
- 1.0.19
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.0.1
This package is auto-updated.
Last update: 2024-09-09 16:36:53 UTC
README
此扩展提供了一种“红actor”字段类型,这是一个复杂、轻量级且优雅的 WYSIWYG 编辑器组件,适用于 Bolt。编辑器本身由 Imperavi 开发,并授权在 Bolt 中使用。
此扩展允许您在 contenttypes.yaml
中添加 type: redactor
字段,就像添加其他字段类型一样。
安装
注意:如果您已安装默认的 Bolt 项目,则无需安装。在这种情况下,它已经存在。如果您通过其他方式安装了 Bolt,则需要运行以下命令
composer require bolt/redactor
安装后,您可以在 contenttypes.yaml
中的任何内容类型中添加它,就像添加任何其他字段一样。例如
blogposts: name: Blogposts singular_name: Blogpost fields: title: type: text slug: type: slug uses: title content: type: redactor
结果将如下所示
您可以在 config/extensions/bolt-redactor.yaml
中配置编辑器。此配置会影响您在内容类型中配置的所有 Redactor 字段的实例。默认配置如下所示
default: buttons: [ bold, italic, format, lists, link, html, image ] plugins: [ fullscreen, table, inlinestyle, video, widget ] source: true plugins: ~
配置按钮
Bolt 版本的 Redactor 随带所有官方插件和选项。您可以通过在 buttons:
和 plugins:
参数中配置它们来添加或删除按钮。请参阅官方 Redactor 文档中的 所有可用按钮。请注意,某些按钮可能需要您启用相应的插件。请在此处查看 可用的插件 列表。
设置
在适用的情况下,您可以在 bolt-redactor.yaml
配置中的 default:
键下添加额外的设置。请参阅文档了解可用设置。
请注意,此文档使用 JavaScript,而 Bolt 的配置使用 YAML。例如,有关 '粘贴' 的文档中有此示例
$R('#content', { pastePlainText: true });
在 bolt-redactor.yaml
中,您可以添加如下内容
default: buttons: [ …] plugins: [ … ] pastePlainText: true
添加自定义插件
如果您根据 创建插件的文档 为 Redactor 编写了自己的插件,您可以通过将其放置在 /public/assets/redactor/plugins
中将其添加到 Bolt 的编辑器中。然后,将其添加到 bolt-redactor.yaml
配置中
default: buttons: [ … ] plugins: [ … ] plugins: myplugin: [ 'myplugin/myplugin.js', 'myplugin/myplugin.css' ]
下面的部分仅适用于 开发 扩展。对于在 Bolt 项目中一般使用扩展,无需此部分
运行 PHPStan 和 Easy Codings Standard
首先,确保已安装依赖项
COMPOSER_MEMORY_LIMIT=-1 composer update
然后运行 ECS
vendor/bin/ecs check src --fix