Thai tone marks and vowels at the end of the search term is wrongly removed. (#29071)

Co-authored-by: sukoom pornsuksiri <sukoom@mm.co.th>
Этот коммит содержится в:
Pattara Kiatisevi
2024-11-21 20:47:48 +07:00
коммит произвёл GitHub
родитель 2e13cbb84d
Коммит f0280d6dd4
4 изменённых файлов: 52 добавлений и 2 удалений

Просмотреть файл

@@ -275,9 +275,10 @@ const DEFAULT_OPTIONS: TextFormattingOptions = {
* Hangul Compatibility Jamo: \u3130-\u318f
* Cyrillic characters: \u0400-\u04ff, \u0500-\u052f
* Additional CJK and Hangul compatibility characters: \u2de0-\u2dff
* Thai characters: \u0e00-\u0e7f
**/
// eslint-disable-next-line no-misleading-character-class
export const cjkrPattern = /[\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff00-\uff9f\u4e00-\u9faf\u3400-\u4dbf\uac00-\ud7a3\u1100-\u11ff\u3130-\u318f\u0400-\u04ff\u0500-\u052f\u2de0-\u2dff]/;
export const cjkrPattern = /[\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff00-\uff9f\u4e00-\u9faf\u3400-\u4dbf\uac00-\ud7a3\u1100-\u11ff\u3130-\u318f\u0400-\u04ff\u0500-\u052f\u2de0-\u2dff\u0e00-\u0e7f]/;
export function formatText(
text: string,

Просмотреть файл

@@ -94,6 +94,11 @@ describe('TextFormatting.searchHighlighting', () => {
input: 'These are [words in a sentence](https://example.com).',
searchMatches: ['example'],
expected: '<p>These are <a class="theme markdown__link search-highlight" href="https://example.com" rel="noreferrer" target="_blank">words in a sentence</a>.</p>',
}, {
name: 'search match thai word',
input: 'สวัสดีนี่คือการทดสอบภาษาไทย',
searchMatches: ['สวัสดี'],
expected: '<p><span class="search-highlight">สวัสดี</span>นี่คือการทดสอบภาษาไทย</p>',
}];
for (const testCase of testCases) {