Prisma Studio - Model `Text` Fields and Markdown Content Formatting
Bug description
When using Prisma Studio is used to save Markdown Content into a String field (DataSource = MySQL), it appears that Newlines, Tabs, and possibly other spaces are trimmed, which results in a loss of markdown formatting when the content is retrieved from database.
Before: User Submitted Content (Example)
## Heading
Paragraph
After: Prisma Content Saved
## Heading
Paragraph
How to reproduce
This Assumes there is a working Project with Next.js and Prisma ORM, and a Database Model that utilizes a Text field with rich content such as HTML or Markdown.
- Launch Prisma Studio (
npx prisma studio) - Edit a
contentfield with Markdown Content - Save Changes to DB
- Retrieve Markdown Content from DB
- Parse Markdown Content
- Notice content formatting and render is incorrect
Expected behavior
Prisma Studio should honor Newlines, Tabs, spaces and possibly other characters for rich content stored in Text or String based fields. The Studio UI could support both a Plain-Text and Rich-Text mode editor so edited content is preserved exactly as entered.
Prisma information
model Post {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
published Boolean @default(false)
title String @db.VarChar(255)
slug String? @unique @db.VarChar(255)
content String? @db.Text
author User? @relation(fields: [authorId], references: [id])
authorId Int?
}
const post = await prisma.post.findUnique({
where: {
slug: slug
}
})
return {
post
}
// Content in Markdown
// console.log(post.content)
Environment & setup
- OS: MacOS
- Database: MySQL
- Node.js version: v19.2.0
Prisma Version
prisma : 4.6.1
@prisma/client : 4.6.1
Current platform : darwin
Studio : 0.476.0
I think prisma studio should have a built in rich text editor
+1
this would be awesome. more than markdown, just new lines would be great
I am experiencing same problem