@sedona-cms/blocks
v1.0.16
Published
Block editor for Sedona CMS
Downloads
26
Readme
Table of Contents
About the project
Block editor for Sedona CMS
Built With
Getting Started
Prerequisites
Setup
Add and setup
@sedona-cms/core. Setup instructionsAdd
@sedona-cms/blocksdependency to your project
npm i @sedona-cms/blocks # or yarn add @sedona-cms/blocksAdd
@sedona-cms/blocksto themodulessection ofnuxt.config.jsCreate required directories (Will be fixed):
~/admin/props– custom prop editors~/components/blocks– block components
Usage
Built-In Prop Editors
- Text
- Textarea
- Checkbox
- Number
- Date
- Wysiwyg
Create own prop editor
A prop editor is a simple Vue component. All custom editors should be saved in ~/admin/props directory.
In a prop, the editor component can use Quasar components.
Step by step guide
- Create a Vue component in
~/admin/propsdirectory - Add required props: title and value
- The title prop can have an empty default value
- The value prop will fill data from the editor
- For updating data in the editor send
changeevent
Example:
<template>
<q-field :label="title" outlined stack-label dark>
<template v-slot:control>
<div class="self-center full-width no-outline" tabindex="0">
<select v-model="color" class="full-width text-black">
<option value="red">Red</option>
<option value="green">Green</option>
<option value="blue">Blue</option>
</select>
</div>
</template>
</q-field>
</template>
<script>
export default {
name: 'Color',
props: {
title: {
type: String,
default: '',
},
value: {
type: String,
required: true,
},
},
data() {
return {
color: this.value,
}
},
watch: {
color(value) {
this.$emit('change', value)
},
},
}
</script>Development
- Install dependencies
npm ci- Link the package in which it is run
npx npm-self-link- Run watch process
npm run watch- Run nuxt project from
devdirectory
npm run dev