This repository has been archived by the owner on Oct 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
See if slashing new categories helps #200
Closed
kienstra
wants to merge
6
commits into
try/add-new-categories-in-editor-ui
from
add/see-if-slashes-help
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9094563
See if slashing pattern categories helps
kienstra eb95160
Fix linting errors
kienstra c664b37
Fix the stripIllegalChars() regex
kienstra 068ce3e
Simplify slashing
kienstra 0ede93a
Simplify toKebabCase(), so it only converts to - on space and _
kienstra 5a044fc
Fix linting errors
kienstra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function stripIllegalChars( toConvert: string ) { | ||
return toConvert.replace( /[^\s\w_-]/g, '' ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
/** Converts a string to a kebab-case. */ | ||
export default function toKebabCase( toConvert = '' ) { | ||
return toConvert | ||
.replace( /[_\W]+(?=\w+)/g, '-' ) | ||
.replace( /[^-\w]/g, '' ) | ||
return toConvert.replace( /[\s_]+/g, '-' ) | ||
.toLowerCase(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this stripped all non-word characters, it caused a category with an apostrophe to be saved without the apostrophe, and therefore never appear in the categories react-select.
This issue appeared because with the PHP edits below, categories can now have an apostrophe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's what it looked like without this fix in
toKebabCase.ts
: