Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4.2.1 #1

Open
wants to merge 73 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
3ea2d0e
Bumped podspec version to 0.8
bummytime Jun 18, 2015
e133548
Merge branch 'release/0.9.1' of github.com:wordpress-mobile/WordPress…
bummytime Oct 2, 2015
297d9c2
Merge branch 'release/1.0' of github.com:wordpress-mobile/WordPress-E…
bummytime Nov 19, 2015
849039b
Merge branch 'release/1.0.1' of github.com:wordpress-mobile/WordPress…
bummytime Nov 19, 2015
69643f9
Merge branch 'develop'
diegoreymendez Jan 6, 2016
d1c8771
Merge branch 'release/1.1.3'
SergioEstevao Mar 2, 2016
1403a7d
Merge branch 'release/1.1.4'
SergioEstevao Mar 8, 2016
e4dc829
Merge branch 'release/1.2'
SergioEstevao Mar 18, 2016
8006da9
Merge branch 'release/1.3'
SergioEstevao Apr 8, 2016
629e190
Merge branch 'release/1.5'
SergioEstevao Apr 15, 2016
4db3b14
Merge branch 'release/1.6'
SergioEstevao Apr 25, 2016
deb5775
Merge branch 'develop'
diegoreymendez Jun 8, 2016
329d6bc
Merge branch 'release/1.7.1'
SergioEstevao Jul 5, 2016
b562d6f
Merge branch 'release/1.8.1'
SergioEstevao Aug 23, 2016
bd13c97
Merge branch 'release/1.9.1'
SergioEstevao Apr 12, 2017
3413286
Added checks for optional delegate method.
bummytime Aug 22, 2017
dfb0512
Documentation updates
bummytime Aug 22, 2017
042ee1a
Updated addSlashes method on WPEditorField
bummytime Aug 22, 2017
abdc279
Merge pull request #891 from wordpress-mobile/issue/sanitize-content
bummytime Aug 22, 2017
2cdf3ec
Bump version to 1.9.4
bummytime Aug 22, 2017
fb2618e
Formatbar: Add method to return toolbar item matching a given tag.
frosty Sep 8, 2017
bae6a3b
Merge pull request #894 from wordpress-mobile/feature/toolbar-buttons
frosty Sep 8, 2017
7e58834
Bump to version 1.9.5 and Cocoapods 1.3.1
frosty Sep 25, 2017
b404c62
Merge pull request #895 from wordpress-mobile/release/1.9.5
frosty Sep 25, 2017
d05a8d0
Update project to Xcode 9 compatibility.
SergioEstevao Oct 6, 2017
eb7de3e
Update Travis configuration.
SergioEstevao Oct 6, 2017
c90b031
Merge pull request #898 from wordpress-mobile/update_project_to_xcode…
SergioEstevao Oct 6, 2017
0b94e5f
Fix layout for iPhone X.
SergioEstevao Oct 6, 2017
0e5af8f
Fix source view fields.
SergioEstevao Oct 6, 2017
c04ba8f
Fix hybrid web view.
SergioEstevao Oct 6, 2017
95a4549
Fix toolbar position on legacy editor on iPhoneX
SergioEstevao Oct 9, 2017
a630413
Fix toolbar position on iPhone X for hybrid editor.
SergioEstevao Oct 9, 2017
4e7c474
New way of creating buttons.
SergioEstevao Oct 9, 2017
7b541a9
Fix bug on resize of toolbar items.
SergioEstevao Oct 9, 2017
bc428bf
Make sure the layout code works for iOS10 too.
SergioEstevao Oct 9, 2017
de99c33
Setup title toolbar bar using the same method.
SergioEstevao Oct 9, 2017
623804c
Try to make the width of toolbar items fixed.
SergioEstevao Oct 9, 2017
645791b
Make sure images on toolbar buttons keep their size.
SergioEstevao Oct 9, 2017
1830f8f
Don’t add textfield inside textview.
SergioEstevao Oct 9, 2017
d1d212a
Hack to solve issue with smaller size screens.
SergioEstevao Oct 10, 2017
dbff036
Make icons always fill the space available.
SergioEstevao Oct 10, 2017
76168c3
Make sure the bottom inset is used when needed.
SergioEstevao Oct 12, 2017
b8c75b6
Move the layout change to a better method.
SergioEstevao Oct 13, 2017
f3e8329
Fix toolbar position.
SergioEstevao Oct 13, 2017
7637c5d
Fix height of toolbars for inputViewAccessories depending of the safe…
SergioEstevao Oct 13, 2017
a6e797b
Address review comments.
SergioEstevao Oct 16, 2017
2ce00f5
Merge pull request #899 from wordpress-mobile/issue/fix_iphoneX_issues
SergioEstevao Oct 16, 2017
516a824
Bump version to 1.9.6
SergioEstevao Oct 16, 2017
758e902
Fix some constraints for the separator line.
SergioEstevao Oct 16, 2017
cfb14a9
Set border constraint.
SergioEstevao Oct 16, 2017
a6cc3e0
Set different constraints for regular and compact borders.
SergioEstevao Oct 16, 2017
7f86df7
Fix toolbar position and size on legacy editor.
SergioEstevao Oct 16, 2017
909757e
Remove commented out code and setup color using stadard colors.
SergioEstevao Oct 16, 2017
029267b
Remove compiler warnings.
SergioEstevao Oct 16, 2017
009dbbb
Merge tag '1.9.6' into develop
SergioEstevao Oct 17, 2017
9635849
Merge branch 'release/1.9.6'
SergioEstevao Oct 17, 2017
3ff1460
Use wrapper view for layout of inputAccessoryView.
SergioEstevao Oct 17, 2017
26590dc
Update code for check for iOS11 availability.
SergioEstevao Oct 17, 2017
6cfb190
Improve wrapperView code by using intrinsic content size.
SergioEstevao Oct 17, 2017
b9c6b46
Update default device on IBEditor.
SergioEstevao Oct 17, 2017
200cf95
Move custom code inside the wrapper view.
SergioEstevao Oct 17, 2017
0b1087b
Fix wrapper view code.
SergioEstevao Oct 18, 2017
b71e878
Address review comments.
SergioEstevao Oct 18, 2017
d11c05e
Fix smartQuotes and smartDashes
SergioEstevao Oct 18, 2017
bd5900c
Merge pull request #905 from wordpress-mobile/issue/904_fix_double_qu…
SergioEstevao Oct 18, 2017
14b275e
Merge pull request #903 from wordpress-mobile/issue/more_fix_for_layouts
SergioEstevao Oct 18, 2017
4dd9014
Bump pod version and to iOS10.
SergioEstevao Oct 18, 2017
c8bccc2
Disable smart quotes and smart dashes on legacy editor.
SergioEstevao Oct 18, 2017
6b041d1
Merge branch 'release/1.9.7'
SergioEstevao Oct 18, 2017
221b7bb
Merge tag '1.9.7' into develop
SergioEstevao Oct 18, 2017
c912bec
Add deprecation notice to README.md
jklausa Dec 13, 2017
4572611
Add note about filing issues in the Aztec repo for missing functional…
jklausa Dec 13, 2017
b56b59e
Merge pull request #912 from wordpress-mobile/deprecation-notice
jklausa Dec 13, 2017
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
osx_image: xcode8.2
osx_image: xcode9
language: objective-c
notifications:
email: true
Expand Down
73 changes: 36 additions & 37 deletions Assets/WPEditorFormatbarView.xib
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="15A282b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina5_9" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="WPEditorFormatbarView">
<rect key="frame" x="0.0" y="0.0" width="482" height="42"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<rect key="frame" x="0.0" y="0.0" width="482" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hzl-cy-vzk">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<animations/>
<rect key="frame" x="0.0" y="0.0" width="482" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="2hQ-8w-6RU"/>
</constraints>
Expand All @@ -38,16 +42,14 @@
<exclude reference="2hQ-8w-6RU"/>
</mask>
</variation>
<variation key="widthClass=regular" misplaced="YES">
<rect key="frame" x="0.0" y="0.0" width="482" height="44"/>
<variation key="widthClass=regular">
<mask key="constraints">
<include reference="2hQ-8w-6RU"/>
</mask>
</variation>
</toolbar>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="n1r-fs-i80">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<animations/>
<rect key="frame" x="0.0" y="0.0" width="482" height="44"/>
<items>
<barButtonItem style="plain" systemItem="flexibleSpace" id="dUc-fD-xmY"/>
<barButtonItem title="Img" width="44" style="plain" id="IvH-tE-Dmv" customClass="ZSSBarButtonItem"/>
Expand All @@ -68,10 +70,9 @@
<barButtonItem style="plain" systemItem="flexibleSpace" id="KpA-gG-9xb"/>
</items>
</toolbar>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5oj-N8-CBI">
<rect key="frame" x="0.0" y="0.0" width="240" height="128"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<view contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5oj-N8-CBI">
<rect key="frame" x="0.0" y="0.0" width="482" height="1"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="DQc-We-xJ8"/>
</constraints>
Expand All @@ -85,24 +86,22 @@
<include reference="DQc-We-xJ8"/>
</mask>
</variation>
<variation key="widthClass=regular" misplaced="YES">
<rect key="frame" x="0.0" y="-2" width="482" height="1"/>
<variation key="widthClass=regular">
<mask key="constraints">
<include reference="DQc-We-xJ8"/>
</mask>
</variation>
</view>
</subviews>
<animations/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="hzl-cy-vzk" secondAttribute="trailing" id="3Cf-0J-TmW"/>
<constraint firstAttribute="trailing" secondItem="5oj-N8-CBI" secondAttribute="trailing" id="3Qa-Uv-8nO"/>
<constraint firstItem="hzl-cy-vzk" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="4b9-4h-eWO"/>
<constraint firstItem="hzl-cy-vzk" firstAttribute="top" secondItem="5oj-N8-CBI" secondAttribute="bottom" id="98w-GC-dOE"/>
<constraint firstItem="5oj-N8-CBI" firstAttribute="leading" secondItem="hzl-cy-vzk" secondAttribute="leading" id="9Gh-oq-DQO"/>
<constraint firstItem="n1r-fs-i80" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="KLa-wT-1Gc"/>
<constraint firstItem="n1r-fs-i80" firstAttribute="top" secondItem="5oj-N8-CBI" secondAttribute="top" id="MY8-Yb-Zho"/>
<constraint firstItem="5oj-N8-CBI" firstAttribute="top" secondItem="hzl-cy-vzk" secondAttribute="top" id="K0a-ZY-Z3h"/>
<constraint firstItem="n1r-fs-i80" firstAttribute="bottom" secondItem="iN0-l3-epB" secondAttribute="bottom" id="KLa-wT-1Gc"/>
<constraint firstItem="5oj-N8-CBI" firstAttribute="top" secondItem="n1r-fs-i80" secondAttribute="top" id="MY8-Yb-Zho"/>
<constraint firstAttribute="bottom" secondItem="hzl-cy-vzk" secondAttribute="bottom" id="NZc-BN-ZZf"/>
<constraint firstItem="n1r-fs-i80" firstAttribute="leading" secondItem="5oj-N8-CBI" secondAttribute="leading" id="Yfe-DH-K5f"/>
<constraint firstItem="5oj-N8-CBI" firstAttribute="trailing" secondItem="hzl-cy-vzk" secondAttribute="trailing" id="b1S-cy-zck"/>
Expand All @@ -120,18 +119,18 @@
<exclude reference="5oj-N8-CBI"/>
</mask>
<mask key="constraints">
<exclude reference="KLa-wT-1Gc"/>
<exclude reference="MY8-Yb-Zho"/>
<exclude reference="Yfe-DH-K5f"/>
<exclude reference="kVg-01-4Kx"/>
<exclude reference="3Cf-0J-TmW"/>
<exclude reference="4b9-4h-eWO"/>
<exclude reference="98w-GC-dOE"/>
<exclude reference="NZc-BN-ZZf"/>
<exclude reference="3Qa-Uv-8nO"/>
<exclude reference="9Gh-oq-DQO"/>
<exclude reference="K0a-ZY-Z3h"/>
<exclude reference="MY8-Yb-Zho"/>
<exclude reference="b1S-cy-zck"/>
<exclude reference="hKN-cF-AOT"/>
<exclude reference="3Cf-0J-TmW"/>
<exclude reference="4b9-4h-eWO"/>
<exclude reference="NZc-BN-ZZf"/>
<exclude reference="KLa-wT-1Gc"/>
<exclude reference="Yfe-DH-K5f"/>
<exclude reference="kVg-01-4Kx"/>
</mask>
</variation>
<variation key="widthClass=compact">
Expand All @@ -140,12 +139,12 @@
<include reference="5oj-N8-CBI"/>
</mask>
<mask key="constraints">
<include reference="KLa-wT-1Gc"/>
<include reference="3Qa-Uv-8nO"/>
<include reference="MY8-Yb-Zho"/>
<include reference="hKN-cF-AOT"/>
<include reference="KLa-wT-1Gc"/>
<include reference="Yfe-DH-K5f"/>
<include reference="kVg-01-4Kx"/>
<include reference="3Qa-Uv-8nO"/>
<include reference="hKN-cF-AOT"/>
</mask>
</variation>
<variation key="widthClass=regular">
Expand All @@ -154,13 +153,12 @@
<include reference="5oj-N8-CBI"/>
</mask>
<mask key="constraints">
<include reference="9Gh-oq-DQO"/>
<include reference="K0a-ZY-Z3h"/>
<include reference="b1S-cy-zck"/>
<include reference="3Cf-0J-TmW"/>
<include reference="4b9-4h-eWO"/>
<include reference="98w-GC-dOE"/>
<include reference="NZc-BN-ZZf"/>
<include reference="9Gh-oq-DQO"/>
<include reference="b1S-cy-zck"/>
<exclude reference="hKN-cF-AOT"/>
</mask>
</variation>
<connections>
Expand All @@ -182,6 +180,7 @@
<outlet property="quoteRegularButton" destination="e8U-7y-KIf" id="io2-3W-Xm7"/>
<outlet property="regularToolbar" destination="hzl-cy-vzk" id="JmV-O8-V0Q"/>
<outlet property="strikeRegularButton" destination="o79-Ie-Knp" id="uxb-KH-prM"/>
<outlet property="toolbarBottomConstraint" destination="KLa-wT-1Gc" id="7ib-qR-R8H"/>
<outlet property="unorderedListButton" destination="TxB-Wv-LZc" id="DpK-lQ-2Pd"/>
<outlet property="unorderedRegularListButton" destination="npM-g4-LTt" id="R4Q-G4-yNS"/>
</connections>
Expand Down
6 changes: 4 additions & 2 deletions Classes/HRColorPickerViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ typedef enum {
*/
- (id)initWithColor:(UIColor*)defaultColor fullColor:(BOOL)fullColor saveStyle:(HCPCSaveStyle)saveStyle;

/** @deprecated use -save: instead of this . */
- (void)saveColor:(id)sender;
/**
* @deprecated use -save: instead of this.
*/
- (void)saveColor:(id)sender __attribute__((deprecated));

- (void)save;
- (void)save:(id)sender;
Expand Down
4 changes: 2 additions & 2 deletions Classes/WPEditorField.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @brief Initializes the field with the specified HTML node id.
*
* @param nodeId The id of the html node this object will wrap. Cannot be nil.
* @param webVieq The web view to use for all javascript calls. Cannot be nil.
* @param webView The web view to use for all javascript calls. Cannot be nil.
*
* @returns The initialized object.
*/
Expand Down Expand Up @@ -87,7 +87,7 @@
/**
* @brief Sets the placeholder color for this field.
*
* @param placeholderText The new placeholder color.
* @param placeholderColor The new placeholder color.
*/
- (void)setPlaceholderColor:(UIColor *)placeholderColor;

Expand Down
20 changes: 13 additions & 7 deletions Classes/WPEditorField.m
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ - (void)setText:(NSString*)text
} else {

if (text) {
text = [self addSlashes:text];
text = [self sanitizeHTML:text];
} else {
text = @"";
}
Expand All @@ -187,7 +187,7 @@ - (void)setHtml:(NSString*)html
} else {

if (html) {
html = [self addSlashes:html];
html = [self sanitizeHTML:html];
} else {
html = @"";
}
Expand All @@ -205,7 +205,7 @@ - (void)setPlaceholderText:(NSString*)placeholderText
if (!self.domLoaded) {
self.preloadedPlaceholderText = placeholderText;
} else {
placeholderText = [self addSlashes:placeholderText];
placeholderText = [self sanitizeHTML:placeholderText];
NSString* javascript = [NSString stringWithFormat:@"%@.setPlaceholderText(\"%@\");", [self wrappedNodeJavascriptAccessor], placeholderText];

[self.webView stringByEvaluatingJavaScriptFromString:javascript];
Expand All @@ -232,15 +232,18 @@ - (void)setPlaceholderColor:(UIColor *)placeholderColor
#pragma mark - URL & HTML utilities

/**
* @brief Adds slashes to the specified HTML string, to prevent injections when calling JS
* @brief Adds slashes and removes script tags from the specified HTML string, to prevent injections when calling JS
* code.
*
* @param html The HTML string to add slashes to. Cannot be nil.
* @param html The HTML string to sanitize. Cannot be nil.
*
* @returns The HTML string with the added slashes.
* @returns The sanitized HTML string.
*/
- (NSString *)addSlashes:(NSString *)html
- (NSString *)sanitizeHTML:(NSString *)html
{
html = [html stringByReplacingOccurrencesOfString:@"—" withString:@"--"];
html = [html stringByReplacingOccurrencesOfString:@"“" withString:@"\""];
html = [html stringByReplacingOccurrencesOfString:@"”" withString:@"\""];
html = [html stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"];
html = [html stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""];
html = [html stringByReplacingOccurrencesOfString:@"\r" withString:@"\\r"];
Expand All @@ -252,6 +255,9 @@ - (NSString *)addSlashes:(NSString *)html
html = [html stringByReplacingOccurrencesOfString:@"\u2028" withString:@"\\u2028"];
html = [html stringByReplacingOccurrencesOfString:@"\u2029" withString:@"\\u2029"];

html = [html stringByReplacingOccurrencesOfString:@"<script>" withString:@"&lt;script&gt;" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [html length])];
html = [html stringByReplacingOccurrencesOfString:@"</script>" withString:@"&lt;/script&gt;" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [html length])];

return html;
}

Expand Down
10 changes: 10 additions & 0 deletions Classes/WPEditorFormatbarView.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
@class WPEditorFormatbarView;
@class ZSSBarButtonItem;

extern const CGFloat WPEditorFormatbarViewToolbarHeight;

typedef enum
{
kWPEditorViewControllerElementTagUnknown = -1,
Expand Down Expand Up @@ -139,6 +141,14 @@ typedef enum

#pragma mark - Toolbar items

/**
* @brief Returns a toolbar item (if any) matching the specified tag.
*
* @param tag WPEditorViewControllerElementTag of the item to return.
* @return A toolbar item with the specified tag.
*/
- (UIBarButtonItem *)toolBarItemWithTag:(WPEditorViewControllerElementTag)tag;

/**
* @brief Makes a toolbar item visible or hidden
*
Expand Down
44 changes: 44 additions & 0 deletions Classes/WPEditorFormatbarView.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
#import "WPEditorToolbarButton.h"
#import "ZSSBarButtonItem.h"

const CGFloat WPEditorFormatbarViewToolbarHeight = 44;

@interface WPEditorFormatbarView ()

@property (unsafe_unretained, nonatomic) IBOutlet UIToolbar *leftToolbar;
@property (unsafe_unretained, nonatomic) IBOutlet UIToolbar *regularToolbar;
@property (unsafe_unretained, nonatomic) IBOutlet UIView *horizontalBorder;
@property (unsafe_unretained, nonatomic) IBOutlet NSLayoutConstraint *toolbarBottomConstraint;

// Compact size class bar button items
@property (unsafe_unretained, nonatomic) IBOutlet ZSSBarButtonItem *imageButton;
Expand Down Expand Up @@ -92,6 +95,24 @@ - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
DDLogInfo(@"Format bar trait collection did change from: %@", previousTraitCollection);
}

- (void)layoutSubviews {
[super layoutSubviews];
// HACK: Sergio Estevao (2017-10-10): Change the size of the items whe running on a device with a width smaller or equal than 320 (iPhone SE)
if (self.frame.size.width <= 320) {
for (UIBarButtonItem *item in self.leftToolbar.items) {
item.width = roundf(item.image.size.width * 0.75);
}
}
}

- (void)layoutMarginsDidChange {
[super layoutMarginsDidChange];
// Sergio Estevao (2017-10-13): On iOS11 we move the contraint to use the safeAreaInsets in order to be safe on iOS11.
if( @available(iOS 11, *)) {
self.toolbarBottomConstraint.constant = -self.safeAreaInsets.bottom;
}
}

#pragma mark - Setters

- (void)setBackgroundColor:(UIColor *)backgroundColor
Expand Down Expand Up @@ -189,6 +210,27 @@ - (void)setSelectedItemTintColor:(UIColor *)selectedItemTintColor

#pragma mark - Toolbar items

- (UIBarButtonItem *)toolBarItemWithTag:(WPEditorViewControllerElementTag)tag
{
// Find whichever toolbar is currently installed in the view hierarchy.
UIToolbar *toolbar;
if (self.leftToolbar.window) {
toolbar = self.leftToolbar;
} else if (self.regularToolbar.window) {
toolbar = self.regularToolbar;
}

if (toolbar) {
for (ZSSBarButtonItem *item in toolbar.items) {
if (item.tag == tag) {
return item;
}
}
}

return nil;
}

- (void)toolBarItemWithTag:(WPEditorViewControllerElementTag)tag setVisible:(BOOL)visible
{
for (ZSSBarButtonItem *item in self.leftToolbar.items) {
Expand Down Expand Up @@ -329,10 +371,12 @@ - (void)initBarButtonItem:(ZSSBarButtonItem*)barButtonItem
customButton.normalTintColor = self.itemTintColor;
customButton.selectedTintColor = self.selectedItemTintColor;
customButton.disabledTintColor = self.disabledItemTintColor;
customButton.imageView.contentMode = UIViewContentModeScaleAspectFill;
[customButton addTarget:target
action:selector
forControlEvents:UIControlEventTouchUpInside];
barButtonItem.customView = customButton;
barButtonItem.image = image;
}

- (void)initBlockQuoteBarButton
Expand Down
6 changes: 3 additions & 3 deletions Classes/WPEditorView.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
* @brief Received when the user taps on a video in the editor.
*
* @param editorView The editor view.
* @param videoId The id of image of the image that was tapped.
* @param videoID The id of image of the image that was tapped.
* @param url The url of the image that was tapped.
*
*/
Expand Down Expand Up @@ -156,7 +156,7 @@ stylesForCurrentSelection:(NSArray*)styles;
* @brief Received when a video local url is replaced by the final remote url.
*
* @param editorView The editor view.
* @param videoId The unique id of the video that had the local url replaced by remote url.
* @param videoID The unique id of the video that had the local url replaced by remote url.
*
*/
- (void)editorView:(WPEditorView*)editorView
Expand All @@ -166,7 +166,7 @@ stylesForCurrentSelection:(NSArray*)styles;
* @brief Received when an image is pasted into the editor.
*
* @param editorView The editor view.
* @param imageId The id of image of the image that was pasted.
* @param image The image that was pasted.
*
*/
- (void)editorView:(WPEditorView*)editorView
Expand Down
Loading