diff --git a/TODO.md b/TODO.md
index 4ae27f5..d352aaf 100644
--- a/TODO.md
+++ b/TODO.md
@@ -4,6 +4,7 @@
- [Collectibles] Create page for gallery
- [Collectibles] Create page for scans
+- Rich text, handle linebreak node type, remove spacer
## Long term
diff --git a/astro.config.ts b/astro.config.ts
index 4a1bd86..0236276 100644
--- a/astro.config.ts
+++ b/astro.config.ts
@@ -3,7 +3,7 @@ import { defineConfig } from "astro/config";
import node from "@astrojs/node";
import astroMetaTags from "astro-meta-tags";
import { loadEnv } from "vite";
-const { ASTRO_PORT, ASTRO_HOST } = loadEnv(process.env.NODE_ENV, process.cwd(), "");
+const { ASTRO_PORT, ASTRO_HOST } = loadEnv(process.env.NODE_ENV ?? "dev", process.cwd(), "");
// https://astro.build/config
export default defineConfig({
@@ -24,9 +24,7 @@ export default defineConfig({
],
// devToolbar: { enabled: false },
server: {
- port: parseInt(ASTRO_PORT),
- host: ASTRO_HOST,
+ port: parseInt(ASTRO_PORT ?? "4321"),
+ host: ASTRO_HOST ?? true,
},
});
-
-console.log(import.meta.env)
diff --git a/src/components/RichText/components/RTLinebreak.astro b/src/components/RichText/components/RTLinebreak.astro
new file mode 100644
index 0000000..cfdbed2
--- /dev/null
+++ b/src/components/RichText/components/RTLinebreak.astro
@@ -0,0 +1,13 @@
+---
+import type { RichTextContext } from "src/utils/richText";
+import type { RichTextLinebreakNode } from "src/shared/payload/payload-sdk";
+
+interface Props {
+ node: RichTextLinebreakNode;
+ context: RichTextContext;
+}
+---
+
+{/* ------------------------------------------- HTML ------------------------------------------- */}
+
+
diff --git a/src/components/RichText/components/RTNode.astro b/src/components/RichText/components/RTNode.astro
index c2dc25f..135457e 100644
--- a/src/components/RichText/components/RTNode.astro
+++ b/src/components/RichText/components/RTNode.astro
@@ -7,6 +7,7 @@ import RTBlock from "./RTBlock/RTBlock.astro";
import type { RichTextContext } from "src/utils/richText";
import {
isNodeBlockNode,
+ isNodeLinebreakNode,
isNodeLinkNode,
isNodeListNode,
isNodeParagraphNode,
@@ -16,6 +17,7 @@ import {
} from "src/shared/payload/payload-sdk";
import RTTab from "./RTTab.astro";
import ErrorMessage from "components/ErrorMessage.astro";
+import RTLinebreak from "./RTLinebreak.astro";
interface Props {
node: RichTextNode;
@@ -34,6 +36,8 @@ const { node, context } = Astro.props;
+ By default, empty paragraphs are not displayed. This is why adding empty paragraph (by + pressing Enter) will not result in additional space between elements. In order to + add empty space, put your carret at the end of the paragraph and press Shift+ + Enter + to create a linebreak. +
diff --git a/src/shared/payload/payload-sdk.ts b/src/shared/payload/payload-sdk.ts index 8e9aabf..f413942 100644 --- a/src/shared/payload/payload-sdk.ts +++ b/src/shared/payload/payload-sdk.ts @@ -1137,6 +1137,10 @@ export interface RichTextListCheckNode extends RichTextListNode { listType: "check"; } +export interface RichTextLinebreakNode extends RichTextNode { + type: "linebreak"; +} + export interface RichTextTextNode extends RichTextNode { type: "text"; format: number; @@ -1208,6 +1212,9 @@ export const isListNodeBulletListNode = (node: RichTextListNode): node is RichTe export const isListNodeCheckListNode = (node: RichTextListNode): node is RichTextListCheckNode => node.listType === "check"; +export const isNodeLinebreakNode = (node: RichTextNode): node is RichTextLinebreakNode => + node.type === "linebreak"; + export const isNodeTextNode = (node: RichTextNode): node is RichTextTextNode => node.type === "text";