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
16 changes: 16 additions & 0 deletions Aztec.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@
F1FA0E861E6EF514009D98EE /* Node.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1FA0E7E1E6EF514009D98EE /* Node.swift */; };
F1FA0E871E6EF514009D98EE /* StandardElementType.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1FA0E7F1E6EF514009D98EE /* StandardElementType.swift */; };
F1FA0E881E6EF514009D98EE /* TextNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1FA0E801E6EF514009D98EE /* TextNode.swift */; };
FF0714021EFD78AF00E50713 /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FF0714001EFD78AF00E50713 /* Media.xcassets */; };
FF152D8E1E68552A00FF596C /* StringRangeConversionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF152D8D1E68552A00FF596C /* StringRangeConversionTests.swift */; };
FF20D6401EDC389A00294B78 /* HTMLAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF20D63D1EDC389A00294B78 /* HTMLAttributes.swift */; };
FF20D6411EDC389A00294B78 /* HTMLProcessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF20D63E1EDC389A00294B78 /* HTMLProcessor.swift */; };
FF20D6421EDC389A00294B78 /* Processor.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF20D63F1EDC389A00294B78 /* Processor.swift */; };
FF20D6441EDC395E00294B78 /* NSTextingResult+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF20D6431EDC395E00294B78 /* NSTextingResult+Helpers.swift */; };
FF20D6471EDC3B3900294B78 /* HTMLProcessorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF20D6461EDC3B3900294B78 /* HTMLProcessorTests.swift */; };
FF24AC991F0146AF003CA91D /* Assets.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF24AC981F0146AF003CA91D /* Assets.swift */; };
FF4E26601EA8DF1E005E8E42 /* ImageAttachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF4E265F1EA8DF1E005E8E42 /* ImageAttachment.swift */; };
FF7A1C511E5651EA00C4C7C8 /* LineAttachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF7A1C501E5651EA00C4C7C8 /* LineAttachment.swift */; };
FF7C89B01E3BC52F000472A8 /* NSAttributedString+FontTraits.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF7C89AF1E3BC52F000472A8 /* NSAttributedString+FontTraits.swift */; };
Expand Down Expand Up @@ -288,12 +290,14 @@
F1FA0E7E1E6EF514009D98EE /* Node.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Node.swift; sourceTree = "<group>"; };
F1FA0E7F1E6EF514009D98EE /* StandardElementType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StandardElementType.swift; sourceTree = "<group>"; };
F1FA0E801E6EF514009D98EE /* TextNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextNode.swift; sourceTree = "<group>"; };
FF0714001EFD78AF00E50713 /* Media.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Media.xcassets; sourceTree = "<group>"; };
FF152D8D1E68552A00FF596C /* StringRangeConversionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringRangeConversionTests.swift; sourceTree = "<group>"; };
FF20D63D1EDC389A00294B78 /* HTMLAttributes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HTMLAttributes.swift; sourceTree = "<group>"; };
FF20D63E1EDC389A00294B78 /* HTMLProcessor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HTMLProcessor.swift; sourceTree = "<group>"; };
FF20D63F1EDC389A00294B78 /* Processor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Processor.swift; sourceTree = "<group>"; };
FF20D6431EDC395E00294B78 /* NSTextingResult+Helpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSTextingResult+Helpers.swift"; sourceTree = "<group>"; };
FF20D6461EDC3B3900294B78 /* HTMLProcessorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HTMLProcessorTests.swift; sourceTree = "<group>"; };
FF24AC981F0146AF003CA91D /* Assets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Assets.swift; sourceTree = "<group>"; };
FF4E265F1EA8DF1E005E8E42 /* ImageAttachment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageAttachment.swift; sourceTree = "<group>"; };
FF5B98E21DC29D0C00571CA4 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; };
FF5B98E41DC355B400571CA4 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -357,6 +361,7 @@
5951CB901D8BC93600E1866F /* Aztec */ = {
isa = PBXGroup;
children = (
FF0713FE1EFD78AF00E50713 /* Assets */,
5951CB921D8BC93600E1866F /* Info.plist */,
599F25001D8BC9A1002871D6 /* Classes */,
599F25911D8BDCA9002871D6 /* Documentation */,
Expand Down Expand Up @@ -504,6 +509,7 @@
isa = PBXGroup;
children = (
599F25291D8BC9A1002871D6 /* FormatBar */,
FF24AC981F0146AF003CA91D /* Assets.swift */,
);
path = GUI;
sourceTree = "<group>";
Expand Down Expand Up @@ -781,6 +787,14 @@
path = Data;
sourceTree = "<group>";
};
FF0713FE1EFD78AF00E50713 /* Assets */ = {
isa = PBXGroup;
children = (
FF0714001EFD78AF00E50713 /* Media.xcassets */,
);
path = Assets;
sourceTree = "<group>";
};
FF20D63C1EDC389A00294B78 /* Processor */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -896,6 +910,7 @@
buildActionMask = 2147483647;
files = (
F138062A1E3651DC00CFB9ED /* ControlCharacters.rtf in Resources */,
FF0714021EFD78AF00E50713 /* Media.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1002,6 +1017,7 @@
B551A4A01E770B3800EE3A7F /* UIFont+Emoji.swift in Sources */,
F12F586E1EF20394008AE298 /* LinkFormatter.swift in Sources */,
F12F586A1EF20394008AE298 /* HeaderFormatter.swift in Sources */,
FF24AC991F0146AF003CA91D /* Assets.swift in Sources */,
599F254D1D8BC9A1002871D6 /* FormatBar.swift in Sources */,
F1FA0E881E6EF514009D98EE /* TextNode.swift in Sources */,
599F253A1D8BC9A1002871D6 /* InNodeConverter.swift in Sources */,
Expand Down
6 changes: 6 additions & 0 deletions Aztec/Assets/Media.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
12 changes: 12 additions & 0 deletions Aztec/Assets/Media.xcassets/image.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "gridicons-image.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.
12 changes: 12 additions & 0 deletions Aztec/Assets/Media.xcassets/play.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "gridicons-play.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import Gridicons
import UIKit

class HTMLNodeToNSAttributedString: SafeConverter {
Expand Down
17 changes: 17 additions & 0 deletions Aztec/Classes/GUI/Assets.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Foundation
import UIKit

class Assets {

public static var playIcon: UIImage {
let bundle = Bundle(for: self)
let playImage = UIImage(named: "play", in: bundle, compatibleWith: nil)!
return playImage
}

public static var imageIcon: UIImage {
let bundle = Bundle(for: self)
let playImage = UIImage(named: "image", in: bundle, compatibleWith: nil)!
return playImage
}
}
3 changes: 1 addition & 2 deletions Aztec/Classes/TextKit/TextView.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

import UIKit
import Foundation
import Gridicons


// MARK: - TextViewAttachmentDelegate
Expand Down Expand Up @@ -196,7 +195,7 @@ open class TextView: UITextView {
required public init?(coder aDecoder: NSCoder) {

defaultFont = UIFont.systemFont(ofSize: 14)
defaultMissingImage = Gridicon.iconOfType(.image)
defaultMissingImage = Assets.imageIcon
super.init(coder: aDecoder)
commonInit()
}
Expand Down
3 changes: 1 addition & 2 deletions Aztec/Classes/TextKit/VideoAttachment.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Foundation
import UIKit
import Gridicons

protocol VideoAttachmentDelegate: class {
func videoAttachment(
Expand Down Expand Up @@ -43,7 +42,7 @@ open class VideoAttachment: MediaAttachment {

super.init(identifier: identifier, url: posterURL)

self.overlayImage = Gridicon.iconOfType(.video)
self.overlayImage = Assets.playIcon
}

/// Required Initializer
Expand Down
3 changes: 1 addition & 2 deletions AztecTests/Formatters/BlockquoteFormatterTests.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import XCTest
import Gridicons
@testable import Aztec

// MARK: - BlockquoteFormatterTests Tests
Expand Down Expand Up @@ -101,7 +100,7 @@ class BlockquoteFormatterTests: XCTestCase {

private extension BlockquoteFormatterTests {
var testTextView: TextView {
let view = TextView(defaultFont: UIFont.systemFont(ofSize: 14), defaultMissingImage: Gridicon.iconOfType(.image))
let view = TextView(defaultFont: UIFont.systemFont(ofSize: 14), defaultMissingImage: UIImage())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're removing the default here, but not assigning a new one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test file

view.text = plainText
return view
}
Expand Down
1 change: 0 additions & 1 deletion AztecTests/Formatters/PreFormaterTests.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import XCTest
import Gridicons
@testable import Aztec


Expand Down
8 changes: 4 additions & 4 deletions AztecTests/TextViewStubAttachmentDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation
import Aztec
import Gridicons
import UIKit

class TextViewStubAttachmentDelegate: TextViewAttachmentDelegate {

Expand All @@ -17,11 +17,11 @@ class TextViewStubAttachmentDelegate: TextViewAttachmentDelegate {
let placeholderImage: UIImage
switch attachment {
case _ as ImageAttachment:
placeholderImage = Gridicon.iconOfType(.image, withSize: imageSize)
placeholderImage = UIImage()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're removing the default here, but not assigning a new one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test file.

case _ as VideoAttachment:
placeholderImage = Gridicon.iconOfType(.video, withSize: imageSize)
placeholderImage = UIImage()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're removing the default here, but not assigning a new one.

default:
placeholderImage = Gridicon.iconOfType(.attachment, withSize: imageSize)
placeholderImage = UIImage()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're removing the default here, but not assigning a new one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test File.


}

Expand Down
13 changes: 6 additions & 7 deletions AztecTests/TextViewTests.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import XCTest
@testable import Aztec
import Gridicons

class TextViewTests: XCTestCase {

Expand All @@ -25,13 +24,13 @@ class TextViewTests: XCTestCase {
// MARK: - TextView construction

func createEmptyTextView() -> Aztec.TextView {
let richTextView = Aztec.TextView(defaultFont: UIFont.systemFont(ofSize: 14), defaultMissingImage: Gridicon.iconOfType(.attachment))
let richTextView = Aztec.TextView(defaultFont: UIFont.systemFont(ofSize: 14), defaultMissingImage: UIImage())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're removing the default here, but not assigning a new one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test file.

richTextView.textAttachmentDelegate = attachmentDelegate
return richTextView
}

func createTextView(withHTML html: String) -> Aztec.TextView {
let richTextView = Aztec.TextView(defaultFont: UIFont.systemFont(ofSize: 14), defaultMissingImage: Gridicon.iconOfType(.attachment))
let richTextView = Aztec.TextView(defaultFont: UIFont.systemFont(ofSize: 14), defaultMissingImage: UIImage())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're removing the default here, but not assigning a new one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test file.

richTextView.textAttachmentDelegate = attachmentDelegate
richTextView.setHTML(html)

Expand All @@ -40,7 +39,7 @@ class TextViewTests: XCTestCase {

func createTextViewWithContent() -> Aztec.TextView {
let paragraph = "Lorem ipsum dolar sit amet.\n"
let richTextView = Aztec.TextView(defaultFont: UIFont.systemFont(ofSize: 14), defaultMissingImage: Gridicon.iconOfType(.attachment))
let richTextView = Aztec.TextView(defaultFont: UIFont.systemFont(ofSize: 14), defaultMissingImage: UIImage())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're removing the default here, but not assigning a new one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test File

richTextView.textAttachmentDelegate = attachmentDelegate
let attributes = [NSParagraphStyleAttributeName : NSParagraphStyle()]
let templateString = NSMutableAttributedString(string: paragraph, attributes: attributes)
Expand All @@ -58,7 +57,7 @@ class TextViewTests: XCTestCase {

func testTextViewReferencesStorage() {

let textView = Aztec.TextView(defaultFont: UIFont.systemFont(ofSize: 14), defaultMissingImage: Gridicon.iconOfType(.attachment))
let textView = Aztec.TextView(defaultFont: UIFont.systemFont(ofSize: 14), defaultMissingImage: UIImage())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're removing the default here, but not assigning a new one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test file.


textView.text = "Foo"
XCTAssert(textView.text == "Foo")
Expand All @@ -79,7 +78,7 @@ class TextViewTests: XCTestCase {
// MARK: - Test Index Wrangling

func testMaxIndex() {
let textView = Aztec.TextView(defaultFont: UIFont.systemFont(ofSize: 14), defaultMissingImage: Gridicon.iconOfType(.attachment))
let textView = Aztec.TextView(defaultFont: UIFont.systemFont(ofSize: 14), defaultMissingImage: UIImage())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're removing the default here, but not assigning a new one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test file.


textView.text = "foo"

Expand All @@ -92,7 +91,7 @@ class TextViewTests: XCTestCase {
}

func testAdjustedIndex() {
let textView = Aztec.TextView(defaultFont: UIFont.systemFont(ofSize: 14), defaultMissingImage: Gridicon.iconOfType(.attachment))
let textView = Aztec.TextView(defaultFont: UIFont.systemFont(ofSize: 14), defaultMissingImage: UIImage())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're removing the default here, but not assigning a new one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test file.


textView.text = "foobarbaz"

Expand Down
2 changes: 1 addition & 1 deletion Example/Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "Automattic/Gridicons-iOS" "0.7"
github "Automattic/Gridicons-iOS" "0.8"
2 changes: 1 addition & 1 deletion Example/Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "Automattic/Gridicons-iOS" "0.7"
github "Automattic/Gridicons-iOS" "0.8"
3 changes: 2 additions & 1 deletion Example/Example/EditorDemoController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1243,8 +1243,9 @@ private extension EditorDemoController
if progress.fractionCompleted >= 1 {
timer.invalidate()
attachment.progress = nil
if let videoAttachment = attachment as? VideoAttachment, let videoURL = progress.userInfo[MediaProgressKey.mediaID] as? URL {
if let videoAttachment = attachment as? VideoAttachment, let videoURL = progress.userInfo[MediaProgressKey.videoURL] as? URL {
videoAttachment.srcURL = videoURL
videoAttachment.overlayColor = UIColor.clear
richTextView.update(attachment: videoAttachment)
}
}
Expand Down
2 changes: 0 additions & 2 deletions WordPress-Aztec-iOS.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,4 @@ Pod::Spec.new do |s|
s.xcconfig = {'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2'}
s.preserve_paths = 'Aztec/Modulemaps/libxml2/*'

s.dependency 'Gridicons', '0.8'

end