Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3163 Description not capturing Bold/Italic. #3207

Merged
merged 2 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions openmetadata-ui/src/main/resources/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"dagre": "^0.8.5",
"diff": "^5.0.0",
"draft-js": "^0.11.7",
"draftjs-md-converter": "^1.5.2",
"fast-json-patch": "^3.0.0-1",
"html-react-parser": "^1.2.6",
"https-browserify": "^1.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
*/

import { convertFromRaw, convertToRaw, EditorState } from 'draft-js';
import { draftToMarkdown, markdownToDraft } from 'markdown-draft-js';
import { draftjsToMd } from 'draftjs-md-converter';
import { markdownToDraft } from 'markdown-draft-js';
import React, {
forwardRef,
useEffect,
Expand Down Expand Up @@ -46,13 +47,8 @@ const getIntialContent = (format: string, content?: string) => {
},
preserveNewlines: true,
});
const modifiedBlock = rawData.blocks.filter((data: any) => {
if (data.text) {
return data;
}
});

const state = convertFromRaw({ ...rawData, blocks: modifiedBlock });
const state = convertFromRaw({ ...rawData });

return EditorState.createWithContent(state);

Expand Down Expand Up @@ -90,9 +86,7 @@ const RichTextEditor = forwardRef<editorRef, EditorProp>(
getEditorContent(format: 'json' | 'markdown') {
switch (format) {
case Format.MARKDOWN:
return draftToMarkdown(
convertToRaw(editorState.getCurrentContent())
);
return draftjsToMd(convertToRaw(editorState.getCurrentContent()));

case Format.JSON:
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -900,3 +900,8 @@ body .profiler-graph .recharts-active-dot circle {
background: #ebeef1;
font-size: 90%;
}

/* Markdown with preview editor css */
.public-DraftStyleDefault-block {
margin: 0;
}