Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
Merge branch 'mauroromito/cjk_testing' of https://github.com/matrix-o…
Browse files Browse the repository at this point in the history
…rg/matrix-wysiwyg into mauroromito/cjk_testing
  • Loading branch information
Velin92 committed Jul 15, 2024
2 parents 13f6cda + d5bc8bd commit bf53631
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 10 additions & 2 deletions platforms/ios/example/WysiwygUITests/WysiwygUITests+Keyboard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,19 @@ extension WysiwygUITests {
app.keys["space"].tap()
app.keys["more"].tap()
app.keys["."].tap()
assertTextViewContent("hello how are you.")

// This optimisation to predictive inline text was introduced in 17.5
let correctText: String
if #available(iOS 17.5, *) {
correctText = "hello how are you."
} else {
correctText = "hello how are you ."
}
assertTextViewContent(correctText)
// In the failure case a second dot is added in the tree.
assertTreeEquals(
"""
└>"hello how are you."
└>"\(correctText)"
"""
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,10 @@ public extension WysiwygComposerViewModel {
/// accepting an inline predictive text suggestion. It then reconciles with the model if it did.
/// - Returns: Whether the an update was applied.
func updateDotAfterInlineTextPredicationIfNeeded() -> Bool {
// This optimisation to predictive inline text only came in in 17.5
guard #available(iOS 17.5, *) else {
return false
}
let text = textView.attributedText.htmlChars.withNBSP
let textSelection = textView.selectedRange
// Check if the last character in the editor is a dot.
Expand Down

0 comments on commit bf53631

Please sign in to comment.