Skip to content

Commit bd01a63

Browse files
author
Gerardo Pacheco
authored
Merge pull request #1341 from wordpress-mobile/release/1.19.6
Release 1.19.6
2 parents 15982d4 + f87ecd5 commit bd01a63

File tree

8 files changed

+63
-4
lines changed

8 files changed

+63
-4
lines changed

Aztec.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
40A2986D1FD61B0C00AEDF3B /* ElementConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40A2986C1FD61B0C00AEDF3B /* ElementConverter.swift */; };
1414
40A298711FD61B6F00AEDF3B /* ImageElementConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40A298701FD61B6F00AEDF3B /* ImageElementConverter.swift */; };
1515
40A298731FD61E1900AEDF3B /* VideoElementConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40A298721FD61E1900AEDF3B /* VideoElementConverter.swift */; };
16+
568FF25827552BFF0057B2E3 /* MarkFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 568FF25727552BFF0057B2E3 /* MarkFormatter.swift */; };
1617
594C9D6F1D8BE61F00D74542 /* Aztec.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5951CB8E1D8BC93600E1866F /* Aztec.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1718
594C9D731D8BE6C300D74542 /* InAttributeConverterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59FEA06B1D8BDFA700D138DF /* InAttributeConverterTests.swift */; };
1819
594C9D741D8BE6C700D74542 /* InNodeConverterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59FEA06D1D8BDFA700D138DF /* InNodeConverterTests.swift */; };
@@ -287,6 +288,7 @@
287288
40A298701FD61B6F00AEDF3B /* ImageElementConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageElementConverter.swift; sourceTree = "<group>"; };
288289
40A298721FD61E1900AEDF3B /* VideoElementConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoElementConverter.swift; sourceTree = "<group>"; };
289290
50A1CC6E250FEA93001D5517 /* LICENSE.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = LICENSE.md; sourceTree = "<group>"; };
291+
568FF25727552BFF0057B2E3 /* MarkFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarkFormatter.swift; sourceTree = "<group>"; };
290292
5951CB8E1D8BC93600E1866F /* Aztec.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Aztec.framework; sourceTree = BUILT_PRODUCTS_DIR; };
291293
5951CB921D8BC93600E1866F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
292294
5951CB971D8BC93600E1866F /* AztecTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AztecTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -1013,6 +1015,7 @@
10131015
FF949363245744560085ABB3 /* SubscriptFormatter.swift */,
10141016
FF61909D202481F4004BCD0A /* CodeFormatter.swift */,
10151017
FFB5D29620BEB21A0038DCFB /* CiteFormatter.swift */,
1018+
568FF25727552BFF0057B2E3 /* MarkFormatter.swift */,
10161019
);
10171020
path = Implementations;
10181021
sourceTree = "<group>";
@@ -1696,6 +1699,7 @@
16961699
F1079D67208F80FE009717FA /* EditorView.swift in Sources */,
16971700
F15A8B6520BED08900C57ED2 /* ParagraphPropertyConverter.swift in Sources */,
16981701
F1D7F525221CE2D20065555D /* HTMLStyleToggler.swift in Sources */,
1702+
568FF25827552BFF0057B2E3 /* MarkFormatter.swift in Sources */,
16991703
F1FA0E811E6EF514009D98EE /* Attribute.swift in Sources */,
17001704
F16A2ADD20CC503F00BF3A0A /* VideoAttachmentToElementConverter.swift in Sources */,
17011705
);

Aztec/Classes/Extensions/NSAttributedStringKey+Aztec.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,8 @@ public extension NSAttributedString.Key {
6161
/// Key used to store Sub Tag Metadata, by our SupFormatter.
6262
///
6363
static let subHtmlRepresentation = NSAttributedString.Key("Sub.htmlRepresentation")
64+
65+
/// Key used to store Mark Tag Metadata, by our MarkFormatter.
66+
///
67+
static let markHtmlRepresentation = NSAttributedString.Key("Mark.htmlRepresentation")
6468
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import Foundation
2+
import UIKit
3+
4+
class MarkFormatter: AttributeFormatter {
5+
6+
var placeholderAttributes: [NSAttributedString.Key: Any]?
7+
8+
func applicationRange(for range: NSRange, in text: NSAttributedString) -> NSRange {
9+
return range
10+
}
11+
12+
func apply(to attributes: [NSAttributedString.Key: Any], andStore representation: HTMLRepresentation?) -> [NSAttributedString.Key: Any] {
13+
var resultingAttributes = attributes
14+
15+
var representationToUse = HTMLRepresentation(for: .element(HTMLElementRepresentation.init(name: "mark", attributes: [])))
16+
if let requestedRepresentation = representation {
17+
representationToUse = requestedRepresentation
18+
}
19+
resultingAttributes[.markHtmlRepresentation] = representationToUse
20+
21+
return resultingAttributes
22+
}
23+
24+
func remove(from attributes: [NSAttributedString.Key: Any]) -> [NSAttributedString.Key: Any] {
25+
var resultingAttributes = attributes
26+
27+
resultingAttributes.removeValue(forKey: .markHtmlRepresentation)
28+
29+
return resultingAttributes
30+
}
31+
32+
func present(in attributes: [NSAttributedString.Key: Any]) -> Bool {
33+
return attributes[NSAttributedString.Key.markHtmlRepresentation] != nil
34+
}
35+
}

Aztec/Classes/GUI/FormatBar/FormattingIdentifier.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ extension FormattingIdentifier {
3636
public static let strikethrough = FormattingIdentifier("strikethrough")
3737
public static let underline = FormattingIdentifier("underline")
3838
public static let unorderedlist = FormattingIdentifier("unorderedlist")
39+
public static let mark = FormattingIdentifier("mark")
3940
}

Aztec/Classes/TextKit/TextView.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,8 @@ open class TextView: UITextView {
853853
.header5: HeaderFormatter(headerLevel: .h5),
854854
.header6: HeaderFormatter(headerLevel: .h6),
855855
.p: HTMLParagraphFormatter(),
856-
.code: CodeFormatter()
856+
.code: CodeFormatter(),
857+
.mark: MarkFormatter()
857858
]
858859

859860
/// Get a list of format identifiers spanning the specified range as a String array.
@@ -1137,6 +1138,16 @@ open class TextView: UITextView {
11371138
forceRedrawCursorAfterDelay()
11381139
}
11391140

1141+
/// Adds or removes a mark style from the specified range.
1142+
///
1143+
/// - Parameter range: The NSRange to edit.
1144+
///
1145+
open func toggleMark(range: NSRange) {
1146+
let formatter = MarkFormatter()
1147+
formatter.placeholderAttributes = self.defaultAttributes
1148+
toggle(formatter: formatter, atRange: range)
1149+
}
1150+
11401151
/// Replaces with an horizontal ruler on the specified range
11411152
///
11421153
/// - Parameter range: the range where the ruler will be inserted

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
1.19.6
2+
-------
3+
* Add support for Mark inline formatting.
4+
15
1.19.5
26
-------
3-
* Addd support for the Mark HTML tag.
7+
* Add support for the Mark HTML tag.
48

59
1.19.4
610
-------

WordPress-Aztec-iOS.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'WordPress-Aztec-iOS'
3-
s.version = '1.19.5'
3+
s.version = '1.19.6'
44

55
s.summary = 'The native HTML Editor.'
66
s.description = <<-DESC

WordPress-Editor-iOS.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'WordPress-Editor-iOS'
3-
s.version = '1.19.5'
3+
s.version = '1.19.6'
44

55
s.summary = 'The WordPress HTML Editor.'
66
s.description = <<-DESC

0 commit comments

Comments
 (0)