Skip to content
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
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@ version: 2.1

orbs:
# This uses the iOS Orb located at https://github.com/wordpress-mobile/circleci-orbs
ios: wordpress-mobile/ios@0.0.25
ios: wordpress-mobile/ios@0.0.32

workflows:
test_and_validate:
jobs:
- ios/test:
name: Test
xcode-version: "10.2.0"
xcode-version: "11.0"
carthage-update: true
carthage-working-directory: Example
bundle-install: false
pod-install: false
workspace: Aztec.xcworkspace
scheme: AztecExample
device: iPhone XS
ios-version: "12.2"
device: iPhone 11
ios-version: "13.0"

- ios/validate-podspec:
name: Validate WordPress-Aztec-iOS.podspec
xcode-version: "10.2.0"
xcode-version: "11.0"
podspec-path: WordPress-Aztec-iOS.podspec

- ios/validate-podspec:
name: Validate WordPress-Editor-iOS.podspec
xcode-version: "10.2.0"
xcode-version: "11.0"
podspec-path: WordPress-Editor-iOS.podspec
# Updating specs is needed since WordPress-Editor-iOS depends on WordPress-Aztec-iOS
update-specs-repo: true
20 changes: 10 additions & 10 deletions Aztec.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1435,12 +1435,12 @@
5951CB8D1D8BC93600E1866F = {
CreatedOnToolsVersion = 8.0;
DevelopmentTeam = PZYM8XX95Q;
LastSwiftMigration = 1010;
LastSwiftMigration = 1100;
ProvisioningStyle = Manual;
};
5951CB961D8BC93600E1866F = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 1010;
LastSwiftMigration = 1100;
ProvisioningStyle = Automatic;
};
E8CE3EFE1F213AAA003254AB = {
Expand Down Expand Up @@ -1899,7 +1899,7 @@
SKIP_INSTALL = YES;
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
Expand Down Expand Up @@ -1927,7 +1927,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
Expand All @@ -1947,7 +1947,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.wordpress.AztecTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -1965,7 +1965,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.wordpress.AztecTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down Expand Up @@ -2100,7 +2100,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Profiling;
Expand All @@ -2119,7 +2119,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.wordpress.AztecTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Profiling;
};
Expand Down Expand Up @@ -2214,7 +2214,7 @@
SKIP_INSTALL = YES;
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = "Release-Alpha";
Expand All @@ -2234,7 +2234,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.wordpress.AztecTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = "Release-Alpha";
};
Expand Down
2 changes: 1 addition & 1 deletion Aztec/Classes/EditorView/EditorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ extension EditorView: UITextInput {
}

set {
activeView.selectedTextRange = selectedTextRange
activeView.selectedTextRange = newValue
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Aztec/Classes/Extensions/Array+Attribute.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public extension Array where Element == Attribute {
}

mutating func set(_ value: Attribute.Value, for name: String) {
guard let attributeIndex = index(where: { $0.name == name }) else {
guard let attributeIndex = firstIndex(where: { $0.name == name }) else {
let newAttribute = Attribute(name: name, value: value)

append(newAttribute)
Expand All @@ -33,7 +33,7 @@ public extension Array where Element == Attribute {
}

mutating func remove(named name: String) {
guard let attributeIndex = index(where: { $0.name == name }) else {
guard let attributeIndex = firstIndex(where: { $0.name == name }) else {
return
}

Expand Down
4 changes: 2 additions & 2 deletions Aztec/Classes/Extensions/Array+ShortcodeAttribute.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public extension Array where Element == ShortcodeAttribute {
mutating func set(_ value: ShortcodeAttribute.Value, forKey key: String) {
let newAttribute = ShortcodeAttribute(key: key, value: value)

guard let attributeIndex = index(where: { $0.key == key }) else {
guard let attributeIndex = firstIndex(where: { $0.key == key }) else {
append(newAttribute)
return
}
Expand All @@ -24,7 +24,7 @@ public extension Array where Element == ShortcodeAttribute {
}

mutating func remove(key: String) {
guard let attributeIndex = index(where: { $0.key == key }) else {
guard let attributeIndex = firstIndex(where: { $0.key == key }) else {
return
}

Expand Down
12 changes: 12 additions & 0 deletions Aztec/Classes/Formatters/Implementations/UnderlineFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,15 @@ class UnderlineFormatter: StandardAttributeFormatter {
htmlRepresentationKey: .underlineHtmlRepresentation)
}
}

class SpanUnderlineFormatter: UnderlineFormatter {

override func apply(to attributes: [NSAttributedString.Key : Any], andStore representation: HTMLRepresentation?) -> [NSAttributedString.Key : Any] {

let cssAttribute = CSSAttribute.underline
let underlineStyleAttribute = Attribute(type: .style, value: .inlineCss([cssAttribute]))
let spanRepresentation = HTMLElementRepresentation(ElementNode.init(type: .span, attributes: [underlineStyleAttribute], children: []))

return super.apply(to: attributes, andStore: HTMLRepresentation(for: .element(spanRepresentation)))
}
}
4 changes: 4 additions & 0 deletions Aztec/Classes/GUI/FormatBar/FormatBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,8 @@ private extension FormatBar {
constant: 0
)
self.overflowToggleItemRTLLeadingConstraint = overflowLeadingConstraint
@unknown default:
overflowLeadingConstraint = overflowToggleItem.leadingAnchor.constraint(greaterThanOrEqualTo: scrollableStackView.trailingAnchor)
}

///Trailing item
Expand All @@ -726,6 +728,8 @@ private extension FormatBar {
trailingItemLeadingConstraint = trailingItemContainer.leadingAnchor.constraint(greaterThanOrEqualTo: scrollableStackView.trailingAnchor)
case .rightToLeft:
trailingItemLeadingConstraint = trailingItemContainer.leadingAnchor.constraint(greaterThanOrEqualTo: scrollableStackView.leadingAnchor)
@unknown default:
trailingItemLeadingConstraint = trailingItemContainer.leadingAnchor.constraint(greaterThanOrEqualTo: scrollableStackView.trailingAnchor)
}

NSLayoutConstraint.activate([
Expand Down
4 changes: 2 additions & 2 deletions Aztec/Classes/Libxml2/DOM/Data/ElementNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public class ElementNode: Node {
private func updateParentForChildren() {
for child in children where child.parent !== self {
if let oldParent = child.parent,
let childIndex = oldParent.children.index(where: { child === $0 }) {
let childIndex = oldParent.children.firstIndex(where: { child === $0 }) {

oldParent.children.remove(at: childIndex)
}
Expand Down Expand Up @@ -349,7 +349,7 @@ public class ElementNode: Node {
/// - Returns: the index of the specified child node.
///
func indexOf(childNode: Node) -> Int {
guard let index = children.index(where: { childNode === $0 } ) else {
guard let index = children.firstIndex(where: { childNode === $0 } ) else {
fatalError("Broken parent-child relationship found.")
}

Expand Down
2 changes: 1 addition & 1 deletion Aztec/Classes/Libxml2/DOM/Data/Node.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public class Node: Equatable, CustomReflectable, Hashable {
return nil
}

let index = parent.children.index { node -> Bool in
let index = parent.children.firstIndex { node -> Bool in
return node === self
}!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ private extension AttributedStringParser {
var nonDuplicates = [ElementNode]()

for node in previous where current.contains(node) {
guard let index = current.index(of: node) else {
guard let index = current.firstIndex(of: node) else {
continue
}

Expand Down
2 changes: 1 addition & 1 deletion Aztec/Classes/TextKit/ParagraphStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ open class ParagraphStyle: NSMutableParagraphStyle, CustomReflectable {
public var blockquoteIndent: CGFloat {
let blockquoteIndex = properties.filter({ property in
return property is Blockquote || property is TextList
}).index(where: { property in
}).firstIndex(where: { property in
return property is Blockquote
})

Expand Down
9 changes: 4 additions & 5 deletions Aztec/Classes/TextKit/TextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ open class TextView: UITextView {
}
storage.attachmentsDelegate = self
font = defaultFont
linkTextAttributes = [.underlineStyle: NSNumber(value: NSUnderlineStyle.single.rawValue), .foregroundColor: self.tintColor]
linkTextAttributes = [.underlineStyle: NSNumber(value: NSUnderlineStyle.single.rawValue), .foregroundColor: tintColor as Any]
typingAttributes = defaultAttributes
setupMenuController()
setupAttachmentTouchDetection()
Expand Down Expand Up @@ -747,7 +747,7 @@ open class TextView: UITextView {
private static let formatterMap: [FormattingIdentifier: AttributeFormatter] = [
.bold: BoldFormatter(),
.italic: ItalicFormatter(),
.underline: UnderlineFormatter(),
.underline: SpanUnderlineFormatter(),
.strikethrough: StrikethroughFormatter(),
.link: LinkFormatter(),
.orderedlist: TextListFormatter(style: .ordered),
Expand Down Expand Up @@ -935,7 +935,7 @@ open class TextView: UITextView {
/// - Parameter range: The NSRange to edit.
///
open func toggleUnderline(range: NSRange) {
let formatter = UnderlineFormatter()
let formatter = SpanUnderlineFormatter()
toggle(formatter: formatter, atRange: range)
}

Expand Down Expand Up @@ -1342,8 +1342,7 @@ open class TextView: UITextView {
open func replaceWithImage(at range: NSRange, sourceURL url: URL, placeHolderImage: UIImage?, identifier: String = UUID().uuidString) -> ImageAttachment {
let attachment = ImageAttachment(identifier: identifier, url: url)
attachment.delegate = storage
attachment.image = placeHolderImage
attachment.alignment = .none
attachment.image = placeHolderImage
replace(at: range, with: attachment)
return attachment
}
Expand Down
Binary file modified AztecTests/Resources/UIImageResizeImage1_2x.png.dat
Binary file not shown.
Binary file modified AztecTests/Resources/UIImageResizeImage2_2x.png.dat
Binary file not shown.
20 changes: 10 additions & 10 deletions Example/AztecExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,12 @@
607FACCF1AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = PZYM8XX95Q;
LastSwiftMigration = 1010;
LastSwiftMigration = 1100;
ProvisioningStyle = Manual;
};
CC400F161E9EC04200859AB4 = {
CreatedOnToolsVersion = 8.3.1;
LastSwiftMigration = 1010;
LastSwiftMigration = 1100;
ProvisioningStyle = Automatic;
TestTargetID = 607FACCF1AFB9204008FA782;
};
Expand Down Expand Up @@ -664,7 +664,7 @@
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "Aztec Example Development";
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -687,7 +687,7 @@
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "Aztec Example Ad Hoc";
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -704,7 +704,7 @@
PRODUCT_BUNDLE_IDENTIFIER = WP.AztecUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = AztecExample;
};
name = Debug;
Expand All @@ -719,7 +719,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = WP.AztecUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = AztecExample;
};
name = "Release-Alpha";
Expand All @@ -734,7 +734,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = WP.AztecUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = AztecExample;
};
name = Release;
Expand All @@ -749,7 +749,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = WP.AztecUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = AztecExample;
};
name = Profiling;
Expand Down Expand Up @@ -826,7 +826,7 @@
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "Aztec Example Development";
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Profiling;
Expand Down Expand Up @@ -909,7 +909,7 @@
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "Aztec Example Alpha Distribution";
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = "Release-Alpha";
Expand Down
6 changes: 3 additions & 3 deletions Example/Example/EditorDemoController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ extension EditorDemoController {
return OptionsTableViewOption(image: headerType.iconImage, title: title)
}

let selectedIndex = Constants.headers.index(of: headerLevelForSelectedText())
let selectedIndex = Constants.headers.firstIndex(of: headerLevelForSelectedText())
let optionsTableViewController = OptionsTableViewController(options: options)
optionsTableViewController.cellDeselectedTintColor = .gray

Expand Down Expand Up @@ -665,7 +665,7 @@ extension EditorDemoController {

var index: Int? = nil
if let listType = listTypeForSelectedText() {
index = Constants.lists.index(of: listType)
index = Constants.lists.firstIndex(of: listType)
}

let optionsTableViewController = OptionsTableViewController(options: options)
Expand Down Expand Up @@ -1294,7 +1294,7 @@ private extension EditorDemoController

let attachment = richTextView.replaceWithImage(at: richTextView.selectedRange, sourceURL: fileURL, placeHolderImage: image)
attachment.size = .full
attachment.alignment = .none
attachment.alignment = ImageAttachment.Alignment.none
if let attachmentRange = richTextView.textStorage.ranges(forAttachment: attachment).first {
richTextView.setLink(fileURL, inRange: attachmentRange)
}
Expand Down
Loading