@@ -1040,8 +1040,7 @@ class BackwardsCompatibleRegExp {
1040
1040
1041
1041
export class TitleCaseAction extends AbstractCaseAction {
1042
1042
1043
- public static titleBoundary = new BackwardsCompatibleRegExp ( '(^|[^\\p{L}\\p{N}])\\p{L}' , 'gmu' ) ;
1044
- public static apostrophe = new BackwardsCompatibleRegExp ( '\\p{L}\'\\p{L}' , 'gmu' ) ;
1043
+ public static titleBoundary = new BackwardsCompatibleRegExp ( '(?:^|[^\\p{L}\\p{N}\']|(?:(?:^|[^\\p{L}\\p{N}])\'))\\p{L}' , 'gmu' ) ;
1045
1044
1046
1045
constructor ( ) {
1047
1046
super ( {
@@ -1054,15 +1053,13 @@ export class TitleCaseAction extends AbstractCaseAction {
1054
1053
1055
1054
protected _modifyText ( text : string , wordSeparators : string ) : string {
1056
1055
const titleBoundary = TitleCaseAction . titleBoundary . get ( ) ;
1057
- const apostrophe = TitleCaseAction . apostrophe . get ( ) ;
1058
- if ( ! titleBoundary || ! apostrophe ) {
1056
+ if ( ! titleBoundary ) {
1059
1057
// cannot support this
1060
1058
return text ;
1061
1059
}
1062
1060
return text
1063
1061
. toLocaleLowerCase ( )
1064
- . replace ( titleBoundary , ( b ) => b . toLocaleUpperCase ( ) )
1065
- . replace ( apostrophe , ( a ) => a . toLocaleLowerCase ( ) ) ;
1062
+ . replace ( titleBoundary , ( b ) => b . toLocaleUpperCase ( ) ) ;
1066
1063
}
1067
1064
}
1068
1065
@@ -1118,6 +1115,6 @@ registerEditorAction(LowerCaseAction);
1118
1115
if ( SnakeCaseAction . caseBoundary . isSupported ( ) && SnakeCaseAction . singleLetters . isSupported ( ) ) {
1119
1116
registerEditorAction ( SnakeCaseAction ) ;
1120
1117
}
1121
- if ( TitleCaseAction . titleBoundary . isSupported ( ) && TitleCaseAction . apostrophe . isSupported ( ) ) {
1118
+ if ( TitleCaseAction . titleBoundary . isSupported ( ) ) {
1122
1119
registerEditorAction ( TitleCaseAction ) ;
1123
1120
}
0 commit comments