93 lines
2.0 KiB
TypeScript
93 lines
2.0 KiB
TypeScript
import type { Block } from 'payload'
|
|
import {
|
|
lexicalEditor,
|
|
BoldFeature,
|
|
ItalicFeature,
|
|
UnderlineFeature,
|
|
LinkFeature,
|
|
UnorderedListFeature,
|
|
} from '@payloadcms/richtext-lexical'
|
|
|
|
const fdRichTextEditor = lexicalEditor({
|
|
features: ({ defaultFeatures }) => [
|
|
...defaultFeatures,
|
|
BoldFeature(),
|
|
ItalicFeature(),
|
|
UnderlineFeature(),
|
|
LinkFeature({ enabledCollections: ['pages', 'posts'] }),
|
|
UnorderedListFeature(),
|
|
],
|
|
})
|
|
|
|
export const FDUspTableBlock: Block = {
|
|
slug: 'fdUspTable',
|
|
interfaceName: 'FDUspTableBlock',
|
|
labels: {
|
|
singular: 'FD USP-tabell',
|
|
plural: 'FD USP-tabeller',
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'heading',
|
|
type: 'text',
|
|
localized: true,
|
|
label: 'Rubrik (valfri)',
|
|
},
|
|
{
|
|
name: 'rows',
|
|
type: 'array',
|
|
label: 'Rader',
|
|
minRows: 1,
|
|
fields: [
|
|
{
|
|
name: 'title',
|
|
type: 'text',
|
|
localized: true,
|
|
required: true,
|
|
label: 'Rubrik',
|
|
admin: { description: 'T.ex. "Högsta säkerhet"' },
|
|
},
|
|
{
|
|
name: 'description',
|
|
type: 'richText',
|
|
localized: true,
|
|
label: 'Beskrivning',
|
|
editor: fdRichTextEditor,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'checkColor',
|
|
type: 'select',
|
|
label: 'Checkikon-färg',
|
|
defaultValue: 'navy',
|
|
options: [
|
|
{ label: 'Navy (vit bock)', value: 'navy' },
|
|
{ label: 'Gul (navy bock)', value: 'yellow' },
|
|
{ label: 'Grå (navy bock)', value: 'gray' },
|
|
],
|
|
},
|
|
{
|
|
name: 'sectionBackground',
|
|
type: 'select',
|
|
label: 'Sektionsbakgrund',
|
|
defaultValue: 'white',
|
|
options: [
|
|
{ label: 'Vit', value: 'white' },
|
|
{ label: 'Grå', value: 'gray' },
|
|
{ label: 'Navy', value: 'navy' },
|
|
],
|
|
},
|
|
{
|
|
name: 'textColor',
|
|
type: 'select',
|
|
label: 'Textfärg',
|
|
defaultValue: 'navy',
|
|
options: [
|
|
{ label: 'Navy', value: 'navy' },
|
|
{ label: 'Vit', value: 'white' },
|
|
],
|
|
},
|
|
],
|
|
}
|