@blocknote/xl-email-exporter 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ import { reactEmailBlockMappingForDefaultSchema } from "./blocks.js";
2
+ import { reactEmailInlineContentMappingForDefaultSchema } from "./inlinecontent.js";
3
+ import { reactEmailStyleMappingForDefaultSchema } from "./styles.js";
4
+
5
+ export const reactEmailDefaultSchemaMappings = {
6
+ blockMapping: reactEmailBlockMappingForDefaultSchema,
7
+ inlineContentMapping: reactEmailInlineContentMappingForDefaultSchema,
8
+ styleMapping: reactEmailStyleMappingForDefaultSchema,
9
+ };
@@ -0,0 +1,26 @@
1
+ import {
2
+ DefaultInlineContentSchema,
3
+ DefaultStyleSchema,
4
+ } from "@blocknote/core";
5
+ import { InlineContentMapping } from "@blocknote/core/src/exporter/mapping.js";
6
+ import { Link } from "@react-email/components";
7
+
8
+ export const reactEmailInlineContentMappingForDefaultSchema: InlineContentMapping<
9
+ DefaultInlineContentSchema,
10
+ DefaultStyleSchema,
11
+ React.ReactElement<typeof Link> | React.ReactElement<HTMLSpanElement>,
12
+ React.ReactElement<HTMLSpanElement>
13
+ > = {
14
+ link: (ic, t) => {
15
+ return (
16
+ <Link href={ic.href}>
17
+ {...ic.content.map((content) => {
18
+ return t.transformStyledText(content);
19
+ })}
20
+ </Link>
21
+ );
22
+ },
23
+ text: (ic, t) => {
24
+ return t.transformStyledText(ic);
25
+ },
26
+ };
@@ -0,0 +1,61 @@
1
+ import { DefaultStyleSchema, StyleMapping } from "@blocknote/core";
2
+ import { CSSProperties } from "react";
3
+
4
+ export const reactEmailStyleMappingForDefaultSchema: StyleMapping<
5
+ DefaultStyleSchema,
6
+ CSSProperties
7
+ > = {
8
+ bold: (val) => {
9
+ if (!val) {
10
+ return {};
11
+ }
12
+ return {
13
+ fontWeight: "bold",
14
+ };
15
+ },
16
+ italic: (val) => {
17
+ if (!val) {
18
+ return {};
19
+ }
20
+ return {
21
+ fontStyle: "italic",
22
+ };
23
+ },
24
+ underline: (val) => {
25
+ if (!val) {
26
+ return {};
27
+ }
28
+ return {
29
+ textDecoration: "underline", // TODO: could conflict with strike
30
+ };
31
+ },
32
+ strike: (val) => {
33
+ if (!val) {
34
+ return {};
35
+ }
36
+ return {
37
+ textDecoration: "line-through",
38
+ };
39
+ },
40
+ backgroundColor: (val) => {
41
+ return {
42
+ backgroundColor: val,
43
+ };
44
+ },
45
+ textColor: (val) => {
46
+ if (!val) {
47
+ return {};
48
+ }
49
+ return {
50
+ color: val,
51
+ };
52
+ },
53
+ code: (val) => {
54
+ if (!val) {
55
+ return {};
56
+ }
57
+ return {
58
+ fontFamily: "Courier",
59
+ };
60
+ },
61
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./defaultSchema/index.js";
2
+ export * from "./reactEmailExporter.jsx";