Skip to content

Commit

Permalink
Merge pull request #1552 from wordpress-mobile/fix/1530-lowercase-key…
Browse files Browse the repository at this point in the history
…board

Prevents selection after ZWSP character
  • Loading branch information
koke authored Nov 8, 2019
2 parents 63c882d + 6aba2a2 commit 3bd133a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
* Include block title in Unsupported block's UI
* Show new-block-indicator when no blocks at all and when at the last block
* Use existing links in the clipboard to prefill url field when inserting new link.
* [iOS] Fix issue where the keyboard would not capitalize sentences correctly on some cases.

1.16.1
------
*[iOS] Fix tap on links bug that reappear on iOS 13.2
* [iOS] Fix tap on links bug that reappear on iOS 13.2

1.16.0
------
Expand Down
15 changes: 15 additions & 0 deletions react-native-aztec/ios/RNTAztecView/RCTAztecView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,16 @@ class RCTAztecView: Aztec.TextView {
let caretData = packCaretDataForRN()
onSelectionChange(caretData)
}

// MARK: - Selection
private func correctSelectionAfterLastEmptyLine() {
guard selectedTextRange?.start == endOfDocument,
let characterToReplaceLastEmptyLine = storage.htmlConverter.characterToReplaceLastEmptyLine,
text == String(characterToReplaceLastEmptyLine) else {
return
}
selectedTextRange = self.textRange(from: beginningOfDocument, to: beginningOfDocument)
}
}

// MARK: UITextView Delegate Methods
Expand All @@ -630,9 +640,14 @@ extension RCTAztecView: UITextViewDelegate {
return
}

correctSelectionAfterLastEmptyLine()
propagateSelectionChanges()
}

func textViewDidBeginEditing(_ textView: UITextView) {
correctSelectionAfterLastEmptyLine()
}

func textViewDidChange(_ textView: UITextView) {
guard isInsertingDictationResult == false else {
return
Expand Down

0 comments on commit 3bd133a

Please sign in to comment.