承接 bolt/article 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

bolt/article

Composer 安装命令:

composer require bolt/article

包简介

📝 Bolt Extension to add the Article FieldType

README 文档

README

This extension provides a "Article" field type, which is a powerful text editor for creating rich content in your Bolt websites. It can work with grids, embeds, typographic markup and media. The editor itself is developed by Imperavi, and is licensed for usage in Bolt.

This extension allows you to add fields of type: article 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/article

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: article

The result will be like this:

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

# Settings for Bolt Article

default:
  plugins: [ blockcode, buttonlink, definedlinks, inlineformat, reorder, tags, underline ]
  source: true
  grid:
    classname: 'article-grid'
    columns: 12
    patterns:
      '4|4|4': 'col-4|col-4|col-4'
      '4|8': 'col-4|col-8'
      '6|6': 'col-6|col-6'
      '8|4': 'col-8|col-4'

plugins:
  ~

Configuring the buttons

Bolt's version of Article ships with all the official plugins and options. you can add or remove buttons and plugins by configuring them in the plugins: parameters. Check the official Article 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-article.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:

ArticleEditor('#entry', {
    css: '/your-article-dist-path/',
    paste: {
        autolink: false
    }
});

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

default:
  buttons: [ …]
  plugins: [ … ]
  css: '/your-article-dist-path/'
  paste:
    autolink: false

Adding custom plugins

If you've written your own block or plugin for Article according to the documentation for Creating Plugins or for Creating Blocks, you can add it to the editor in Bolt, by placing it in /public/assets/article/_plugins. Then, add it to the bolt-article.yaml configuration:

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

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

Grid setup

Using Article, you can allow the editors to insert Grid elements, splitting up the "main column" in two or more columns, allowing them more variations for laying out content.

By default, Article has a simple grid that consists of 12 columns, and allows the editors to pick '4 + 4 + 4', '4 + 8', '6 + 6' and '8 + 4' as options. The grid will create HTML like this:

<div class="article-grid">
    <div class="col-6"></div>
    <div class="col-6"></div>
</div>

On the front end of the website, this needs to be styled correctly as CSS, in order to work properly. This can be done in a few ways:

  1. Linking to the default styles.
  2. Copy the grid.css file to your theme to customize it.
  3. Manually styling the grid, using your own CSS.

You can link the grid.css that ships with Article using the following:

<link rel="stylesheet" href="{{ asset('assets/article/grid.css', 'public') }}">

If you prefer to copy the file to your own theme, you can link it using:

<link rel="stylesheet" href="{{ asset('css/article_grid.css', 'theme') }}">

Alternatively, if your theme is using Bootstrap or Bulma, you can configure Article to use the grid format from your preferred framework directly. See the documentation on using Bootstrap grid or using Bulma grid.

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/article 适用场景与选型建议

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 11
  • Watchers: 7
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-08-05