diff --git a/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js b/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js index 0007779bd992404b7a0997d01283af3ce20d265e..4fd430a83f9045dfba02b0a224ca7aa25d6c0989 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 1b76fbe62e8334627e199e12897a5dc45ecfa1aa..8a4a64c4fb0bf8e764101107ec2eac627e399bc9 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); }; }