From 124a1f6de15fdf6271fffc881570f2973507af2d Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Sun, 7 Feb 2021 11:55:59 +0200 Subject: [PATCH] render tag list --- .../components/customtag/CustomTagBlockComponent.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js b/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js index 7533870f3..bbe93cd97 100644 --- a/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js +++ b/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js @@ -87,7 +87,16 @@ const CustomTagBlockComponent = ({ isShowTag, item }) => { item.run(state, dispatch, val.replace(/ /g, '-')); }; - console.log(allTags); + const renderTagList = () => { + const tagList = []; + const blockTags = allTags.filter(tag => { + return tag.tagType === 'block'; + }); + blockTags.forEach(blockTag => { + tagList.push(<span key={uuidv4()}>{blockTag.label}</span>); + }); + return <div>{tagList}</div>; + }; return useMemo( () => ( @@ -103,6 +112,7 @@ const CustomTagBlockComponent = ({ isShowTag, item }) => { <Add onClick={onClickAdd}>Add</Add> </FlexDiv> )} + {renderTagList()} </Wrapper> ), [isShowTag, inputValue], -- GitLab