Skip to content

Commit 1d07112

Browse files
authored
Merge pull request #1225 from wordpress-mobile/release/1.11.0
Release v1.11.0
2 parents 965c3db + 81e1e1b commit 1d07112

21 files changed

Lines changed: 219 additions & 153 deletions

File tree

.circleci/config.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2.1
22

33
orbs:
44
# This uses the iOS Orb located at https://github.com/wordpress-mobile/circleci-orbs
5-
ios: wordpress-mobile/ios@0.0.32
5+
ios: wordpress-mobile/ios@0.0.36
66

77
workflows:
88
test_and_validate:
@@ -28,5 +28,28 @@ workflows:
2828
name: Validate WordPress-Editor-iOS.podspec
2929
xcode-version: "11.0"
3030
podspec-path: WordPress-Editor-iOS.podspec
31-
# Updating specs is needed since WordPress-Editor-iOS depends on WordPress-Aztec-iOS
32-
update-specs-repo: true
31+
# Reference WordPress-Aztec-iOS.podspec locally so we don't have to get it from the specs repo
32+
additional-parameters: --include-podspecs=WordPress-Aztec-iOS.podspec
33+
34+
- ios/publish-podspec:
35+
name: Publish WordPress-Aztec-iOS to Trunk
36+
xcode-version: "11.0"
37+
podspec-path: WordPress-Aztec-iOS.podspec
38+
post-to-slack: true
39+
filters:
40+
tags:
41+
only: /.*/
42+
branches:
43+
ignore: /.*/
44+
45+
- ios/publish-podspec:
46+
name: Publish WordPress-Editor-iOS to Trunk
47+
requires: [ "Publish WordPress-Aztec-iOS to Trunk" ]
48+
xcode-version: "11.0"
49+
podspec-path: WordPress-Editor-iOS.podspec
50+
post-to-slack: true
51+
filters:
52+
tags:
53+
only: /.*/
54+
branches:
55+
ignore: /.*/

Aztec.xcodeproj/project.pbxproj

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,18 @@
231231
FF24AC991F0146AF003CA91D /* Assets.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF24AC981F0146AF003CA91D /* Assets.swift */; };
232232
FF437B6420D7CB2D000D9666 /* HTMLLi.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF437B6320D7CB2D000D9666 /* HTMLLi.swift */; };
233233
FF437B6620D7CB83000D9666 /* LiFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF437B6520D7CB83000D9666 /* LiFormatter.swift */; };
234+
FF48CAC8234DD5D3007FFC79 /* NSMutableAttributedString+ReplaceAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF48CAC7234DD5D3007FFC79 /* NSMutableAttributedString+ReplaceAttributes.swift */; };
234235
FF4E26601EA8DF1E005E8E42 /* ImageAttachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF4E265F1EA8DF1E005E8E42 /* ImageAttachment.swift */; };
235236
FF61909E202481F4004BCD0A /* CodeFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF61909D202481F4004BCD0A /* CodeFormatter.swift */; };
236237
FF7A1C511E5651EA00C4C7C8 /* LineAttachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF7A1C501E5651EA00C4C7C8 /* LineAttachment.swift */; };
237238
FF7C89B01E3BC52F000472A8 /* NSAttributedString+FontTraits.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF7C89AF1E3BC52F000472A8 /* NSAttributedString+FontTraits.swift */; };
239+
FF7EAEC4234D253B007A26E0 /* FontProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF7EAEC3234D253B007A26E0 /* FontProvider.swift */; };
238240
FFA61E891DF18F3D00B71BF6 /* ParagraphStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFA61E881DF18F3D00B71BF6 /* ParagraphStyle.swift */; };
239241
FFA61EC21DF6C1C900B71BF6 /* NSAttributedString+Archive.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFA61EC11DF6C1C900B71BF6 /* NSAttributedString+Archive.swift */; };
240242
FFB5D29720BEB21A0038DCFB /* CiteFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFB5D29620BEB21A0038DCFB /* CiteFormatter.swift */; };
241243
FFD0FEB71DAE59A700430586 /* NSLayoutManager+Attachments.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFD0FEB61DAE59A700430586 /* NSLayoutManager+Attachments.swift */; };
244+
FFD3C1712344DB4E00AE8DA0 /* ForegroundColorCSSAttributeMatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFD3C1702344DB4E00AE8DA0 /* ForegroundColorCSSAttributeMatcher.swift */; };
245+
FFD3C1732344DCA900AE8DA0 /* ForegroundColorElementAttributeConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFD3C1722344DCA900AE8DA0 /* ForegroundColorElementAttributeConverter.swift */; };
242246
FFD436981E3180A500A0E26F /* FontFormatterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFD436971E3180A500A0E26F /* FontFormatterTests.swift */; };
243247
FFFEC7DB1EA7698900F4210F /* VideoAttachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFFEC7DA1EA7698900F4210F /* VideoAttachment.swift */; };
244248
/* End PBXBuildFile section */
@@ -503,6 +507,7 @@
503507
FF24AC981F0146AF003CA91D /* Assets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Assets.swift; sourceTree = "<group>"; };
504508
FF437B6320D7CB2D000D9666 /* HTMLLi.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HTMLLi.swift; sourceTree = "<group>"; };
505509
FF437B6520D7CB83000D9666 /* LiFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LiFormatter.swift; sourceTree = "<group>"; };
510+
FF48CAC7234DD5D3007FFC79 /* NSMutableAttributedString+ReplaceAttributes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSMutableAttributedString+ReplaceAttributes.swift"; sourceTree = "<group>"; };
506511
FF4E265F1EA8DF1E005E8E42 /* ImageAttachment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageAttachment.swift; sourceTree = "<group>"; };
507512
FF5B98E21DC29D0C00571CA4 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; };
508513
FF5B98E41DC355B400571CA4 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = SOURCE_ROOT; };
@@ -511,11 +516,14 @@
511516
FF7A1C4A1E51F05700C4C7C8 /* CONTRIBUTING.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = CONTRIBUTING.md; sourceTree = "<group>"; };
512517
FF7A1C501E5651EA00C4C7C8 /* LineAttachment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LineAttachment.swift; sourceTree = "<group>"; };
513518
FF7C89AF1E3BC52F000472A8 /* NSAttributedString+FontTraits.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSAttributedString+FontTraits.swift"; sourceTree = "<group>"; };
519+
FF7EAEC3234D253B007A26E0 /* FontProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontProvider.swift; sourceTree = "<group>"; };
514520
FFA61E881DF18F3D00B71BF6 /* ParagraphStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ParagraphStyle.swift; sourceTree = "<group>"; };
515521
FFA61EC11DF6C1C900B71BF6 /* NSAttributedString+Archive.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSAttributedString+Archive.swift"; sourceTree = "<group>"; };
516522
FFB5D29620BEB21A0038DCFB /* CiteFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CiteFormatter.swift; sourceTree = "<group>"; };
517523
FFC2BBF81F2A25CF00E404FB /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = "<group>"; };
518524
FFD0FEB61DAE59A700430586 /* NSLayoutManager+Attachments.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSLayoutManager+Attachments.swift"; sourceTree = "<group>"; };
525+
FFD3C1702344DB4E00AE8DA0 /* ForegroundColorCSSAttributeMatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ForegroundColorCSSAttributeMatcher.swift; sourceTree = "<group>"; };
526+
FFD3C1722344DCA900AE8DA0 /* ForegroundColorElementAttributeConverter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ForegroundColorElementAttributeConverter.swift; sourceTree = "<group>"; };
519527
FFD436971E3180A500A0E26F /* FontFormatterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FontFormatterTests.swift; sourceTree = "<group>"; };
520528
FFFEC7DA1EA7698900F4210F /* VideoAttachment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoAttachment.swift; sourceTree = "<group>"; };
521529
/* End PBXFileReference section */
@@ -742,6 +750,7 @@
742750
FFD0FEB61DAE59A700430586 /* NSLayoutManager+Attachments.swift */,
743751
F1584795203C9B4C00EE05A1 /* NSMutableAttributedString+ParagraphProperty.swift */,
744752
F10BE6171EA7ADA6002E4625 /* NSMutableAttributedString+ReplaceOcurrences.swift */,
753+
FF48CAC7234DD5D3007FFC79 /* NSMutableAttributedString+ReplaceAttributes.swift */,
745754
F18733C41DA096EE005AEB80 /* NSRange+Helpers.swift */,
746755
FF20D6431EDC395E00294B78 /* NSTextingResult+Helpers.swift */,
747756
F1C05B9C1E37FA77007510EA /* String+CharacterName.swift */,
@@ -800,6 +809,7 @@
800809
FFA61E881DF18F3D00B71BF6 /* ParagraphStyle.swift */,
801810
B5A99D831EBA073D00DED081 /* HTMLStorage.swift */,
802811
F9982CF521877663001E606B /* TextViewPasteboardDelegate.swift */,
812+
FF7EAEC3234D253B007A26E0 /* FontProvider.swift */,
803813
);
804814
path = TextKit;
805815
sourceTree = "<group>";
@@ -898,6 +908,7 @@
898908
F1098740214FF55F00983B6A /* BoldElementAttributeConverter.swift */,
899909
F109874421501A2F00983B6A /* ItalicElementAttributeConverter.swift */,
900910
F109874821501C8B00983B6A /* UnderlineElementAttributeConverter.swift */,
911+
FFD3C1722344DCA900AE8DA0 /* ForegroundColorElementAttributeConverter.swift */,
901912
);
902913
path = Implementations;
903914
sourceTree = "<group>";
@@ -1087,6 +1098,7 @@
10871098
F15BA610215167D200424120 /* CSSAttributeMatcher.swift */,
10881099
F1F5C9DA21516E4B00F67990 /* ItalicCSSAttributeMatcher.swift */,
10891100
F1F5C9DC2151702600F67990 /* UnderlineCSSAttributeMatcher.swift */,
1101+
FFD3C1702344DB4E00AE8DA0 /* ForegroundColorCSSAttributeMatcher.swift */,
10901102
);
10911103
path = CSS;
10921104
sourceTree = "<group>";
@@ -1524,6 +1536,8 @@
15241536
B572AC281E817CFE008948C2 /* CommentAttachment.swift in Sources */,
15251537
F1E1D5881FEC52EE0086B339 /* GenericElementConverter.swift in Sources */,
15261538
F1FA0E861E6EF514009D98EE /* Node.swift in Sources */,
1539+
FFD3C1712344DB4E00AE8DA0 /* ForegroundColorCSSAttributeMatcher.swift in Sources */,
1540+
FFD3C1732344DCA900AE8DA0 /* ForegroundColorElementAttributeConverter.swift in Sources */,
15271541
F1656FDE2152A6A6009C7E3A /* CiteStringAttributeConverter.swift in Sources */,
15281542
599F254B1D8BC9A1002871D6 /* String+RangeConversion.swift in Sources */,
15291543
599F25481D8BC9A1002871D6 /* Metrics.swift in Sources */,
@@ -1565,6 +1579,7 @@
15651579
F165D92A20C72EF500EAA6B0 /* Array+ShortcodeAttribute.swift in Sources */,
15661580
F165D92420C72C1000EAA6B0 /* ShortcodeAttributeSerializer.swift in Sources */,
15671581
F177FF751FB6404D00CBBE35 /* UILayoutPriority+Swift4.swift in Sources */,
1582+
FF7EAEC4234D253B007A26E0 /* FontProvider.swift in Sources */,
15681583
F1C05B9D1E37FA77007510EA /* String+CharacterName.swift in Sources */,
15691584
F1FF7D9F201A1D24007B0B32 /* Figcaption.swift in Sources */,
15701585
FF17B2D2227A589F0022AECE /* LIElementConverter.swift in Sources */,
@@ -1631,6 +1646,7 @@
16311646
599F25381D8BC9A1002871D6 /* InAttributesConverter.swift in Sources */,
16321647
B551A4A01E770B3800EE3A7F /* UIFont+Emoji.swift in Sources */,
16331648
F13E8AD820B71BAA007C9F8A /* PluginManager.swift in Sources */,
1649+
FF48CAC8234DD5D3007FFC79 /* NSMutableAttributedString+ReplaceAttributes.swift in Sources */,
16341650
F12F586E1EF20394008AE298 /* LinkFormatter.swift in Sources */,
16351651
F1584796203C9B4C00EE05A1 /* NSMutableAttributedString+ParagraphProperty.swift in Sources */,
16361652
F15BA6092151501300424120 /* BoldStringAttributeConverter.swift in Sources */,
@@ -1800,7 +1816,7 @@
18001816
GCC_WARN_UNUSED_FUNCTION = YES;
18011817
GCC_WARN_UNUSED_VARIABLE = YES;
18021818
HEADER_SEARCH_PATHS = /usr/include/libxml2;
1803-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
1819+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
18041820
MTL_ENABLE_DEBUG_INFO = YES;
18051821
ONLY_ACTIVE_ARCH = YES;
18061822
OTHER_LDFLAGS = "-lxml2";
@@ -1861,7 +1877,7 @@
18611877
GCC_WARN_UNUSED_FUNCTION = YES;
18621878
GCC_WARN_UNUSED_VARIABLE = YES;
18631879
HEADER_SEARCH_PATHS = /usr/include/libxml2;
1864-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
1880+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
18651881
MTL_ENABLE_DEBUG_INFO = NO;
18661882
OTHER_LDFLAGS = "-lxml2";
18671883
SDKROOT = iphoneos;
@@ -1893,6 +1909,7 @@
18931909
);
18941910
INFOPLIST_FILE = Aztec/Info.plist;
18951911
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
1912+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
18961913
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
18971914
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
18981915
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1922,6 +1939,7 @@
19221939
);
19231940
INFOPLIST_FILE = Aztec/Info.plist;
19241941
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
1942+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
19251943
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
19261944
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
19271945
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2063,7 +2081,7 @@
20632081
GCC_WARN_UNUSED_FUNCTION = YES;
20642082
GCC_WARN_UNUSED_VARIABLE = YES;
20652083
HEADER_SEARCH_PATHS = /usr/include/libxml2;
2066-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
2084+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
20672085
MTL_ENABLE_DEBUG_INFO = NO;
20682086
ONLY_ACTIVE_ARCH = YES;
20692087
OTHER_LDFLAGS = "-lxml2";
@@ -2095,6 +2113,7 @@
20952113
);
20962114
INFOPLIST_FILE = Aztec/Info.plist;
20972115
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
2116+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
20982117
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
20992118
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
21002119
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2175,7 +2194,7 @@
21752194
GCC_WARN_UNUSED_FUNCTION = YES;
21762195
GCC_WARN_UNUSED_VARIABLE = YES;
21772196
HEADER_SEARCH_PATHS = /usr/include/libxml2;
2178-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
2197+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
21792198
MTL_ENABLE_DEBUG_INFO = YES;
21802199
ONLY_ACTIVE_ARCH = YES;
21812200
OTHER_LDFLAGS = "-lxml2";
@@ -2208,6 +2227,7 @@
22082227
);
22092228
INFOPLIST_FILE = Aztec/Info.plist;
22102229
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
2230+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
22112231
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
22122232
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
22132233
PRODUCT_NAME = "$(TARGET_NAME)";
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import Foundation
2+
import UIKit
3+
4+
class ForegroundColorElementAttributesConverter: ElementAttributeConverter {
5+
6+
let cssAttributeMatcher = ForegroundColorCSSAttributeMatcher()
7+
8+
func convert(
9+
_ attribute: Attribute,
10+
inheriting attributes: [NSAttributedString.Key: Any]) -> [NSAttributedString.Key: Any] {
11+
12+
guard let cssColor = attribute.firstCSSAttribute(ofType: .foregroundColor),
13+
let colorValue = cssColor.value,
14+
let color = UIColor(hexString: colorValue) else {
15+
return attributes
16+
}
17+
18+
var attributes = attributes
19+
20+
attributes[.foregroundColor] = color
21+
22+
return attributes
23+
}
24+
}

Aztec/Classes/EditorView/EditorView.swift

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,10 @@ public class EditorView: UIView {
107107

108108
self.htmlTextView = htmlTextView
109109
self.richTextView = richTextView
110-
111-
if #available(iOS 11, *) {
112-
htmlTextView.smartInsertDeleteType = .no
113-
htmlTextView.smartDashesType = .no
114-
htmlTextView.smartQuotesType = .no
115-
}
110+
111+
htmlTextView.smartInsertDeleteType = .no
112+
htmlTextView.smartDashesType = .no
113+
htmlTextView.smartQuotesType = .no
116114

117115
super.init(coder: aDecoder)
118116

@@ -129,12 +127,10 @@ public class EditorView: UIView {
129127

130128
self.htmlTextView = UITextView(frame: .zero, textContainer: container)
131129
self.richTextView = TextView(defaultFont: defaultFont, defaultParagraphStyle: defaultParagraphStyle, defaultMissingImage: defaultMissingImage)
132-
133-
if #available(iOS 11, *) {
134-
htmlTextView.smartInsertDeleteType = .no
135-
htmlTextView.smartDashesType = .no
136-
htmlTextView.smartQuotesType = .no
137-
}
130+
131+
htmlTextView.smartInsertDeleteType = .no
132+
htmlTextView.smartDashesType = .no
133+
htmlTextView.smartQuotesType = .no
138134

139135
super.init(frame: .zero)
140136

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import Foundation
2+
import UIKit
3+
4+
public extension NSMutableAttributedString {
5+
6+
/// Replace all instances of the .font attribute that belong to the same family for the new font, trying to keep the same symbolic traits
7+
/// - Parameter font: the original font to be replaced
8+
/// - Parameter newFont: the new font to use.
9+
func replace(font: UIFont, with newFont: UIFont) {
10+
let fullRange = NSRange(location: 0, length: length)
11+
12+
beginEditing()
13+
enumerateAttributes(in: fullRange, options: []) { (attributes, subrange, stop) in
14+
guard let currentFont = attributes[.font] as? UIFont, currentFont.familyName == font.familyName else {
15+
return
16+
}
17+
var replacementFont = newFont
18+
if let fontDescriptor = newFont.fontDescriptor.withSymbolicTraits(currentFont.fontDescriptor.symbolicTraits) {
19+
replacementFont = UIFont(descriptor: fontDescriptor, size: currentFont.pointSize)
20+
}
21+
addAttribute(.font, value: replacementFont, range: subrange)
22+
}
23+
endEditing()
24+
}
25+
}

Aztec/Classes/Formatters/Implementations/CodeFormatter.swift

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,8 @@ class CodeFormatter: AttributeFormatter {
1212

1313
// MARK: - Init
1414

15-
init(monospaceFont: UIFont = UIFont(descriptor:UIFontDescriptor(name: "Courier", size: 12), size:12), backgroundColor: UIColor = UIColor.lightGray) {
16-
let font: UIFont
17-
18-
if #available(iOS 11.0, *) {
19-
font = UIFontMetrics.default.scaledFont(for: monospaceFont)
20-
} else {
21-
font = monospaceFont
22-
}
23-
self.monospaceFont = font
15+
init(monospaceFont: UIFont = FontProvider.shared.monospaceFont, backgroundColor: UIColor = UIColor.lightGray) {
16+
self.monospaceFont = monospaceFont
2417
self.backgroundColor = backgroundColor
2518
self.htmlRepresentationKey = .codeHtmlRepresentation
2619
}

Aztec/Classes/Formatters/Implementations/PreFormatter.swift

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,10 @@ open class PreFormatter: ParagraphAttributeFormatter {
1414
///
1515
let placeholderAttributes: [NSAttributedString.Key: Any]?
1616

17-
1817
/// Designated Initializer
1918
///
20-
init(monospaceFont: UIFont = UIFont(descriptor:UIFontDescriptor(name: "Courier", size: 12), size:12), placeholderAttributes: [NSAttributedString.Key : Any]? = nil) {
21-
let font: UIFont
22-
23-
if #available(iOS 11.0, *) {
24-
font = UIFontMetrics.default.scaledFont(for: monospaceFont)
25-
} else {
26-
font = monospaceFont
27-
}
28-
29-
self.monospaceFont = font
19+
init(monospaceFont: UIFont = FontProvider.shared.monospaceFont, placeholderAttributes: [NSAttributedString.Key : Any]? = nil) {
20+
self.monospaceFont = monospaceFont
3021
self.placeholderAttributes = placeholderAttributes
3122
}
3223

Aztec/Classes/GUI/FormatBar/FormatBar.swift

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,7 @@ open class FormatBar: UIView {
326326
open override func didMoveToWindow() {
327327
super.didMoveToWindow()
328328

329-
if #available(iOS 11.0, *) {
330-
updateForSafeAreaInsets()
331-
}
329+
updateForSafeAreaInsets()
332330
}
333331

334332
open override func layoutSubviews() {
@@ -683,13 +681,8 @@ private extension FormatBar {
683681
/// Sets up the Constraints
684682
///
685683
func configureConstraints() {
686-
var leadingAnchor = self.leadingAnchor
687-
var trailingAnchor = self.trailingAnchor
688-
689-
if #available(iOS 11.0, *) {
690-
leadingAnchor = safeAreaLayoutGuide.leadingAnchor
691-
trailingAnchor = safeAreaLayoutGuide.trailingAnchor
692-
}
684+
let leadingAnchor = safeAreaLayoutGuide.leadingAnchor
685+
let trailingAnchor = safeAreaLayoutGuide.trailingAnchor
693686

694687
///Overflow toggle item
695688

Aztec/Classes/Libxml2/DOM/Data/CSSAttributeType.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ extension CSSAttributeType {
2323
public static let fontStyle = CSSAttributeType("font-style")
2424
public static let fontWeight = CSSAttributeType("font-weight")
2525
public static let textDecoration = CSSAttributeType("text-decoration")
26+
public static let foregroundColor = CSSAttributeType("color")
2627

2728
}
2829

0 commit comments

Comments
 (0)