From 2baa28a996311124b36f7b357a1cc7c391cc301b Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Thu, 22 Apr 2021 21:37:34 +0300
Subject: [PATCH] tags fix

---
 .../components/customtag/CustomTagBlockComponent.js    | 10 ++++------
 .../CustomTagBlockService/CustomTagBlockTool.js        |  2 +-
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js b/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js
index 0007779bd..4fd430a83 100644
--- a/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js
+++ b/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js
@@ -132,10 +132,6 @@ const CustomTagBlockComponent = ({ isShowTag, item }) => {
     }
   };
 
-  const onSelectTag = val => {
-    item.run(state, dispatch, val.replace(/ /g, '-').toLowerCase());
-  };
-
   const renderTagList = () => {
     const tagList = [];
     const blockTags = allTags.filter(tag => {
@@ -147,11 +143,13 @@ const CustomTagBlockComponent = ({ isShowTag, item }) => {
         <TagBoxWrapper key={uuidv4()}>
           <Box key={uuidv4()} />
           <StyledButton
-            active={JSON.parse(tagStatus[blockTag.label])}
+            active={tagStatus[blockTag.label]}
             disabled={isDisabled}
             key={uuidv4()}
             label={blockTag.label}
-            onMouseDown={() => onSelectTag(blockTag.label)}
+            onMouseDown={() => {
+              item.run(activeView.state, activeView.dispatch, blockTag.label);
+            }}
             title={blockTag.label}
           />
         </TagBoxWrapper>,
diff --git a/wax-prosemirror-services/src/CustomTagService/CustomTagBlockService/CustomTagBlockTool.js b/wax-prosemirror-services/src/CustomTagService/CustomTagBlockService/CustomTagBlockTool.js
index 1b76fbe62..8a4a64c4f 100644
--- a/wax-prosemirror-services/src/CustomTagService/CustomTagBlockService/CustomTagBlockTool.js
+++ b/wax-prosemirror-services/src/CustomTagService/CustomTagBlockService/CustomTagBlockTool.js
@@ -8,7 +8,7 @@ class CustomTagBlockTool extends Tools {
   get run() {
     return (state, dispatch, val) => {
       Commands.setBlockType(state.config.schema.nodes.customTagBlock, {
-        class: val,
+        class: val.replace(/ /g, '-').toLowerCase(),
       })(state, dispatch);
     };
   }
-- 
GitLab