         font = defaultFont
         
         storage.setHTML(html, defaultAttributes: defaultAttributes)
-        recalculateTypingAttributes(at: selectedRange.location)
+        recalculateTypingAttributes()
 
         notifyTextViewDidChange()
         formattingDelegate?.textViewCommandToggledAStyle()

        
        set {
            if let start = newValue?.start {
                // we need to calculate the new typing attributes before we change the selected text range.
                // because when we change it it trigger an onChange(textView) callback that may try to retrieve the attributes that are wrong.
                let position = self.offset(from: self.beginningOfDocument, to: start)
                recalculateTypingAttributes(at: position)
            }

        }
    }
    
    /// Convenience method to recalculate the typing attributes for the current `selectedRange`.
    ///
    private func recalculateTypingAttributes() {
        let location = selectedRange.location
        
        recalculateTypingAttributes(at: location)
    }
    
    /// Recalculate the typing attributes as if the caret was at the provided location.  This method is useful
    /// when the caret is about to be moved to the specified location, but we want the `typingAttributes` to be
    /// recalculated before the text view's `textViewDidChangeSelection(_:)` is called.
    ///
    /// Only call this method when sure that the typingAttributes need to be recalculated.  Keep in mind that
    /// recalculating the typingAttributes in the wrong moment can cause trouble (for example reverting a decision
    /// by the user to turn a style off).
    ///
    /// https://github.com/wordpress-mobile/AztecEditor-iOS/issues/1140
    ///
    /// - Parameters:
    ///     - location: the new caret location.
    ///
    private func recalculateTypingAttributes(at location: Int) {
        
