diff --git a/client/src/controllers/SlugController.ts b/client/src/controllers/SlugController.ts index 968d42b59b..ddb8539503 100644 --- a/client/src/controllers/SlugController.ts +++ b/client/src/controllers/SlugController.ts @@ -63,9 +63,9 @@ export class SlugController extends Controller { event: CustomEvent<{ value: string }> | { detail: { value: string } }, ignoreUpdate = false, ) { - const unicodeSlugsEnabled = this.allowUnicodeValue; + const allowUnicode = this.allowUnicodeValue; const { value = this.element.value } = event?.detail || {}; - const newValue = slugify(value.trim(), { unicodeSlugsEnabled }); + const newValue = slugify(value.trim(), { allowUnicode }); if (!ignoreUpdate) { this.element.value = newValue; diff --git a/client/src/utils/slugify.test.js b/client/src/utils/slugify.test.js index 897093a92b..3987268acb 100644 --- a/client/src/utils/slugify.test.js +++ b/client/src/utils/slugify.test.js @@ -12,7 +12,7 @@ describe('slugify', () => { }); describe('slugify with unicode slugs enabled', () => { - const options = { unicodeSlugsEnabled: true }; + const options = { allowUnicode: true }; it('should return a correct slug', () => { expect(slugify('The Price is $72.00!', options)).toBe( diff --git a/client/src/utils/slugify.ts b/client/src/utils/slugify.ts index a926ceb47c..ee10927dcf 100644 --- a/client/src/utils/slugify.ts +++ b/client/src/utils/slugify.ts @@ -4,9 +4,9 @@ */ export const slugify = ( value: string, - { unicodeSlugsEnabled = false }: { unicodeSlugsEnabled?: boolean } = {}, + { allowUnicode = false }: { allowUnicode?: boolean } = {}, ) => - unicodeSlugsEnabled + allowUnicode ? value .replace(/\s+/g, '-') .replace(/[&/\\#,+()$~%.'":`@^!*?<>{}]/g, '')