wordpress-mobile / wordpress-mobile/AztecEditor-iOS

Why is func textView(_ textView: TextView, deletedAttachment attachment: MediaAttachment) in the TextViewAttachmentDelegate protocol being called when the user taps on the source code button and comes back to the editor view from html ?

Open
#1,287 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
669
Forks
153
Avg merge
11h 27m
Merged PRs (30d)
4

Description

Hello, thanks for your help. This is a great library. I need to have a model object that represents the pictures in a AztecEditor view. So I need to keep the pictures in the aztecview and the model in sync. There is no problem for the model creation after selecting a picture for insertion, but I need a way to also delete from the model the pictures that get deleted by the user. I came across this in the implementation of the TextViewAttachmentDelegate protocol:

func textView(_ textView: TextView, deletedAttachment attachment: MediaAttachment) {},

that looks exactly what I need. The problem is, I have verified that this delegate method gets called also when switching from html editor to UITextView using the 'sourcecode' button. This breaks my logic. Is there a special reason why the method is called when switching from html to UITextView without even touching the html text before pressing the button ? Many thanks for your help.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the TextViewAttachmentDelegate protocol and the sourcecode button transition described in the issue. Reproduce switching from HTML to UITextView without editing the HTML, then trace when deletedAttachment is called. Done means explaining the callback or preventing a spurious deletion callback while preserving callbacks for actual attachment deletions.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.