定制 bolt/redactor 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bolt/redactor

Composer 安装命令:

composer require bolt/redactor

包简介

📝 Bolt Extension to add the Redactor FieldType

README 文档

README

This extension provides a "Redactor" field type, which is a sophisticated, lightweight and elegant WYSIWYG editor component for Bolt. The editor itself is developed by Imperavi, and is licensed for usage in Bolt.

This extension allows you to add fields of type: redactor in your ContentTypes, as defined in contenttypes.yaml, like any other Field type.

Installation

Note: Installation is not required if you've installed the default Bolt project. In that case it's already present. If you've installed Bolt through different means, you'll need to run the command below:

composer require bolt/redactor

After installation, you can add it to any ContentType in your contenttypes.yaml, like any other field. For example:

blogposts:
    name: Blogposts
    singular_name: Blogpost
    fields:
        title:
            type: text
        slug:
            type: slug
            uses: title
        content:
            type: redactor

The result will be like this:

You can configure the editor in config/extensions/bolt-redactor.yaml. This configuration affects all the instances of the Redactor field that you've configured in your ContentTypes. The default configuration looks like this:

default:
  buttons: [ bold, italic, format, lists, link, html, image ]
  plugins: [ fullscreen, table, inlinestyle, video, widget ]
  source: true

plugins:
  ~

Configuring the buttons

Bolt's version of Redactor ships with all the official plugins and options. you can add or remove buttons by configuring them in the buttons: and plugins: parameters. Check the official Redactor documentation for all available buttons. Note that some buttons might require you to enable the corresponding plugin as well. See here for a list of the available plugins.

Settings

Where applicable, you can add extra settings under the default: key in the bolt-redactor.yaml configuration. See the documentation for available settings.

Note that this documentation uses Javascript, whilst Bolt's configuration uses Yaml. For example, the documentation for 'Paste' has this example:

$R('#content', {
        pastePlainText: true
});

In bolt-redactor.yaml you can add this as:

default:
  buttons: [ …]
  plugins: [ … ]
  pastePlainText: true

Adding custom plugins

If you've written your own plugin for Redactor according to the documentation for Creating Plugins, you can add it to the editor in Bolt, by placing it in /public/assets/redactor/plugins. Then, add it to the bolt-redactor.yaml configuration:

default:
  buttons: [ … ]
  plugins: [ … ]

plugins:
  myplugin: [ 'myplugin/myplugin.js', 'myplugin/myplugin.css' ]

The part below is only for developing the extension. Not required for general usage of the extension in your Bolt Project

Running PHPStan and Easy Codings Standard

First, make sure dependencies are installed:

COMPOSER_MEMORY_LIMIT=-1 composer update

And then run ECS:

vendor/bin/ecs check src --fix

bolt/redactor 适用场景与选型建议

bolt/redactor 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 141.24k 次下载、GitHub Stars 达 11, 最近一次更新时间为 2020 年 07 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 bolt/redactor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 bolt/redactor 我们能提供哪些服务?
定制开发 / 二次开发

基于 bolt/redactor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 141.24k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 11
  • 点击次数: 18
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 10
  • Forks: 12
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-07-24