Fix page name special character bug (#1035)

* Fix page name special character bug

* update fix page name special character bug

* fix page name ending space
This commit is contained in:
Nuwan Sameera Alawatta 2020-10-19 10:48:27 +05:30 committed by GitHub
parent 4e99ab7ace
commit f5adc5732b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,9 +102,12 @@ export const flashElementById = (id: string) => {
}; };
export const resolveAsSpaceChar = (value: string, limit?: number) => { export const resolveAsSpaceChar = (value: string, limit?: number) => {
const separatorRegex = /[\W_]+/; const separatorRegex = /[^\w\s]/;
const duplicateSpaceRegex = /\s+/;
return value return value
.split(separatorRegex) .split(separatorRegex)
.join("")
.split(duplicateSpaceRegex)
.join(" ") .join(" ")
.slice(0, limit || 30); .slice(0, limit || 30);
}; };