Skip to content

Commit

Permalink
[iOS]Fix: Oddly formatted text hangs Gutenberg (#1352)
Browse files Browse the repository at this point in the history
* Enable batch editing on font change

* Remove unnecessary `removeAttribute` call
  • Loading branch information
pinarol authored Sep 5, 2019
1 parent 6f1647d commit eeace3d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions react-native-aztec/ios/RNTAztecView/RCTAztecView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -508,12 +508,14 @@ class RCTAztecView: Aztec.TextView {

let fullRange = NSRange(location: 0, length: textStorage.length)

textStorage.beginEditing()
textStorage.enumerateAttributes(in: fullRange, options: []) { (attributes, subrange, stop) in
let oldFont = font(from: attributes)
let newFont = applyFontConstraints(to: oldFont)

textStorage.addAttribute(.font, value: newFont, range: subrange)
}
textStorage.endEditing()

refreshTypingAttributesAndPlaceholderFont()
}
Expand Down

0 comments on commit eeace3d

Please sign in to comment.