     ///
     public func setHTMLUndoable(_ html: String) {
         replace(storage.rangeOfEntireString, withHTML: html)
-        recalculateTypingAttributes(at: selectedRange.location)
+        recalculateTypingAttributes()
     }
 
     /// Loads the specified HTML into the editor.

        font = defaultFont
        
        storage.setHTML(html, defaultAttributes: defaultAttributes)
        recalculateTypingAttributes(at: selectedRange.location)

        notifyTextViewDidChange()
        formattingDelegate?.textViewCommandToggledAStyle()

        }
    }
    
    /// 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) {
        
