Skip to content

Commit

Permalink
Merge branch 'master' of github.com:niklasfjeldberg/vue-strapi-blocks…
Browse files Browse the repository at this point in the history
…-renderer
  • Loading branch information
niklasfjeldberg committed Apr 2, 2024
2 parents 111a1d5 + 1bc1461 commit eafe579
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
} from './types';

import type { VNode } from 'vue';
import { h } from 'vue';
import { Text } from './text';
import { name } from '../package.json';

Expand Down Expand Up @@ -72,6 +73,16 @@ export const Block = ({ content, componentsContext }: BlockProps) => {
return BlockComponent(props);
}

// Handle empty paragraphs separately as they should render a <br> tag
if (
type === 'paragraph' &&
childrenNodes.length === 1 &&
childrenNodes[0].type === 'text' &&
childrenNodes[0].text === ''
) {
return h('br');
}

const augmentedProps = augmentProps(content);

const theChildren: any = childrenNodes.map((childNode) => {
Expand Down

0 comments on commit eafe579

Please sign in to comment.