Skip to content

Commit 0c7247e

Browse files
authored
Merge pull request #1230 from wordpress-mobile/release/1.12.0
Release/1.12.0
2 parents 53ccd95 + 2a9d0fc commit 0c7247e

9 files changed

Lines changed: 115 additions & 54 deletions

File tree

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
version: 2.1
22

33
orbs:
4-
# This uses the iOS Orb located at https://github.com/wordpress-mobile/circleci-orbs
5-
ios: wordpress-mobile/ios@0.0.36
4+
# Using 1.0 of our Orbs means it will use the latest 1.0.x version from https://github.com/wordpress-mobile/circleci-orbs
5+
ios: wordpress-mobile/ios@1.0
66

77
workflows:
88
test_and_validate:

Aztec/Classes/TextKit/LayoutManager.swift

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ class LayoutManager: NSLayoutManager {
99

1010
/// Blockquote's Left Border Color
1111
///
12-
var blockquoteBorderColor = UIColor(red: 0.52, green: 0.65, blue: 0.73, alpha: 1.0)
12+
var blockquoteBorderColor: UIColor? = UIColor(red: 0.52, green: 0.65, blue: 0.73, alpha: 1.0)
1313

1414
/// Blockquote's Background Color
1515
///
16-
var blockquoteBackgroundColor = UIColor(red: 0.91, green: 0.94, blue: 0.95, alpha: 1.0)
16+
var blockquoteBackgroundColor: UIColor? = UIColor(red: 0.91, green: 0.94, blue: 0.95, alpha: 1.0)
1717

1818
/// HTML Pre Background Color
1919
///
20-
var preBackgroundColor = UIColor(red: 243.0/255.0, green: 246.0/255.0, blue: 248.0/255.0, alpha: 1.0)
20+
var preBackgroundColor: UIColor? = UIColor(red: 243.0/255.0, green: 246.0/255.0, blue: 248.0/255.0, alpha: 1.0)
2121

2222
/// Closure that is expected to return the TypingAttributes associated to the Extra Line Fragment
2323
///
@@ -126,12 +126,17 @@ private extension LayoutManager {
126126
/// Draws a single Blockquote Line Fragment, in the specified Rectangle, using a given Graphics Context.
127127
///
128128
private func drawBlockquote(in rect: CGRect, with context: CGContext) {
129-
blockquoteBackgroundColor.setFill()
130-
context.fill(rect)
129+
if let blockquoteBackgroundColor = blockquoteBackgroundColor {
130+
blockquoteBackgroundColor.setFill()
131+
context.fill(rect)
132+
133+
}
131134

132-
let borderRect = CGRect(origin: rect.origin, size: CGSize(width: blockquoteBorderWidth, height: rect.height))
133-
blockquoteBorderColor.setFill()
134-
context.fill(borderRect)
135+
if let blockquoteBorderColor = blockquoteBorderColor {
136+
let borderRect = CGRect(origin: rect.origin, size: CGSize(width: blockquoteBorderWidth, height: rect.height))
137+
blockquoteBorderColor.setFill()
138+
context.fill(borderRect)
139+
}
135140
}
136141
}
137142

@@ -172,6 +177,9 @@ private extension LayoutManager {
172177
/// Draws a single HTML Pre Line Fragment, in the specified Rectangle, using a given Graphics Context.
173178
///
174179
private func drawHTMLPre(in rect: CGRect, with context: CGContext) {
180+
guard let preBackgroundColor = preBackgroundColor else {
181+
return
182+
}
175183
preBackgroundColor.setFill()
176184
context.fill(rect)
177185
}

Aztec/Classes/TextKit/TextView.swift

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ open class TextView: UITextView {
275275

276276
/// Blockquote Blocks Border Color.
277277
///
278-
@objc dynamic public var blockquoteBorderColor: UIColor {
278+
@objc dynamic public var blockquoteBorderColor: UIColor? {
279279
get {
280280
return layout.blockquoteBorderColor
281281
}
@@ -286,7 +286,7 @@ open class TextView: UITextView {
286286

287287
/// Blockquote Blocks Background Color.
288288
///
289-
@objc dynamic public var blockquoteBackgroundColor: UIColor {
289+
@objc dynamic public var blockquoteBackgroundColor: UIColor? {
290290
get {
291291
return layout.blockquoteBackgroundColor
292292
}
@@ -309,7 +309,7 @@ open class TextView: UITextView {
309309

310310
/// Pre Blocks Background Color.
311311
///
312-
@objc dynamic public var preBackgroundColor: UIColor {
312+
@objc dynamic public var preBackgroundColor: UIColor? {
313313
get {
314314
return layout.preBackgroundColor
315315
}
@@ -339,6 +339,14 @@ open class TextView: UITextView {
339339
}
340340
}
341341

342+
override open var textAlignment: NSTextAlignment {
343+
didSet {
344+
if (textAlignment != oldValue) {
345+
recalculateTypingAttributes()
346+
}
347+
}
348+
}
349+
342350

343351
/// This property returns the Attributes associated to the Extra Line Fragment.
344352
///

Example/Example/Base.lproj/Main.storyboard

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Xa3-wA-iyT">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15400" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Xa3-wA-iyT">
3+
<device id="retina6_1" orientation="portrait" appearance="light"/>
34
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
5-
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
5+
<deployment identifier="iOS"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/>
67
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
78
</dependencies>
89
<scenes>
@@ -11,16 +12,21 @@
1112
<objects>
1213
<tableViewController id="dLa-XM-tnL" customClass="ViewController" customModule="AztecExample" customModuleProvider="target" sceneMemberID="viewController">
1314
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="aCg-qL-Bjp">
14-
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
15+
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
1516
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
16-
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
17+
<color key="backgroundColor" systemColor="systemGroupedBackgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
18+
<color key="tintColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
19+
<color key="separatorColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
20+
<color key="sectionIndexColor" systemColor="secondaryLabelColor" red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
21+
<color key="sectionIndexBackgroundColor" systemColor="systemGroupedBackgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
1722
<prototypes>
1823
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="CellIdentifier" id="qo0-pV-osF">
19-
<rect key="frame" x="0.0" y="119.5" width="375" height="44"/>
24+
<rect key="frame" x="0.0" y="55.5" width="414" height="44"/>
2025
<autoresizingMask key="autoresizingMask"/>
2126
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="qo0-pV-osF" id="8JQ-dS-Cdh">
22-
<frame key="frameInset" width="375" height="43.5"/>
27+
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
2328
<autoresizingMask key="autoresizingMask"/>
29+
<color key="backgroundColor" cocoaTouchSystemColor="tableCellGroupedBackgroundColor"/>
2430
</tableViewCellContentView>
2531
</tableViewCell>
2632
</prototypes>
@@ -44,16 +50,16 @@
4450
<viewControllerLayoutGuide type="bottom" id="ZEP-a0-JgH"/>
4551
</layoutGuides>
4652
<view key="view" contentMode="scaleToFill" id="TWZ-yb-CMI">
47-
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
53+
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
4854
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
4955
<subviews>
5056
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="w8z-is-5FM">
51-
<frame key="frameInset" minX="180" minY="236" width="3" height="20"/>
57+
<rect key="frame" x="180" y="236" width="3" height="20"/>
5258
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
5359
<color key="backgroundColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
5460
</view>
5561
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" misplaced="YES" usesAttributedText="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yFc-rm-m3C">
56-
<frame key="frameInset" minX="73" width="600" height="600"/>
62+
<rect key="frame" x="73" y="0.0" width="600" height="600"/>
5763
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
5864
<attributedString key="attributedText"/>
5965
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
@@ -85,11 +91,11 @@
8591
<viewControllerLayoutGuide type="bottom" id="tZp-mZ-BM8"/>
8692
</layoutGuides>
8793
<view key="view" contentMode="scaleToFill" id="pyu-jY-ESw">
88-
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
94+
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
8995
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
9096
<subviews>
9197
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" misplaced="YES" usesAttributedText="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yCI-Vs-ZmB">
92-
<frame key="frameInset" width="600" height="600"/>
98+
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
9399
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
94100
<attributedString key="attributedText"/>
95101
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
@@ -123,11 +129,11 @@
123129
<viewControllerLayoutGuide type="bottom" id="6EB-tz-iNk"/>
124130
</layoutGuides>
125131
<view key="view" contentMode="scaleToFill" id="sdZ-dG-t9p">
126-
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
132+
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
127133
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
128134
<subviews>
129135
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZEK-ad-Hg3">
130-
<frame key="frameInset" minY="20" width="600" height="44"/>
136+
<rect key="frame" x="0.0" y="20" width="600" height="44"/>
131137
<items>
132138
<barButtonItem title="B" id="fPu-Uf-Zs9">
133139
<connections>
@@ -157,7 +163,7 @@
157163
</items>
158164
</toolbar>
159165
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" misplaced="YES" usesAttributedText="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DeM-yw-u6b">
160-
<frame key="frameInset" minY="64" width="600" height="536"/>
166+
<rect key="frame" x="0.0" y="64" width="600" height="536"/>
161167
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
162168
<attributedString key="attributedText"/>
163169
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
@@ -188,7 +194,7 @@
188194
<objects>
189195
<navigationController id="Xa3-wA-iyT" sceneMemberID="viewController">
190196
<navigationBar key="navigationBar" contentMode="scaleToFill" id="JtR-gB-2vV">
191-
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
197+
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
192198
<autoresizingMask key="autoresizingMask"/>
193199
</navigationBar>
194200
<connections>

Example/Example/EditorDemoController.swift

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,24 @@ class EditorDemoController: UIViewController {
167167

168168
edgesForExtendedLayout = UIRectEdge()
169169
navigationController?.navigationBar.isTranslucent = false
170-
171-
view.backgroundColor = .white
172170
view.addSubview(editorView)
173171
view.addSubview(titleTextView)
174172
view.addSubview(titlePlaceholderLabel)
175173
view.addSubview(separatorView)
174+
// color setup
175+
if #available(iOS 13.0, *) {
176+
view.backgroundColor = UIColor.systemBackground
177+
titleTextView.textColor = UIColor.label
178+
editorView.htmlTextView.textColor = UIColor.label
179+
editorView.richTextView.textColor = UIColor.label
180+
editorView.richTextView.blockquoteBackgroundColor = UIColor.secondarySystemBackground
181+
editorView.richTextView.preBackgroundColor = UIColor.secondarySystemBackground
182+
editorView.richTextView.blockquoteBorderColor = UIColor.secondarySystemFill
183+
var attributes = editorView.richTextView.linkTextAttributes
184+
attributes?[.foregroundColor] = UIColor.link
185+
} else {
186+
view.backgroundColor = UIColor.white
187+
}
176188
//Don't allow scroll while the constraints are being setup and text set
177189
editorView.isScrollEnabled = false
178190
configureConstraints()
@@ -317,7 +329,15 @@ class EditorDemoController: UIViewController {
317329
textView.accessibilityLabel = accessibilityLabel
318330
textView.font = Constants.defaultContentFont
319331
textView.keyboardDismissMode = .interactive
320-
textView.textColor = UIColor(red: 0x1A/255.0, green: 0x1A/255.0, blue: 0x1A/255.0, alpha: 1)
332+
if #available(iOS 13.0, *) {
333+
textView.textColor = UIColor.label
334+
if let htmlStorage = textView.textStorage as? HTMLStorage {
335+
htmlStorage.textColor = UIColor.label
336+
}
337+
} else {
338+
// Fallback on earlier versions
339+
textView.textColor = UIColor(red: 0x1A/255.0, green: 0x1A/255.0, blue: 0x1A/255.0, alpha: 1)
340+
}
321341
textView.linkTextAttributes = [.foregroundColor: UIColor(red: 0x01 / 255.0, green: 0x60 / 255.0, blue: 0x87 / 255.0, alpha: 1), NSAttributedString.Key.underlineStyle: NSNumber(value: NSUnderlineStyle.single.rawValue)]
322342
}
323343

@@ -940,11 +960,20 @@ extension EditorDemoController {
940960

941961
let toolbar = Aztec.FormatBar()
942962

943-
toolbar.tintColor = .gray
944-
toolbar.highlightedTintColor = .blue
945-
toolbar.selectedTintColor = view.tintColor
946-
toolbar.disabledTintColor = .lightGray
947-
toolbar.dividerTintColor = .gray
963+
if #available(iOS 13.0, *) {
964+
toolbar.backgroundColor = UIColor.systemGroupedBackground
965+
toolbar.tintColor = UIColor.secondaryLabel
966+
toolbar.highlightedTintColor = UIColor.systemBlue
967+
toolbar.selectedTintColor = UIColor.systemBlue
968+
toolbar.disabledTintColor = .systemGray4
969+
toolbar.dividerTintColor = UIColor.separator
970+
} else {
971+
toolbar.tintColor = .gray
972+
toolbar.highlightedTintColor = .blue
973+
toolbar.selectedTintColor = view.tintColor
974+
toolbar.disabledTintColor = .lightGray
975+
toolbar.dividerTintColor = .gray
976+
}
948977

949978
toolbar.overflowToggleIcon = Gridicon.iconOfType(.ellipsis)
950979
toolbar.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: 44.0)

Example/Example/ViewController.swift

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class ViewController: UITableViewController
7777
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
7878
let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier)!
7979
cell.accessoryType = .disclosureIndicator
80-
80+
//cell.backgroundColor = UIColor.
8181
let row = sections[indexPath.section].rows[indexPath.row]
8282
cell.textLabel?.text = row.title
8383

@@ -87,19 +87,10 @@ class ViewController: UITableViewController
8787
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
8888
return 40
8989
}
90-
91-
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
92-
let textView = UITextView()
93-
94-
textView.font = UIFont.boldSystemFont(ofSize: 14)
95-
textView.textAlignment = .center
96-
textView.isEditable = false
97-
textView.text = sections[section].title
98-
textView.backgroundColor = UIColor.lightGray
99-
100-
return textView
101-
}
10290

91+
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
92+
return sections[section].title
93+
}
10394

10495
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
10596
tableView.deselectRow(at: indexPath, animated: true)

WordPress-Aztec-iOS.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'WordPress-Aztec-iOS'
11-
s.version = '1.11.0'
11+
s.version = '1.12.0'
1212
s.summary = 'The native HTML Editor.'
1313

1414
# This description is used to generate tags and improve search results.

WordPress-Editor-iOS.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'WordPress-Editor-iOS'
11-
s.version = '1.11.0'
11+
s.version = '1.12.0'
1212
s.summary = 'The WordPress HTML Editor.'
1313

1414
# This description is used to generate tags and improve search results.

0 commit comments

Comments
 (0)