Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfeng33 committed Dec 17, 2024
1 parent ed7c677 commit 1f538d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ it('serialize image with alt to html', async () => {
children: [
{
attributes: { alt: 'Placeholder' },
children: [],
children: [{ text: '' }],
type: 'img',
url: 'https://via.placeholder.com/300',
},
Expand Down
7 changes: 5 additions & 2 deletions packages/core/src/lib/static/components/PlateStatic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { TEditableProps } from '@udecode/slate-react';
import {
type TDescendant,
type TElement,
type TNodeEntry,
type TText,
findNode,
getRange,
Expand Down Expand Up @@ -106,10 +107,12 @@ function LeafStatic({
);
}

const defaultDecorate: (entry: TNodeEntry) => DecoratedRange[] = () => [];

function Children({
children = [],
components,
decorate,
decorate = defaultDecorate,
decorations,
editor,
}: {
Expand All @@ -128,7 +131,7 @@ function Children({

if (p) {
const range = getRange(editor, p);
ds = decorate!([child, p]);
ds = decorate([child, p]);

for (const dec of decorations) {
const d = Range.intersection(dec, range);
Expand Down

0 comments on commit 1f538d1

Please sign in to comment.