feat: Notion-like rich text editor with TipTap, 4 note types, slash commands & bubble menu
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m33s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m33s
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { clsx, type ClassValue } from "clsx"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
import { LABEL_COLORS, LabelColorName, QueryType, Note } from "./types"
|
||||
import { LABEL_COLORS, LabelColorName, QueryType, Note, NoteType } from "./types"
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
@@ -50,8 +50,14 @@ export function asArray<T = unknown>(val: unknown, fallback: T[] = []): T[] {
|
||||
* Guarantees array fields are always real arrays or null.
|
||||
*/
|
||||
export function parseNote(dbNote: any): Note {
|
||||
let noteType: NoteType = dbNote.type || 'text'
|
||||
if (noteType === 'text' && dbNote.isMarkdown) {
|
||||
noteType = 'markdown'
|
||||
}
|
||||
return {
|
||||
...dbNote,
|
||||
type: noteType,
|
||||
isMarkdown: noteType === 'markdown',
|
||||
checkItems: asArray(dbNote.checkItems, null as any) ?? null,
|
||||
labels: asArray(dbNote.labels) || null,
|
||||
images: asArray(dbNote.images) || null,
|
||||
|
||||
Reference in New Issue
Block a user