From ca6b75522ebac85411e739e2eb8b50da91295428 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Sun, 7 Feb 2021 00:48:02 +0200 Subject: [PATCH] trim spaces --- .../src/components/customtag/CustomTagBlockComponent.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js b/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js index cd5c49190..f21443aa4 100644 --- a/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js +++ b/wax-prosemirror-components/src/components/customtag/CustomTagBlockComponent.js @@ -79,7 +79,6 @@ const CustomTagBlockComponent = props => { const serviceConfig = app.config.get('config.CustomTagService'); const [serviceList, setServiceList] = useState([]); const isActive = item.active(activeView.state, activeViewId, type); - console.log(isActive); const onChangeTagName = e => { setTagName(e.target.value); @@ -87,7 +86,7 @@ const CustomTagBlockComponent = props => { }; const onClickAdd = () => { - if (tagName === '') return; + if (tagName.trim() === '') return; let tagNameList = []; if (localStorage.getItem('tagBlockList') === null) { tagNameList.push({ label: tagName, type: 'block' }); @@ -102,8 +101,7 @@ const CustomTagBlockComponent = props => { }; const onSelectTag = (e, val) => { - val = val.replace(/ /g, '-'); - item.run(state, dispatch, val); + item.run(state, dispatch, val.replace(/ /g, '-')); }; useDeepCompareEffect(() => { -- GitLab