Skip to content
Snippets Groups Projects
Commit 85a5b18d authored by chris's avatar chris
Browse files

fix custom tags active

parent f709347d
No related branches found
No related tags found
1 merge request!285fix custom tags active
...@@ -133,7 +133,7 @@ const CustomTagBlockComponent = ({ isShowTag, item }) => { ...@@ -133,7 +133,7 @@ const CustomTagBlockComponent = ({ isShowTag, item }) => {
}; };
const onSelectTag = val => { const onSelectTag = val => {
item.run(state, dispatch, val.replace(/ /g, '-')); item.run(state, dispatch, val.replace(/ /g, '-').toLowerCase());
}; };
const renderTagList = () => { const renderTagList = () => {
...@@ -147,7 +147,7 @@ const CustomTagBlockComponent = ({ isShowTag, item }) => { ...@@ -147,7 +147,7 @@ const CustomTagBlockComponent = ({ isShowTag, item }) => {
<TagBoxWrapper key={uuidv4()}> <TagBoxWrapper key={uuidv4()}>
<Box key={uuidv4()} /> <Box key={uuidv4()} />
<StyledButton <StyledButton
active={tagStatus[blockTag.label]} active={JSON.parse(tagStatus[blockTag.label])}
disabled={isDisabled} disabled={isDisabled}
key={uuidv4()} key={uuidv4()}
label={blockTag.label} label={blockTag.label}
......
...@@ -149,7 +149,7 @@ const CustomTagInlineOverlayComponent = ({ mark, setPosition, position }) => { ...@@ -149,7 +149,7 @@ const CustomTagInlineOverlayComponent = ({ mark, setPosition, position }) => {
state.schema.marks.customTagInline.create({ state.schema.marks.customTagInline.create({
...((mark && mark.attrs) || {}), ...((mark && mark.attrs) || {}),
tags, tags,
class: tags.toString().replace(/ /g, '-'), class: tags.toString().replace(/ /g, '-').toLowerCase(),
}), }),
), ),
); );
...@@ -176,7 +176,7 @@ const CustomTagInlineOverlayComponent = ({ mark, setPosition, position }) => { ...@@ -176,7 +176,7 @@ const CustomTagInlineOverlayComponent = ({ mark, setPosition, position }) => {
state.schema.marks.customTagInline.create({ state.schema.marks.customTagInline.create({
...((mark && mark.attrs) || {}), ...((mark && mark.attrs) || {}),
tags, tags,
class: tags.toString().replace(/ /g, '-'), class: tags.toString().replace(/ /g, '-').toLowerCase(),
}), }),
), ),
); );
......
...@@ -26,7 +26,10 @@ class CustomTagBlockTool extends Tools { ...@@ -26,7 +26,10 @@ class CustomTagBlockTool extends Tools {
const tagsActive = {}; const tagsActive = {};
blockTags.forEach(tag => { blockTags.forEach(tag => {
if (isActive && className === tag.label.replace(/ /g, '-')) { if (
isActive &&
className === tag.label.replace(/ /g, '-').toLowerCase()
) {
tagsActive[tag.label] = true; tagsActive[tag.label] = true;
} else { } else {
tagsActive[tag.label] = false; tagsActive[tag.label] = false;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment