Giter VIP home page Giter VIP logo

article's Introduction

๐Ÿ“ Bolt Article Extension

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

article's People

Contributors

bobdenotter avatar develth avatar filoz avatar i-valchev avatar leohugues avatar lordsimal avatar nestordedios avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

article's Issues

When adding a <ul>, inline style is added

Every time an <ul> is added, this inline style is added:

<ul style="margin-left: 0px; padding-left: 20px;" arx-list-left="20"></ul>

It'd be great if this behavior could be disabled/removed

Field content doesn't show for invalid records

Probably same issue as:
bolt/redactor#28

Reproduce:

  • Have custom ContentValidator returning a dummy ConstraintViolation
    eg: in bolt core source, change src/Validator/ContentValidator.php validate() method to:
    public function validate(Content $content)
    {
        $constraints = $this->getConstraints($content->getContentType());

        $constraints->add(new ConstraintViolation("zzz", null, [], null, null, null));

        return $constraints;
    }
  • Have an Article field
  • Populate Article field
  • Save
  • Upon reload, Article field value is not displayed.

Example form before save:
form_before_save

Example form after save:
form_after_save

public/assets not created

I'm sorry, wrong repo.

Hi

in Bolt 5.1.14, I can't get public/assets folder filled with files.

The folder is not created.

Is there a command to make this to use?

thank you!

After saving Snippet can not be edited

I'm using the following configuration to insert a row with an image and text into a section.

I'm using the following configuration.

The problem is after I have saved the content of this Snippet I can no longer modify it's content in the Article editor.

default:
  plugins: [ snippets, blockcode, buttonlink, definedlinks, inlineformat, reorder, tags, underline ]
  source: true
  grid:
    classname: 'article-grid'
    columns: 12
    patterns:
      '1|10|1': 'col-1|col-10|col-1'
      '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'
  layer: false
  codemirror:
    lineNumbers: true
    mode: xml
    htmlMode: true
  snippets:
    section:
      name: "Sectie"
      html: |
        <section class="mb-xxl mb-lg-xxxl">
                    <div class="container px-sm-m px-lg-l">
        </div>
        </section>
    2-kolomen-tekst:
      name: "2 kolomen tekst"
      html: |
        <div class="row">
           <div class="col col-lg-10 offset-md-1">
               <h2 class="mb-xl">Titel (10 kolommen breed)</h2>
               <h3 class="mb-m">Een Ondertitel</h3>
           </div>
        </div>
        <div class="row">
            <div class="col-6 col-sm-12 col-md-5 offset-md-1">
                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Idem iste, inquam, de voluptate quid sentit? Quid me istud rogas. Duo Reges: constructio interrete. </p>
            </div>
            <div class="col-6 col-sm-12 col-md-5">
                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Idem iste, inquam, de voluptate quid sentit? Quid me istud rogas. Duo Reges: constructio interrete. </p>
            </div>
        </div>

After saving, Grid element loses its properties

Steps to reproduce:

  • Create a grid element
  • From the html hierarchy toolbar, you can select the Grid element and that gives you certain properties that you can edit, like changing the vertical alignment of this grid's columns
  • Save your record
  • When you come back to this record the Grid element has become a plain Div, and you can no longer edit the Grid's properties from the toolbar

Demonstration video:

screencast 2020-10-29 12-39-53

Bug: Certain classes don't get added until content is saved twice

I am trying the Classes setting:
https://imperavi.com/article/docs/settings/classes/

In bolt-article.yaml I have this:

default:
   classes:
        img: "img-fluid"
        figure: "w-100"

In this example, every img element, should get the "img-fluid" class added to it.

In Bolt/Article, I add an image and save the record, but when I open the saved record (front end) and I view the source in the browser, the image doesn't have the "img-fluid" class, so I go to the back end to edit the record, and save again, the second time the class does appear in the front end view.

Bolt v4 RC 42

Responsive embed option keeps width / height

When I embed a content as a responsive embed, I expect the width and height attributes of the <iframe> tag to be removed (so that CSS-based width and height can be used).

But right now, it keeps them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.