diff --git a/package-lock.json b/package-lock.json index fbf7d72618f..d189ecd2ee3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -75,6 +75,7 @@ "prosemirror-utils": "^1.0.0-0", "prosemirror-view": "^1.28.0", "proxy-polyfill": "^0.3.2", + "slug": "^8.0.0", "tippy.js": "^6.3.7", "uuid": "^9.0.0", "vue": "^2.7.10", @@ -17031,6 +17032,11 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/slug": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/slug/-/slug-8.0.0.tgz", + "integrity": "sha512-aIDda8JjwGHPPVHRAusym8OmXhw1PnM6P28/ShUUv/4RsUVYwxwL0eljtcBDg0yI4UbW7YADrZTWp1bLqa7+DQ==" + }, "node_modules/sockjs": { "version": "0.3.24", "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.24.tgz", @@ -32915,6 +32921,11 @@ } } }, + "slug": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/slug/-/slug-8.0.0.tgz", + "integrity": "sha512-aIDda8JjwGHPPVHRAusym8OmXhw1PnM6P28/ShUUv/4RsUVYwxwL0eljtcBDg0yI4UbW7YADrZTWp1bLqa7+DQ==" + }, "sockjs": { "version": "0.3.24", "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.24.tgz", diff --git a/package.json b/package.json index e66bc4a0986..b1d4d288ea2 100644 --- a/package.json +++ b/package.json @@ -100,6 +100,7 @@ "prosemirror-utils": "^1.0.0-0", "prosemirror-view": "^1.28.0", "proxy-polyfill": "^0.3.2", + "slug": "^8.0.0", "tippy.js": "^6.3.7", "uuid": "^9.0.0", "vue": "^2.7.10", @@ -145,7 +146,7 @@ ], "moduleNameMapper": { "^@/(.*)$": "/src/$1", - "\\.(css)$": "identity-obj-proxy" + "\\.(css)$": "identity-obj-proxy" }, "testPathIgnorePatterns": [ "/src/tests/fixtures/", @@ -163,8 +164,6 @@ "setupFilesAfterEnv": [ "/src/tests/setup.js" ], - "transformIgnorePatterns": [ - - ] + "transformIgnorePatterns": [] } } diff --git a/src/nodes/Heading/slug.js b/src/nodes/Heading/slug.js index 266a42ed313..e0867ff091c 100644 --- a/src/nodes/Heading/slug.js +++ b/src/nodes/Heading/slug.js @@ -1,10 +1 @@ -const regexSpaces = /\s+/g -const regexInvalidCaracters = /[^\p{Letter}\p{Mark}\w\s-]/gu - -const slugify = (str) => String(str) - .toLowerCase() - .replace(regexInvalidCaracters, '') - .trim() - .replace(regexSpaces, '-') - -export { slugify } +export { default as slugify } from 'slug'