Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…rg-mobile into callstack/rnmobile-is-appender
  • Loading branch information
lukewalczak committed Sep 27, 2019
2 parents d91f56c + c364ab4 commit 8fff319
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions react-native-aztec/ios/RNTAztecView/RCTAztecView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,23 @@ class RCTAztecView: Aztec.TextView {
}

override func paste(_ sender: Any?) {
let start = selectedRange.location
let end = selectedRange.location + selectedRange.length

let pasteboard = UIPasteboard.general
let text = readText(from: pasteboard) ?? ""
let html = readHTML(from: pasteboard) ?? ""
let imagesURLs = readImages(from: pasteboard)
sendPasteCallback(text: text, html: html, imagesURLs: imagesURLs);
}

override func pasteWithoutFormatting(_ sender: Any?) {
let pasteboard = UIPasteboard.general
let text = readText(from: pasteboard) ?? ""
let imagesURLs = readImages(from: pasteboard)
sendPasteCallback(text: text, html: "", imagesURLs: imagesURLs);
}

private func sendPasteCallback(text: String, html: String, imagesURLs: [String]) {
let start = selectedRange.location
let end = selectedRange.location + selectedRange.length
onPaste?([
"currentContent": cleanHTML(),
"selectionStart": start,
Expand Down

0 comments on commit 8fff319

Please sign in to comment.