wordpress-mobile / wordpress-mobile/AztecEditor-iOS
Read / Write Support for non-standard HTML Attributes
Nessuno ha ancora preso questa issue.
- Lingua principale
- Swift
- Stelle
- 669
- Fork
- 153
- Merge medio
- 11h 27m
- PR unite (30g)
- 4
Descrizione
Description:
We have to provide Apps using Aztec a streamlined mechanism to read-from and write-to non-standard HTML attributes and CSS attributes related to NSAttributedString styles.
The purpose of this ticket is to detail and discuss the complications and implications of trying to provide such support.
One of the possible outcomes of this discussion it to realize that offering support for non-standard HTML attribute editing is not worth the added complexity, in which case we'll most likely need to define which attributes can be edited on a style-by-style scenario.
Current Status:
Right now the only elements that allow editing all of their attributes are <img> and <video> tags.
This information is accessible through the MediaAttachment.extraAttributes (property).
Analysis:
The advantage of this approach is that the attributes are immediately accessible through the attachment object itself, which Apps have access to.
That said, the solution we used for the <img> and <video> tags wouldn't work for other styles. There are two main reasons why this is the case:
<img>and<video>tags have a 1:1 correspondence with theNSAttributedStringstyle used to represent them (ImageAttachmentandVideoAttachment), whereas a<strong>and an<em>tag will both be represented using the sameNSAttributedStringstyle (UIFont).ImageAttachmentandVideoAttachmentalways map to an HTML Element (<img>and<video>) whereas the bold style could map to an HTML Element (<strong>) or to a CSS attribute (font-weight: bold;). In the latter case, it wouldn't make sense for it to haveextraAttributes.
Paragraph-Level Styles vs Regular Styles:
An extra level of complexity is added by Paragraph-Level Styles.
These are styles that can only be applied to full paragraphs (such as <p> or <blockquote>). There are stored inside our custom Aztec.ParagraphStyle class (which subclasses NSParagraphStyle).
Whatever solution we come up with, it has to take Paragraph-Level styles into account.
Proposal:
The proposed solution is based on the intuition that the simplest approach is to separate these styles into different, and as few as possible, categories.
The assumption is that by breaking styles into separate categories, each with its own solution, we can cover all angles.
1st Category: Paragraph-Level Styles
One possible solution to deal with attribute editing in Paragraph-Level styles could be to add an extraAttributes dictionary to our ParagraphProperty class (which is used to represent all of these Paragraph-Level styles).
2nd Category: Attachments & Links
Since attachments are always represented by one HTML element (whether it contains child elements is irrelevant), we could maintain the current approach of offering an extraAttributes dictionary.
We could implement something similar for links, since they're always represented by an <a> element. This would require us to replace URL objects being inserted into Aztec.TextView with our own URL subclass containing an extraAttributes dictionary.
3rd Category: Font Styles
[TO BE DEFINED]
[THE EDITION OF THIS DOCUMENT IS IN PROGRESS]
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia esaminando MediaAttachment.extraAttributes, Aztec.ParagraphStyle, ParagraphProperty e la gestione degli URL di Aztec.TextView descritta nell’issue. Confronta l’approccio esistente agli allegati con gli stili di paragrafo, link, font e CSS, quindi stabilisci un modello di categorie definito e il relativo comportamento di lettura/scrittura supportato. Il lavoro è completato quando il design risolve le complicazioni aperte, inclusi gli stili a livello di paragrafo e la categoria degli stili dei font ancora incompleta.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- html, swift
- Ambito
- frontend, mobile
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 20/100