Skip to content

Commit

Permalink
Handle deleteText for more than Thai language
Browse files Browse the repository at this point in the history
  • Loading branch information
seanghay authored Oct 29, 2024
1 parent f9ebbb8 commit 133b192
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/slate/src/transforms-text/delete-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,15 @@ export const deleteText: TextTransforms['delete'] = (editor, options = {}) => {
})
}

// For Thai script, deleting N character(s) backward should delete
// For Thai, Khmer, Lao, Burmese script, deleting N character(s) backward should delete
// N code point(s) instead of an entire grapheme cluster.
// Therefore, the remaining code points should be inserted back.
if (
isCollapsed &&
reverse &&
unit === 'character' &&
removedText.length > 1 &&
removedText.match(/[\u0E00-\u0E7F]+/)
removedText.match(/[\u0E00-\u0E7F\u1780-\u17ff\u0E80-\u0EFF\u1000-\u109F]+/)

Check failure on line 180 in packages/slate/src/transforms-text/delete-text.ts

View workflow job for this annotation

GitHub Actions / lint:eslint

Replace `/[\u0E00-\u0E7F\u1780-\u17ff\u0E80-\u0EFF\u1000-\u109F]+/` with `⏎········/[\u0E00-\u0E7F\u1780-\u17ff\u0E80-\u0EFF\u1000-\u109F]+/⏎······`
) {
Transforms.insertText(
editor,
Expand Down

0 comments on commit 133b192

Please sign in to comment.