Skip to content

Commit

Permalink
Merge pull request wikimedia#4696 from wikimedia/native-editor-new-in…
Browse files Browse the repository at this point in the history
…put-view

Bug fix - Native Editor new input view bug
  • Loading branch information
mazevedofs authored Jan 9, 2024
2 parents 2cce0df + d3a48e4 commit b11bd89
Show file tree
Hide file tree
Showing 46 changed files with 345 additions and 1,106 deletions.

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import UIKit
protocol WKEditorToolbarExpandingViewDelegate: AnyObject {
func toolbarExpandingViewDidTapFind(toolbarView: WKEditorToolbarExpandingView)
func toolbarExpandingViewDidTapFormatText(toolbarView: WKEditorToolbarExpandingView)
func toolbarExpandingViewDidTapFormatHeading(toolbarView: WKEditorToolbarExpandingView)
func toolbarExpandingViewDidTapTemplate(toolbarView: WKEditorToolbarExpandingView, isSelected: Bool)
}

Expand Down Expand Up @@ -40,7 +39,6 @@ class WKEditorToolbarExpandingView: WKEditorToolbarView {
@IBOutlet weak var secondaryContainerView: UIView!

@IBOutlet private weak var formatTextButton: WKEditorToolbarButton!
@IBOutlet private weak var formatHeadingButton: WKEditorToolbarButton!
@IBOutlet private weak var citationButton: WKEditorToolbarButton!
@IBOutlet private weak var linkButton: WKEditorToolbarButton!
@IBOutlet private weak var templateButton: WKEditorToolbarButton!
Expand Down Expand Up @@ -82,11 +80,6 @@ class WKEditorToolbarExpandingView: WKEditorToolbarView {
formatTextButton.accessibilityIdentifier = WKSourceEditorAccessibilityIdentifiers.current?.formatTextButton
formatTextButton.accessibilityLabel = WKSourceEditorLocalizedStrings.current.accessibilityLabelButtonFormatText

formatHeadingButton.setImage(WKIcon.formatHeading, for: .normal)
formatHeadingButton.addTarget(self, action: #selector(tappedFormatHeading), for: .touchUpInside)
formatHeadingButton.accessibilityIdentifier = WKSourceEditorAccessibilityIdentifiers.current?.formatHeadingButton
formatHeadingButton.accessibilityLabel = WKSourceEditorLocalizedStrings.current.accessibilityLabelButtonFormatHeading

citationButton.setImage(WKSFSymbolIcon.for(symbol: .quoteOpening), for: .normal)
citationButton.addTarget(self, action: #selector(tappedCitation), for: .touchUpInside)
citationButton.accessibilityLabel = WKSourceEditorLocalizedStrings.current.accessibilityLabelButtonCitation
Expand Down Expand Up @@ -197,7 +190,6 @@ class WKEditorToolbarExpandingView: WKEditorToolbarView {
}

@objc private func tappedFormatHeading() {
delegate?.toolbarExpandingViewDidTapFormatHeading(toolbarView: self)
}

@objc private func tappedCitation() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina5_9" orientation="landscape" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21678"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="Stack View standard spacing" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
Expand Down Expand Up @@ -35,31 +35,27 @@
<rect key="frame" x="66" y="0.0" width="103.66666666666669" height="44"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="q5y-cw-4pq" customClass="WKEditorToolbarButton" customModule="Components">
<rect key="frame" x="0.0" y="0.0" width="13" height="44"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7QK-zM-3Zu" userLabel="Format Heading Button" customClass="WKEditorToolbarButton" customModule="Components">
<rect key="frame" x="19" y="0.0" width="13" height="44"/>
<rect key="frame" x="0.0" y="0.0" width="15" height="44"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<view contentMode="scaleToFill" placeholderIntrinsicWidth="1" placeholderIntrinsicHeight="20" translatesAutoresizingMaskIntoConstraints="NO" id="jlu-Wy-agF" customClass="WKToolbarSeparatorView" customModule="Components">
<rect key="frame" x="38" y="12" width="0.0" height="20"/>
<rect key="frame" x="21" y="12" width="0.33333333333333215" height="20"/>
<color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ep4-cb-vlw" userLabel="Citation Button" customClass="WKEditorToolbarButton" customModule="Components">
<rect key="frame" x="44" y="0.0" width="13" height="44"/>
<rect key="frame" x="27.333333333333329" y="0.0" width="15" height="44"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lOp-Bv-UED" userLabel="Link Button" customClass="WKEditorToolbarButton" customModule="Components">
<rect key="frame" x="63" y="0.0" width="13" height="44"/>
<rect key="frame" x="48.333333333333329" y="0.0" width="15" height="44"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2n5-hY-lF5" userLabel="Template Button" customClass="WKEditorToolbarButton" customModule="Components">
<rect key="frame" x="82" y="0.0" width="3.6666666666666714" height="44"/>
<rect key="frame" x="69.333333333333343" y="0.0" width="15" height="44"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Oyz-BA-g0g" userLabel="Media Button" customClass="WKEditorToolbarButton" customModule="Components">
<rect key="frame" x="91.666666666666657" y="0.0" width="0.0" height="44"/>
<rect key="frame" x="90.333333333333343" y="0.0" width="1.3333333333333286" height="44"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<view contentMode="scaleToFill" placeholderIntrinsicWidth="1" placeholderIntrinsicHeight="20" translatesAutoresizingMaskIntoConstraints="NO" id="sz5-NF-B4w" customClass="WKToolbarSeparatorView" customModule="Components">
Expand Down Expand Up @@ -279,13 +275,12 @@
<outlet property="decreaseIndentionButton" destination="yOi-nA-z5s" id="BwM-JV-w7e"/>
<outlet property="expandButton" destination="jLt-zh-HFv" id="LkK-4N-EDh"/>
<outlet property="findInPageButton" destination="ysd-bl-nOt" id="YnS-6B-WJp"/>
<outlet property="formatHeadingButton" destination="7QK-zM-3Zu" id="OVa-3o-cP2"/>
<outlet property="formatTextButton" destination="q5y-cw-4pq" id="EVV-8g-wME"/>
<outlet property="increaseIndentionButton" destination="YcQ-k6-ZuB" id="phQ-vm-eKH"/>
<outlet property="linkButton" destination="lOp-Bv-UED" id="I7F-zV-jom"/>
<outlet property="mediaButton" destination="Oyz-BA-g0g" id="Gxu-b5-3Sp"/>
<outlet property="primaryContainerView" destination="BWO-2h-I64" id="8BW-Xe-ftH"/>
<outlet property="orderedListButton" destination="Usg-R3-2O9" id="8Qf-xg-gjD"/>
<outlet property="primaryContainerView" destination="BWO-2h-I64" id="8BW-Xe-ftH"/>
<outlet property="scrollView" destination="ZnR-ux-s6T" id="cvF-Ya-s9R"/>
<outlet property="secondaryContainerView" destination="51i-1d-Lli" id="RSM-Cp-gEO"/>
<outlet property="stackView" destination="ajR-7a-Sik" id="xc8-7a-mMJ"/>
Expand All @@ -296,7 +291,6 @@
<outletCollection property="separatorViews" destination="sz5-NF-B4w" collectionClass="NSMutableArray" id="yOe-nM-pQb"/>
<outletCollection property="separatorViews" destination="bkM-bA-d3o" collectionClass="NSMutableArray" id="Grh-Yo-vCr"/>
<outletCollection property="buttons" destination="q5y-cw-4pq" collectionClass="NSMutableArray" id="93a-IX-ieH"/>
<outletCollection property="buttons" destination="7QK-zM-3Zu" collectionClass="NSMutableArray" id="42T-ed-4l0"/>
<outletCollection property="buttons" destination="Ep4-cb-vlw" collectionClass="NSMutableArray" id="2vE-dm-JfA"/>
<outletCollection property="buttons" destination="lOp-Bv-UED" collectionClass="NSMutableArray" id="t3Q-06-6qC"/>
<outletCollection property="buttons" destination="2n5-hY-lF5" collectionClass="NSMutableArray" id="W2i-Dq-Dag"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ protocol WKEditorToolbarHighlightViewDelegate: AnyObject {
func toolbarHighlightViewDidTapItalics(toolbarView: WKEditorToolbarHighlightView, isSelected: Bool)
func toolbarHighlightViewDidTapTemplate(toolbarView: WKEditorToolbarHighlightView, isSelected: Bool)
func toolbarHighlightViewDidTapShowMore(toolbarView: WKEditorToolbarHighlightView)
func toolbarHighlightViewDidTapFormatHeading(toolbarView: WKEditorToolbarHighlightView)
}

class WKEditorToolbarHighlightView: WKEditorToolbarView {
Expand All @@ -16,11 +15,9 @@ class WKEditorToolbarHighlightView: WKEditorToolbarView {

@IBOutlet private weak var boldButton: WKEditorToolbarButton!
@IBOutlet private weak var italicsButton: WKEditorToolbarButton!
@IBOutlet private weak var formatHeadingButton: WKEditorToolbarButton!
@IBOutlet private weak var citationButton: WKEditorToolbarButton!
@IBOutlet private weak var linkButton: WKEditorToolbarButton!
@IBOutlet private weak var templateButton: WKEditorToolbarButton!
@IBOutlet private weak var clearMarkupButton: WKEditorToolbarButton!
@IBOutlet private weak var showMoreButton: WKEditorToolbarNavigatorButton!

weak var delegate: WKEditorToolbarHighlightViewDelegate?
Expand All @@ -41,11 +38,6 @@ class WKEditorToolbarHighlightView: WKEditorToolbarView {
italicsButton.addTarget(self, action: #selector(tappedItalics), for: .touchUpInside)
italicsButton.accessibilityLabel = WKSourceEditorLocalizedStrings.current?.accessibilityLabelButtonItalics

formatHeadingButton.setImage(WKIcon.formatHeading, for: .normal)
formatHeadingButton.addTarget(self, action: #selector(tappedFormatHeading), for: .touchUpInside)
formatHeadingButton.accessibilityIdentifier = WKSourceEditorAccessibilityIdentifiers.current?.formatHeadingButton
formatHeadingButton.accessibilityLabel = WKSourceEditorLocalizedStrings.current?.accessibilityLabelButtonFormatHeading

citationButton.setImage(WKSFSymbolIcon.for(symbol: .quoteOpening), for: .normal)
citationButton.addTarget(self, action: #selector(tappedCitation), for: .touchUpInside)
citationButton.accessibilityLabel = WKSourceEditorLocalizedStrings.current?.accessibilityLabelButtonCitation
Expand All @@ -57,11 +49,6 @@ class WKEditorToolbarHighlightView: WKEditorToolbarView {
templateButton.setImage(WKSFSymbolIcon.for(symbol: .curlybraces), for: .normal)
templateButton.addTarget(self, action: #selector(tappedTemplate), for: .touchUpInside)
templateButton.accessibilityLabel = WKSourceEditorLocalizedStrings.current?.accessibilityLabelButtonTemplate

clearMarkupButton.setImage(WKIcon.clear, for: .normal)
clearMarkupButton.addTarget(self, action: #selector(tappedClearMarkup), for: .touchUpInside)
clearMarkupButton.accessibilityLabel = WKSourceEditorLocalizedStrings.current?.accessibilityLabelButtonClearFormatting

showMoreButton.setImage(WKSFSymbolIcon.for(symbol: .plusCircleFill), for: .normal)
showMoreButton.addTarget(self, action: #selector(tappedShowMore), for: .touchUpInside)
showMoreButton.accessibilityIdentifier = WKSourceEditorAccessibilityIdentifiers.current?.showMoreButton
Expand Down Expand Up @@ -93,7 +80,6 @@ class WKEditorToolbarHighlightView: WKEditorToolbarView {
}

@objc private func tappedFormatHeading() {
delegate?.toolbarHighlightViewDidTapFormatHeading(toolbarView: self)
}

@objc private func tappedCitation() {
Expand Down
Loading

0 comments on commit b11bd89

Please sign in to comment.