@spatie/blender-content-blocks

Blender content blocks component
6,816 12
Install
npm install @spatie/blender-content-blocks
Latest Version:2.0.2
Vue:2
License:MIT
Last Updated:Sep 30, 2020
Links: GitHub  ·  npm
Maintainer: spatie

Blender Media

Software License Build Status

Content blocks component for Blender, our CMS.

Installation

The blender-content-blocks can be installed from npm.

yarn add @spatie/blender-content-blocks

blender-content-blocks also requires you to install vue@'^2.0.0', lodash@'^4.0.0', and spatie-dom@'^1.0.0':

yarn add vue@'^2.0.0' lodash@'^4.0.0' spatie-dom@'^1.0.0'

Usage

The canonical way to use blender-content-blocks, is to mount it on a selector. The mount function will replace every element that matches a given selector with a blender-content-blocks component. The element should contain props just like you'd pass them with Vue.

import { mount } from '@spatie/blender-content-blocks';

export default function init() {
    mount('content-blocks');
}
<content-blocks
    collection="default"
    editor="default"
    create-url="/create"
    :model="{ name: 'MyModel', id: 1 }"
    :input="[]"
    :data="{
        locales: ['nl', 'en'],
        contentLocale: 'nl',
        mediaModel: 'App\Models\ContentBlock',
        mediaUploadUrl: '/upload'
    }"
    :debug="false"
></content-blocks>

Custom Fields

Custom fields can be defined by passing types, translatableAttributes or mediaLibraryCollections to data. Here are the default values as a quick reference:

{
    types: {
        imageLeft: 'Afbeelding links',
        imageRight: 'Afbeelding rechts',
    },
    translatableAttributes: {
        name: 'text',
        text: 'redactor',
    },
    mediaLibraryCollections: {
        image: 'image',
    },
}

Contributing

Since this is an internal project, we don't accept pull requests at this time.

License

The MIT License (MIT). Please see License File for more information.

Example images provided by Unsplash.

Related Packages

vue-tabs-component

A Vue component to easily render tabs

278,651 612
vue-table-component

A straightforward Vue component to filter and sort tables

68,283 576
vue-data-component

A straightforward Vue component to filter, sort and paginate data

27,908 73
vue-expose-inject

A React context-like solution for Vue.js

2,596 44
vue-ray

Debug Vue code with Ray to fix problems faster

99,441 83

Version History

Version Released Vue License
2.0.2 ^2.0.0 MIT
2.0.1 ^2.0.0 MIT
1.1.1 ^2.0.0 MIT
1.1.0 ^2.0.0 MIT
1.0.5 ^2.0.0 MIT
Pre-releases (10)
Version Released Vue License
1.1.0-rc.5 ^2.0.0 MIT
1.1.0-rc.4 ^2.0.0 MIT
1.1.0-rc.3 ^2.0.0 MIT
1.1.0-rc.2 ^2.0.0 MIT
1.1.0-rc.1 ^2.0.0 MIT