From 85a5b18d9c534139914dd556bd9de8ebf23f814a Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Thu, 22 Apr 2021 14:46:05 +0300 Subject: [PATCH] fix custom tags active --- .../src/components/customtag/CustomTagBlockComponent.js | 4 ++-- .../components/customtag/CustomTagInlineOverlayCompoment.js | 4 ++-- .../CustomTagBlockService/CustomTagBlockTool.js | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js b/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js index ecdb3778f..0007779bd 100644 --- a/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js +++ b/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js @@ -133,7 +133,7 @@ const CustomTagBlockComponent = ({ isShowTag, item }) => { }; const onSelectTag = val => { - item.run(state, dispatch, val.replace(/ /g, '-')); + item.run(state, dispatch, val.replace(/ /g, '-').toLowerCase()); }; const renderTagList = () => { @@ -147,7 +147,7 @@ const CustomTagBlockComponent = ({ isShowTag, item }) => { <TagBoxWrapper key={uuidv4()}> <Box key={uuidv4()} /> <StyledButton - active={tagStatus[blockTag.label]} + active={JSON.parse(tagStatus[blockTag.label])} disabled={isDisabled} key={uuidv4()} label={blockTag.label} diff --git a/wax-prosemirror-components/src/components/customtag/CustomTagInlineOverlayCompoment.js b/wax-prosemirror-components/src/components/customtag/CustomTagInlineOverlayCompoment.js index aae723d72..8b0190dd5 100644 --- a/wax-prosemirror-components/src/components/customtag/CustomTagInlineOverlayCompoment.js +++ b/wax-prosemirror-components/src/components/customtag/CustomTagInlineOverlayCompoment.js @@ -149,7 +149,7 @@ const CustomTagInlineOverlayComponent = ({ mark, setPosition, position }) => { state.schema.marks.customTagInline.create({ ...((mark && mark.attrs) || {}), tags, - class: tags.toString().replace(/ /g, '-'), + class: tags.toString().replace(/ /g, '-').toLowerCase(), }), ), ); @@ -176,7 +176,7 @@ const CustomTagInlineOverlayComponent = ({ mark, setPosition, position }) => { state.schema.marks.customTagInline.create({ ...((mark && mark.attrs) || {}), tags, - class: tags.toString().replace(/ /g, '-'), + class: tags.toString().replace(/ /g, '-').toLowerCase(), }), ), ); diff --git a/wax-prosemirror-services/src/CustomTagService/CustomTagBlockService/CustomTagBlockTool.js b/wax-prosemirror-services/src/CustomTagService/CustomTagBlockService/CustomTagBlockTool.js index c53581338..1b76fbe62 100644 --- a/wax-prosemirror-services/src/CustomTagService/CustomTagBlockService/CustomTagBlockTool.js +++ b/wax-prosemirror-services/src/CustomTagService/CustomTagBlockService/CustomTagBlockTool.js @@ -26,7 +26,10 @@ class CustomTagBlockTool extends Tools { const tagsActive = {}; blockTags.forEach(tag => { - if (isActive && className === tag.label.replace(/ /g, '-')) { + if ( + isActive && + className === tag.label.replace(/ /g, '-').toLowerCase() + ) { tagsActive[tag.label] = true; } else { tagsActive[tag.label] = false; -- GitLab