Skip to content

Commit 553e089

Browse files
committed
Fixing focus at
1 parent 58a9471 commit 553e089

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

RichEditorView/Classes/RichEditorView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ open class RichEditorView: UIView, UIScrollViewDelegate, UIWebViewDelegate, UIGe
334334
}
335335

336336
public func focus(at: CGPoint) {
337-
delegate?.richEditorTookFocusAt?(self, at: at)
338337
runJS("RE.focusAtPoint(\(at.x), \(at.y));")
339338
}
340339

@@ -532,8 +531,9 @@ open class RichEditorView: UIView, UIScrollViewDelegate, UIWebViewDelegate, UIGe
532531
/// Called by the UITapGestureRecognizer when the user taps the view.
533532
/// If we are not already the first responder, focus the editor.
534533
@objc private func viewWasTapped() {
534+
let point = tapRecognizer.location(in: webView)
535+
delegate?.richEditorTookFocusAt?(self, at: point)
535536
if !webView.containsFirstResponder {
536-
let point = tapRecognizer.location(in: webView)
537537
focus(at: point)
538538
}
539539
}

RichEditorViewSample/RichEditorViewSample.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@
213213
TargetAttributes = {
214214
39BBCFA91AD0CC7A00A450D2 = {
215215
CreatedOnToolsVersion = 6.2;
216-
DevelopmentTeam = XATA46WWFJ;
216+
DevelopmentTeam = VZRAFDYUBF;
217217
LastSwiftMigration = 0920;
218218
};
219219
39BBCFBE1AD0CC7A00A450D2 = {
@@ -468,7 +468,7 @@
468468
buildSettings = {
469469
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
470470
CLANG_ENABLE_MODULES = YES;
471-
DEVELOPMENT_TEAM = XATA46WWFJ;
471+
DEVELOPMENT_TEAM = VZRAFDYUBF;
472472
INFOPLIST_FILE = RichEditorViewSample/Info.plist;
473473
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
474474
PRODUCT_BUNDLE_IDENTIFIER = "com.cjwirth.$(PRODUCT_NAME:rfc1034identifier)";
@@ -486,7 +486,7 @@
486486
buildSettings = {
487487
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
488488
CLANG_ENABLE_MODULES = YES;
489-
DEVELOPMENT_TEAM = XATA46WWFJ;
489+
DEVELOPMENT_TEAM = VZRAFDYUBF;
490490
INFOPLIST_FILE = RichEditorViewSample/Info.plist;
491491
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
492492
PRODUCT_BUNDLE_IDENTIFIER = "com.cjwirth.$(PRODUCT_NAME:rfc1034identifier)";

RichEditorViewSample/RichEditorViewSample/ViewController.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ class ViewController: UIViewController {
4242
}
4343

4444
extension ViewController: RichEditorDelegate {
45+
46+
func richEditorTookFocusAt(_ editor: RichEditorView, at: CGPoint) {
47+
print("at \(at)")
48+
}
4549

4650
func richEditor(_ editor: RichEditorView, contentDidChange content: String) {
4751
if content.isEmpty {

0 commit comments

Comments
 (0)