Visual text editor; Cards, FAQ and HTML blocks; block anchors
The text editor (Tiptap) only produces simple HTML: headings, bold, italic, strikethrough, links, lists, pull quotes, lines. Layouts that were hand-written HTML in text blocks get their own blocks (Cards with pictures or numbered steps, FAQ), one-offs and embeds go in an HTML block, and every block can have an anchor for #links. Text blocks get alignment and a small (footnote) size. Existing text blocks the editor can't represent become HTML blocks that render exactly as before (migration, and backup import for old files); text that is only centred becomes centred text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
This commit is contained in:
parent
72f8898925
commit
f86c2251dc
17 changed files with 532 additions and 72 deletions
|
|
@ -11,7 +11,10 @@ export const blockLabels: Record<BlockType, string> = {
|
|||
testimonials: 'Testimonials',
|
||||
upcoming_calendar: 'Upcoming Calendar',
|
||||
shop: 'Shop',
|
||||
checkout: 'Checkout'
|
||||
checkout: 'Checkout',
|
||||
cards: 'Cards',
|
||||
faq: 'FAQ',
|
||||
html: 'HTML'
|
||||
};
|
||||
|
||||
export const blockTypes = Object.keys(blockLabels) as BlockType[];
|
||||
|
|
@ -80,6 +83,24 @@ export function createBlock(type: BlockType): ContentBlock {
|
|||
notesLabel: 'Notes or special requests'
|
||||
};
|
||||
break;
|
||||
case 'cards':
|
||||
base.data = {
|
||||
heading: 'Section heading',
|
||||
intro: '',
|
||||
align: 'center',
|
||||
style: 'image',
|
||||
items: [1, 2, 3].map((n) => ({ imageUrl: '', imageAlt: '', title: `Card ${n}`, subtitle: '', text: '<p>A sentence or two.</p>', href: '', linkLabel: '' }))
|
||||
};
|
||||
break;
|
||||
case 'faq':
|
||||
base.data = {
|
||||
heading: 'Questions people ask',
|
||||
items: [{ question: 'What happens in the first session?', answer: '<p>Answer it here.</p>' }]
|
||||
};
|
||||
break;
|
||||
case 'html':
|
||||
base.data = { html: '' };
|
||||
break;
|
||||
}
|
||||
base.data._background = { type: 'none', color: '', attachment: 'scroll', overlay: false, overlayOpacity: 40 };
|
||||
return base;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue