diff --git a/Aztec/Classes/Formatters/Implementations/HeaderFormatter.swift b/Aztec/Classes/Formatters/Implementations/HeaderFormatter.swift index d69bf3707..0f97f8621 100644 --- a/Aztec/Classes/Formatters/Implementations/HeaderFormatter.swift +++ b/Aztec/Classes/Formatters/Implementations/HeaderFormatter.swift @@ -114,6 +114,10 @@ private extension HeaderFormatter { } func headerFontSize(for type: Header.HeaderType, defaultSize: Float?) -> Float { + if Configuration.useDefaultFont { + return defaultSize! + } + guard type == .none, let defaultSize = defaultSize else { return type.fontSize } diff --git a/Aztec/Classes/Formatters/Implementations/PreFormatter.swift b/Aztec/Classes/Formatters/Implementations/PreFormatter.swift index cf6ecbbd4..a31c5ad09 100644 --- a/Aztec/Classes/Formatters/Implementations/PreFormatter.swift +++ b/Aztec/Classes/Formatters/Implementations/PreFormatter.swift @@ -30,8 +30,10 @@ open class PreFormatter: ParagraphAttributeFormatter { newParagraphStyle.appendProperty(HTMLPre(with: representation)) + let defaultFont = attributes[.font] + resultingAttributes[.paragraphStyle] = newParagraphStyle - resultingAttributes[.font] = monospaceFont + resultingAttributes[.font] = Configuration.useDefaultFont ? defaultFont : monospaceFont return resultingAttributes } diff --git a/Aztec/Classes/TextKit/Configuration.swift b/Aztec/Classes/TextKit/Configuration.swift index 898385828..116cef2a2 100644 --- a/Aztec/Classes/TextKit/Configuration.swift +++ b/Aztec/Classes/TextKit/Configuration.swift @@ -3,6 +3,7 @@ import Foundation public final class Configuration { public static var headersWithBoldTrait = false + public static var useDefaultFont = false static var defaultBoldFormatter: AttributeFormatter { get { diff --git a/Aztec/Classes/TextKit/TextView.swift b/Aztec/Classes/TextKit/TextView.swift index 186429c92..b02ba55f3 100644 --- a/Aztec/Classes/TextKit/TextView.swift +++ b/Aztec/Classes/TextKit/TextView.swift @@ -178,6 +178,10 @@ open class TextView: UITextView { /// open var shouldNotifyOfNonUserChanges = true + /// If this is true the typing attributes will be recalculated when deleting backward + /// + open var shouldRecalculateTypingAttributesOnDeleteBackward = true + // MARK: - Customizable Input VC private var customInputViewController: UIInputViewController? @@ -738,7 +742,9 @@ open class TextView: UITextView { evaluateRemovalOfSingleLineParagraphAttributesAfterSelectionChange() ensureRemovalOfParagraphAttributesWhenPressingBackspaceAndEmptyingTheDocument() ensureCursorRedraw(afterEditing: deletedString.string) - recalculateTypingAttributes() + if shouldRecalculateTypingAttributesOnDeleteBackward { + recalculateTypingAttributes() + } notifyTextViewDidChange() } diff --git a/CHANGELOG.md b/CHANGELOG.md index 42e95d34f..f4c74771e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +1.19.7 +------- +* Add variable to control whether typing attributes should be recalculated when deleting backward. +* Allow using the default font for the PreFormatter/HeaderFormatter. + 1.19.6 ------- * Add support for Mark inline formatting. diff --git a/WordPress-Aztec-iOS.podspec b/WordPress-Aztec-iOS.podspec index 61899a38e..8eacfefaa 100644 --- a/WordPress-Aztec-iOS.podspec +++ b/WordPress-Aztec-iOS.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'WordPress-Aztec-iOS' - s.version = '1.19.6' + s.version = '1.19.7' s.summary = 'The native HTML Editor.' s.description = <<-DESC diff --git a/WordPress-Editor-iOS.podspec b/WordPress-Editor-iOS.podspec index c0295ac96..729a5c3b1 100644 --- a/WordPress-Editor-iOS.podspec +++ b/WordPress-Editor-iOS.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'WordPress-Editor-iOS' - s.version = '1.19.6' + s.version = '1.19.7' s.summary = 'The WordPress HTML Editor.' s.description = <<-DESC