feat: migration von directus zu payloadcms
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 1m19s
Build & Deploy / 🧪 QA (push) Failing after 3m32s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🏗️ Build (push) Failing after 7m51s
Build & Deploy / ⚡ Lighthouse (push) Has been skipped
Build & Deploy / 🧪 Smoke Test (push) Has been skipped
Build & Deploy / ♿ WCAG (push) Has been skipped
Build & Deploy / 🛡️ Quality Gates (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 10s
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 1m19s
Build & Deploy / 🧪 QA (push) Failing after 3m32s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🏗️ Build (push) Failing after 7m51s
Build & Deploy / ⚡ Lighthouse (push) Has been skipped
Build & Deploy / 🧪 Smoke Test (push) Has been skipped
Build & Deploy / ♿ WCAG (push) Has been skipped
Build & Deploy / 🛡️ Quality Gates (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 10s
This commit is contained in:
@@ -6,7 +6,7 @@ export const Media: CollectionConfig = {
|
||||
read: () => true,
|
||||
},
|
||||
admin: {
|
||||
useAsTitle: 'alt',
|
||||
useAsTitle: 'filename',
|
||||
defaultColumns: ['filename', 'alt', 'updatedAt'],
|
||||
},
|
||||
upload: {
|
||||
|
||||
@@ -16,7 +16,6 @@ import { SplitHeading } from '../blocks/SplitHeading';
|
||||
export const Posts: CollectionConfig = {
|
||||
slug: 'posts',
|
||||
admin: {
|
||||
useAsTitle: 'title',
|
||||
defaultColumns: ['featuredImage', 'title', 'date', 'updatedAt', '_status'],
|
||||
},
|
||||
versions: {
|
||||
|
||||
@@ -17,7 +17,6 @@ import { ProductTabs } from '../blocks/ProductTabs';
|
||||
export const Products: CollectionConfig = {
|
||||
slug: 'products',
|
||||
admin: {
|
||||
useAsTitle: 'title',
|
||||
defaultColumns: ['featuredImage', 'title', 'sku', 'locale', 'updatedAt', '_status'],
|
||||
},
|
||||
versions: {
|
||||
|
||||
@@ -56,10 +56,8 @@ function ensureChildren(parsedNodes: any[]): any[] {
|
||||
function parseInlineMarkdown(text: string): any[] {
|
||||
// Simple regex-based inline parser for bold and italic
|
||||
// Matches **bold**, __bold__, *italic*, _italic_
|
||||
const regex = /(\*\*|__|TextNode)(.*?)\1|(\*|_)(.*?)\3/g;
|
||||
const nodes: any[] = [];
|
||||
let lastIndex = 0;
|
||||
let match;
|
||||
|
||||
const createTextNode = (content: string, format = 0) => ({
|
||||
detail: 0,
|
||||
@@ -231,10 +229,12 @@ export function parseMarkdownToLexical(markdown: string): any[] {
|
||||
return text
|
||||
.replace(/<section[^>]*>/g, '')
|
||||
.replace(/<\/section>/g, '')
|
||||
.replace(/<h3[^>]*>(.*?)<\/h3>/g, '### $1\n\n')
|
||||
.replace(/<p[^>]*>(.*?)<\/p>/g, '$1\n\n')
|
||||
.replace(/<strong[^>]*>(.*?)<\/strong>/g, '**$1**')
|
||||
.replace(/<h[1-6][^>]*>([\s\S]*?)<\/h[1-6]>/g, '### $1\n\n')
|
||||
.replace(/<p[^>]*>([\s\S]*?)<\/p>/g, '$1\n\n')
|
||||
.replace(/<strong[^>]*>([\s\S]*?)<\/strong>/g, '**$1**')
|
||||
.replace(/<em[^>]*>([\s\S]*?)<\/em>/g, '_$1_')
|
||||
.replace(/ /g, ' ')
|
||||
.replace(/^(#{1,6}\s+.*)$/gm, '\n\n$1\n\n') // MAKE HEADINGS THEIR OWN CHUNK
|
||||
.trim();
|
||||
}
|
||||
|
||||
@@ -330,6 +330,11 @@ export function parseMarkdownToLexical(markdown: string): any[] {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip horizontal rules (---)
|
||||
if (/^-{3,}$/.test(chunk)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const headingMatch = chunk.match(/^(#{1,6})\s+(.*)/);
|
||||
if (headingMatch) {
|
||||
const level = Math.min(headingMatch[1].length + 1, 6);
|
||||
@@ -342,6 +347,18 @@ export function parseMarkdownToLexical(markdown: string): any[] {
|
||||
direction: 'ltr',
|
||||
children: parseInlineMarkdown(headingMatch[2]),
|
||||
});
|
||||
// If there's more text after the heading line in this chunk, emit as paragraph(s)
|
||||
const rest = chunk.slice(chunk.indexOf('\n') + 1).trim();
|
||||
if (rest && chunk.includes('\n')) {
|
||||
// Split remaining lines by single newlines for multi-paragraph support
|
||||
const subParagraphs = rest.split(/\n\s*\n/);
|
||||
for (const sub of subParagraphs) {
|
||||
const trimmed = sub.trim();
|
||||
if (trimmed && !/^-{3,}$/.test(trimmed)) {
|
||||
nodes.push(paragraphNode(trimmed));
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user