     ///
     /// - Returns: true if we should remove the paragraph attributes. false otherwise!
     ///
-    func mustRemoveParagraphAttributes(beforeInserting text: String, at location: Int) -> Bool {
-        guard text == String(.newline) else {
+    func mustRemoveParagraphAttributes(beforeInserting text: String? = nil, at location: Int) -> Bool {
+        guard text == String(.newline) || location == storage.length else {
             return false
         }
 

    /// Removes the Paragraph Attributes whenever `mustRemoveParagraphAttributes(beforeInserting: at)` returns true.
    ///
    /// - Parameters:
    ///     - text: String that's about to be inserted.
    ///     - range: Range in which the string will be inserted.
    ///
    /// - Returns: true if ParagraphAttributes were removed. false otherwise!
    ///
    @discardableResult
    func ensureRemovalOfParagraphAttributes(beforeInserting text: String, at range: NSRange) -> Bool {
        guard mustRemoveParagraphAttributes(beforeInserting: text, at: range.location) else {
            return false
        }

        return removeParagraphAttributes(at: range)
    }


    /// Removes the Paragraph Attributes whenever `mustRemoveParagraphAttributes(at:)` returns true.
    ///
    /// - Parameter range: Editing Range
    ///
    /// - Returns: true if ParagraphAttributes were removed. false otherwise!
    ///
    @discardableResult
    func ensureRemovalOfParagraphAttributes(at range: NSRange) -> Bool {
        guard mustRemoveParagraphAttributes(at: range.location) else {
            return false
        }

        return removeParagraphAttributes(at: range)
    }


    /// Indicates whether ParagraphStyles should be removed before inserting a given string, at a specified location.
    /// This is valid whenever:
    ///
    ///     A. The user just typed a new line
    ///     B. The previous character contains just a newline (OR) there is no previous character
    ///     C. The next character is a newline (or we're at the end of the text storage)
    ///     D. We're at the beginning of a new line
    ///
    /// - Parameters:
    ///     - text: String that is about to be inserted.

        let beforeRange = NSRange(location: location - 1, length: 1)
        let beforeString = storage.safeSubstring(at: beforeRange) ?? String(.newline)

        return beforeString == String(.newline) && afterString == String(.newline)
    }


