(.*?)<\/li>/g, '* $1\n');
+ });
+
+ // Convert headings
+ html = html.replace(/(.*?)<\/h1>/g, 'h1. $1');
+ html = html.replace(/(.*?)<\/h2>/g, 'h2. $1');
+ html = html.replace(/(.*?)<\/h3>/g, 'h3. $1');
+
+ // Convert paragraphs
+ html = html.replace(/
(.*?)<\/p>/g, '$1\n');
+
+ // Handle line breaks
+ html = html.replace(/
/g, '\n');
+
+ // Remove any remaining HTML tags
+ html = html.replace(/<\/?[^>]+(>|$)/g, "");
+
+ return html.trim();
+};
+
// Helper to render the description markdown
const renderMarkdown = (content: string) => {
const convertedContent = convertJiraToMarkdown(content);
@@ -216,7 +279,10 @@ export function SupportDetail() {
const ticketData = await getTicket(ticketId);
if (ticketData && ticketData.length === 1) {
setTicket(ticketData[0]);
- setNewDescription(ticketData[0].fields.description || '');
+
+ console.log("Description", ticketData[0].fields.description);
+
+ setNewDescription(convertJiraToHtml(ticketData[0].fields.description) || '');
} else {
setError(trans("support.ticketNotFound"));
}
@@ -240,7 +306,8 @@ export function SupportDetail() {
const handleSaveDescription = async () => {
setIsSavingDescription(true); // Start loading state
try {
- await updateTicketDescription(ticketId, newDescription);
+ const jiraFormattedDescription = convertHtmlToJiraMarkdown(newDescription);
+ await updateTicketDescription(ticketId, jiraFormattedDescription);
message.success(trans("support.ticketDescriptionUpdated"));
setIsEditingDescription(false);
} catch (error) {
@@ -309,9 +376,8 @@ export function SupportDetail() {
} else {
message.warning(trans("support.ticketAttachmentEmpty"));
}
- };
-
-
+ };
+
if (loading) {
return (
@@ -376,10 +442,16 @@ export function SupportDetail() {
{isEditingDescription ? (
<>
-
Fetched URL: http://github.com/lowcoder-org/lowcoder/pull/1197.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy