         
         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.
+                // We need to calculate the new typing attributes before we change the selected text range.
+                // This is because as soon as we change the selected text range bellow, a call to
+                // `textViewDidChangeSelection(_:)` will be triggered and we want the typing attributes to
+                // be updated by then.
                 let position = self.offset(from: self.beginningOfDocument, to: start)
                 recalculateTypingAttributes(at: position)
             }

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

        notifyTextViewDidChange()
        formattingDelegate?.textViewCommandToggledAStyle()

    ///
    public func setHTMLUndoable(_ html: String) {
        replace(storage.rangeOfEntireString, withHTML: html)
        recalculateTypingAttributes()
    }

    /// Loads the specified HTML into the editor.
