Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.19.7 #1347

Merged
merged 8 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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