Fix HTML rendering for service descriptions, allow zero price for services, improve image_url handling

This commit is contained in:
2026-02-01 22:31:00 -06:00
parent d3cad0e5fa
commit 72f17c8be9
32 changed files with 6958 additions and 414 deletions

View File

@@ -1,4 +1,4 @@
import React from "react";
import React, { useEffect } from "react";
import { useEditor, EditorContent } from "@tiptap/react";
import StarterKit from "@tiptap/starter-kit";
import Placeholder from "@tiptap/extension-placeholder";
@@ -95,10 +95,14 @@ const MenuBar = ({ editor }) => {
};
const RichTextEditor = ({
value,
content,
onChange,
placeholder = "Enter description...",
}) => {
// Support both 'value' and 'content' props for flexibility
const initialContent = value || content || "";
const editor = useEditor({
extensions: [
StarterKit,
@@ -106,12 +110,23 @@ const RichTextEditor = ({
placeholder,
}),
],
content,
content: initialContent,
onUpdate: ({ editor }) => {
onChange(editor.getHTML());
},
});
// Update editor content when value/content prop changes externally
useEffect(() => {
if (editor && initialContent !== undefined) {
const currentContent = editor.getHTML();
// Only update if the content is actually different (prevents cursor jump)
if (currentContent !== initialContent && initialContent !== "<p></p>") {
editor.commands.setContent(initialContent);
}
}
}, [editor, initialContent]);
return (
<div
className="border border-border rounded-md overflow-hidden resize-y min-h-[240px] max-h-[600px]"