All files / components/ContentfulRichText/nodes index.ts

100% Statements 62/62
100% Branches 0/0
100% Functions 0/0
100% Lines 62/62

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 631x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
import type { SvelteComponent } from "svelte";
import type { Node } from "@contentful/rich-text-types";
 
import paragraph from "./Paragraph.svelte";
import text from "./Text.svelte";
import heading1 from "./Heading1.svelte";
import heading2 from "./Heading2.svelte";
import heading3 from "./Heading3.svelte";
import heading4 from "./Heading4.svelte";
import heading5 from "./Heading5.svelte";
import heading6 from "./Heading6.svelte";
import hr from "./Hr.svelte";
import blockquote from "./Blockquote.svelte";
import unorderedList from "./UnorderedList.svelte";
import orderedList from "./OrderedList.svelte";
import listItem from "./ListItem.svelte";
import hyperlink from "./Hyperlink.svelte";
import table from "./Table.svelte";
import tableRow from "./TableRow.svelte";
import tableHeaderCell from "./TableHeaderCell.svelte";
import tableCell from "./TableCell.svelte";
import embeddedAssetBlock from "./EmbeddedAssetBlock.svelte";
import embeddedEntryBlock from "./EmbeddedEntryBlock.svelte";
import embeddedEntry from "./EmbeddedEntry.svelte";
import assetHyperlink from "./AssetHyperlink.svelte";
import entryHyperlink from "./EntryHyperlink.svelte";
 
const nodes: Record<string, typeof SvelteComponent<Record<never, never> | { node: Node }>> = {
  text,
  // Block Types (see https://github.com/contentful/rich-text/blob/3568691018866c2a4fdbfede27c0aa19f24b5b3f/packages/rich-text-types/src/blocks.ts)
  //
  paragraph,
  "heading-1": heading1,
  "heading-2": heading2,
  "heading-3": heading3,
  "heading-4": heading4,
  "heading-5": heading5,
  "heading-6": heading6,
  hr,
  blockquote,
  "unordered-list": unorderedList,
  "ordered-list": orderedList,
  "list-item": listItem,
  table,
  "table-row": tableRow,
  "table-header-cell": tableHeaderCell,
  "table-cell": tableCell,
 
  "embedded-entry-block": embeddedEntryBlock, // TODO: Finish this component
  "embedded-asset-block": embeddedAssetBlock,
  // TODO: Potentially other components to handle
  // see https://github.com/contentful/rich-text/blob/3568691018866c2a4fdbfede27c0aa19f24b5b3f/packages/rich-text-types/src/blocks.ts
  // EMBEDDED_RESOURCE = 'embedded-resource-block',
 
  // Inline Types
  hyperlink,
  "entry-hyperlink": entryHyperlink,
  "asset-hyperlink": assetHyperlink,
  "embedded-entry-inline": embeddedEntry, // TODO: is this component needed?
};
 
export default nodes;