Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdeep committed Oct 9, 2023
1 parent 487a41a commit 3d49028
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,6 @@ class CommandsExampleViewController: ExamplesBaseViewController {

@objc
func encodeContents(sender: UIButton) {
editor.cancelPendingAsyncRendering()
return

let value = editor.transformContents(using: JSONEncoder())
let data = try! JSONSerialization.data(withJSONObject: value, options: .prettyPrinted)
let jsonString = String(data: data, encoding: .utf8)!
Expand Down
2 changes: 1 addition & 1 deletion Proton/Sources/Swift/Core/AsyncTaskScheduler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class AsyncTaskScheduler {
}
}

func clear() {
func cancel() {
runID = UUID().uuidString
tasks.removeAll()
pending = false
Expand Down
4 changes: 2 additions & 2 deletions Proton/Sources/Swift/Editor/EditorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ open class EditorView: UIView {
pendingAttributedText = newValue
return
}
attachmentRenderingScheduler.clear()
attachmentRenderingScheduler.cancel()
// Clear text before setting new value to avoid issues with formatting/layout when
// editor is hosted in a scrollable container and content is set multiple times.
richTextView.attributedText = NSAttributedString()
Expand Down Expand Up @@ -754,7 +754,7 @@ open class EditorView: UIView {
/// - Note:
/// Asynchronous rendering is opt-in feature scheduled by providing `asyncAttachmentRenderingDelegate` to `EditorView`
public func cancelPendingAsyncRendering() {
attachmentRenderingScheduler.clear()
attachmentRenderingScheduler.cancel()
}

/// The range of currently marked text in a document.
Expand Down

0 comments on commit 3d49028

Please sign in to comment.