Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add non-ASCII support
  • Loading branch information
tyxla committed Mar 6, 2023
commit e002a14ed643e8db2efd8857b66f32b51c792bad
17 changes: 14 additions & 3 deletions packages/editor/src/components/editor-help/index.native.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { paramCase as kebabCase } from 'change-case';
import { kebabCase } from 'lodash';
import { SafeAreaView, ScrollView, StyleSheet, View } from 'react-native';
import { TransitionPresets } from '@react-navigation/stack';

Expand Down Expand Up @@ -57,6 +57,14 @@ const HELP_TOPICS = [
},
];

const kebabCaseSettings = {
splitRegexp: [
/([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu, // One lowercase or digit, followed by one uppercase.
/([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu, // One uppercase followed by one uppercase and one lowercase.
],
stripRegexp: /(\p{C}|\p{P}|\p{S})+/giu, // Anything that's not a punctuation, symbol or control/format character.
};

function EditorHelpTopics( { close, isVisible, onClose, showSupport } ) {
const { postType } = useSelect( ( select ) => ( {
postType: select( editorStore ).getEditedPostAttribute( 'type' ),
Expand Down Expand Up @@ -145,7 +153,10 @@ function EditorHelpTopics( { close, isVisible, onClose, showSupport } ) {
index
) => {
const labelSlug =
kebabCase( label );
kebabCase(
label,
kebabCaseSettings
);
const isLastItem =
index ===
HELP_TOPICS.length -
Expand Down Expand Up @@ -178,7 +189,7 @@ function EditorHelpTopics( { close, isVisible, onClose, showSupport } ) {
</BottomSheet.NavigationScreen>
{ /* Print out help detail screens. */ }
{ HELP_TOPICS.map( ( { view, label } ) => {
const labelSlug = kebabCase( label );
const labelSlug = kebabCase( label, kebabCaseSettings );
return (
<HelpDetailNavigationScreen
key={ labelSlug }
Expand Down