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
6 changes: 5 additions & 1 deletion Aztec/Classes/TextKit/LayoutManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class LayoutManager: NSLayoutManager {
///
var extraLineFragmentTypingAttributes: (() -> [String: Any])?

/// Blockquote's Left Border width
///
var blockquoteBorderWidth: CGFloat = 2


/// Draws the background, associated to a given Text Range
///
Expand Down Expand Up @@ -125,7 +129,7 @@ private extension LayoutManager {
blockquoteBackgroundColor.setFill()
context.fill(rect)

let borderRect = CGRect(origin: rect.origin, size: CGSize(width: 2, height: rect.height))
let borderRect = CGRect(origin: rect.origin, size: CGSize(width: blockquoteBorderWidth, height: rect.height))
blockquoteBorderColor.setFill()
context.fill(borderRect)
}
Expand Down
60 changes: 52 additions & 8 deletions Aztec/Classes/TextKit/TextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public protocol TextViewFormattingDelegate: class {
//
open class TextView: UITextView {

// MARK: - Properties: Attachments & Media
// MARK: - Aztec Delegates

/// The media delegate takes care of providing remote media when requested by the `TextView`.
/// If this is not set, all remove images will be left blank.
Expand All @@ -135,14 +135,16 @@ open class TextView: UITextView {
///
fileprivate var textAttachmentImageProvider = [TextViewAttachmentImageProvider]()

// MARK: - Properties: Formatting
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we removing the mark?

Copy link
Contributor

Choose a reason for hiding this comment

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

PS: if we want to rename this I'm fine, but it's a good one since all of it's content is related to formatting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Related to the change few lines above. This is part of the delegates section, so it's a bit of redundant


/// Formatting Delegate: to be used by the Edition's Format Bar.
///
open weak var formattingDelegate: TextViewFormattingDelegate?


// MARK: - Properties: Text Lists

var maximumListIndentationLevels = 7


// MARK: - Properties: UI Defaults

open let defaultFont: UIFont
Expand All @@ -154,6 +156,7 @@ open class TextView: UITextView {
NSParagraphStyleAttributeName: defaultParagraphStyle]
}


// MARK: - Properties: Processors

/// This processor will be executed on any HTML you provide to the method `setHTML()` and
Expand All @@ -165,12 +168,54 @@ open class TextView: UITextView {
///
public var outputProcessor: Processor?

// MARK: - Properties: Text Storage

// MARK: - TextKit Aztec Subclasses

var storage: TextStorage {
return textStorage as! TextStorage
}

var layout: LayoutManager {
return layoutManager as! LayoutManager
}


// MARK: - Apparance Properties

/// Blockquote Blocks Border COlor.
///
dynamic public var blockquoteBorderColor: UIColor {
get {
return layout.blockquoteBorderColor
}
set {
layout.blockquoteBorderColor = newValue
}
}

/// Blockquote Blocks Background Color.
///
dynamic public var blockquoteBackgroundColor: UIColor {
get {
return layout.blockquoteBackgroundColor
}
set {
layout.blockquoteBackgroundColor = newValue
}
}

/// Pre Blocks Background Color.
///
dynamic public var preBackgroundColor: UIColor {
get {
return layout.preBackgroundColor
}
set {
layout.preBackgroundColor = newValue
}
}


// MARK: - Overwritten Properties

/// Overwrites Typing Attributes:
Expand Down Expand Up @@ -1126,9 +1171,6 @@ open class TextView: UITextView {
toggle(formatter: formatter, atRange: range)
}




/// Removes the link, if any, at the specified range
///
/// - Parameter range: range that contains the link to be removed.
Expand Down Expand Up @@ -1288,10 +1330,12 @@ open class TextView: UITextView {
}


/// // Check if there is an attachment at the location we are moving. If there is one check if we want to move before or after the attachment based on the margins.
/// Check if there is an attachment at the location we are moving. If there is one check if we want to move before or after the
/// attachment based on the margins.
///
/// - Parameter point: the point to check.
/// - Returns: true if the point fall inside an attachment margin
///
open func isPointInsideAttachmentMargin(point: CGPoint) -> Bool {
let index = layoutManager.characterIndex(for: point, in: textContainer, fractionOfDistanceBetweenInsertionPoints: nil)

Expand Down