Skip to content

Commit

Permalink
Merge pull request #1347 from wordpress-mobile/release/1.19.7
Browse files Browse the repository at this point in the history
Release 1.19.7
  • Loading branch information
fluiddot authored Jan 5, 2022
2 parents bd01a63 + 156cb9e commit fc279aa
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 3 additions & 1 deletion Aztec/Classes/Formatters/Implementations/PreFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions Aztec/Classes/TextKit/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 7 additions & 1 deletion Aztec/Classes/TextKit/TextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -738,7 +742,9 @@ open class TextView: UITextView {
evaluateRemovalOfSingleLineParagraphAttributesAfterSelectionChange()
ensureRemovalOfParagraphAttributesWhenPressingBackspaceAndEmptyingTheDocument()
ensureCursorRedraw(afterEditing: deletedString.string)
recalculateTypingAttributes()
if shouldRecalculateTypingAttributesOnDeleteBackward {
recalculateTypingAttributes()
}
notifyTextViewDidChange()
}

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion WordPress-Aztec-iOS.podspec
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion WordPress-Editor-iOS.podspec
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit fc279aa

Please sign in to comment.