From d1c904ae4be84e7aa86deba87fffa6ccf84a3cee Mon Sep 17 00:00:00 2001 From: Sachin Chaurasiya Date: Sun, 15 Aug 2021 15:06:47 +0530 Subject: [PATCH] Fixed markdown bullet list exception (#177) * fixed markdown bullet list exception * minor changes --- .../main/resources/ui/src/assets/svg/list-ul.svg | 1 + .../ui/src/components/common/popover/PopOver.tsx | 3 ++- .../common/rich-text-editor/RichTextEditor.tsx | 14 +++++++++++--- .../rich-text-editor/RichTextEditorPreviewer.tsx | 8 ++++++++ .../common/rich-text-editor/ToolBarOptions.jsx | 5 ++++- .../src/main/resources/ui/src/styles/temp.css | 10 ++++++++++ 6 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 catalog-rest-service/src/main/resources/ui/src/assets/svg/list-ul.svg diff --git a/catalog-rest-service/src/main/resources/ui/src/assets/svg/list-ul.svg b/catalog-rest-service/src/main/resources/ui/src/assets/svg/list-ul.svg new file mode 100644 index 00000000000..ae3ea22a096 --- /dev/null +++ b/catalog-rest-service/src/main/resources/ui/src/assets/svg/list-ul.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/catalog-rest-service/src/main/resources/ui/src/components/common/popover/PopOver.tsx b/catalog-rest-service/src/main/resources/ui/src/components/common/popover/PopOver.tsx index ed14a10b200..07391273b55 100644 --- a/catalog-rest-service/src/main/resources/ui/src/components/common/popover/PopOver.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/components/common/popover/PopOver.tsx @@ -22,6 +22,7 @@ import 'react-tippy/dist/tippy.css'; import { PopOverProp, Position, Size, Theme, Trigger } from './PopOverTypes'; const PopOver: React.FC = ({ + arrow = true, children, className = '', html, @@ -33,7 +34,7 @@ const PopOver: React.FC = ({ }): JSX.Element => { return ( { /*eslint-disable */ @@ -115,7 +116,15 @@ const RichTextEditor = forwardRef( editorState={editorState} readOnly={readonly} toolbar={{ - options: [], + options: ['list'], + list: { + className: 'my-list tw-order-4', + options: ['unordered'], + unordered: { + icon: ListUl, + className: 'list-option ', + }, + }, }} toolbarClassName="tw-py-2 tw-border-0 tw-border-b tw-border-main" toolbarCustomButtons={ @@ -123,7 +132,6 @@ const RichTextEditor = forwardRef( , , , - , ] } toolbarHidden={readonly} diff --git a/catalog-rest-service/src/main/resources/ui/src/components/common/rich-text-editor/RichTextEditorPreviewer.tsx b/catalog-rest-service/src/main/resources/ui/src/components/common/rich-text-editor/RichTextEditorPreviewer.tsx index 39edaa551ea..ef45ffc29da 100644 --- a/catalog-rest-service/src/main/resources/ui/src/components/common/rich-text-editor/RichTextEditorPreviewer.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/components/common/rich-text-editor/RichTextEditorPreviewer.tsx @@ -39,6 +39,14 @@ const RichTextEditorPreviewer = ({ markdown }: { markdown: string }) => { h4: 'p', h5: 'p', h6: 'p', + ul: ({ node, children, ...props }) => { + const { ordered: _ordered, ...rest } = props; + return ( +
    + {children} +
+ ); + }, }} remarkPlugins={[gfm]} /> diff --git a/catalog-rest-service/src/main/resources/ui/src/components/common/rich-text-editor/ToolBarOptions.jsx b/catalog-rest-service/src/main/resources/ui/src/components/common/rich-text-editor/ToolBarOptions.jsx index 1c1f8421b6c..471c919ac34 100644 --- a/catalog-rest-service/src/main/resources/ui/src/components/common/rich-text-editor/ToolBarOptions.jsx +++ b/catalog-rest-service/src/main/resources/ui/src/components/common/rich-text-editor/ToolBarOptions.jsx @@ -84,6 +84,7 @@ export class Bold extends Component { return (
- +
); diff --git a/catalog-rest-service/src/main/resources/ui/src/styles/temp.css b/catalog-rest-service/src/main/resources/ui/src/styles/temp.css index 139c4be35de..81267a6a670 100644 --- a/catalog-rest-service/src/main/resources/ui/src/styles/temp.css +++ b/catalog-rest-service/src/main/resources/ui/src/styles/temp.css @@ -687,3 +687,13 @@ strong { body .rdw-editor-main pre { background: none; } + +body .public-DraftStyleDefault-ul li::marker { + content: '- '; +} +.list-option img { + width: 16px; +} +body .list-option.rdw-option-active { + box-shadow: none; +}