Skip to content

Commit

Permalink
Strip hash char when creating new note from card
Browse files Browse the repository at this point in the history
  • Loading branch information
mgmeyers committed May 25, 2024
1 parent 1c4edcc commit f1a85c1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/Item/ItemMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const illegalCharsRegEx = /[\\/:"*?<>|]+/g;
const embedRegEx = /!?\[\[([^\]]*)\.[^\]]+\]\]/g;
const wikilinkRegEx = /!?\[\[([^\]]*)\]\]/g;
const mdLinkRegEx = /!?\[([^\]]*)\]\([^)]*\)/g;
const tagRegEx = /#([^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~[\]\\\s\n\r]+)/g;
const condenceWhiteSpaceRE = /\s+/g;

interface UseItemMenuParams {
setEditState: Dispatch<StateUpdater<EditState>>;
Expand Down Expand Up @@ -57,8 +59,10 @@ export function useItemMenu({
.replace(embedRegEx, '$1')
.replace(wikilinkRegEx, '$1')
.replace(mdLinkRegEx, '$1')
.replace(tagRegEx, '$1')
.replace(illegalCharsRegEx, ' ')
.trim();
.trim()
.replace(condenceWhiteSpaceRE, ' ');

const newNoteFolder = stateManager.getSetting('new-note-folder');
const newNoteTemplatePath = stateManager.getSetting('new-note-template');
Expand Down

0 comments on commit f1a85c1

Please sign in to comment.