Documentation
¶
Overview ¶
Package compose holds the compose window's logic, with no UI: the recipient fields' addresses, Send Later's choices, the attachment reminder, the links the editor keeps and the characters Backspace and Delete take (docs/specs/compose-ui.md). Outgoing mail itself is internal/compose's.
Index ¶
- Constants
- func AllowedLink(href string) bool
- func CharAt(text string, offset int) (start, end int)
- func HTMLText(src string) string
- func HasAttachment(src string, attachments int) bool
- func MentionsAttachment(text string) bool
- func NeedsReminder(src, signatureHTML string, attachments int) bool
- func OwnText(src, signatureHTML string) string
- func ParseAddresses(text string) (addresses []api.Address, invalid []string)
- func RecipientPrefix(text string) (string, string)
- func RuneBefore(text string, offset int) (start, end int)
- func Token(a api.Address) string
- func TomorrowMorning(now time.Time) time.Time
- func ValidAddress(text string) bool
- type Choice
Constants ¶
const Leaf = "\ufffc"
Leaf is what an inline leaf of the message text, such as an image or a line break, stands for in its block's text: 1 position, a character alone.
Variables ¶
This section is empty.
Functions ¶
func AllowedLink ¶ added in v0.10.0
AllowedLink reports whether the editor keeps a link.
func CharAt ¶ added in v0.12.0
CharAt is the character of text that holds offset, from start to end in UTF-16 code units: what Delete deletes in the message text. A character is a grapheme cluster of Unicode's text segmentation (UAX #29), counted from the start of each run of text between Leafs, and a Leaf is a character alone. So an offset inside a character, which the caret can reach, gives the whole of it. At or past the end of text, start and end are both offset.
func HTMLText ¶
HTMLText is the text of HTML: blocks and line breaks end a line, then white space is squashed.
func HasAttachment ¶
HasAttachment reports a chip, or an image outside every quote.
func MentionsAttachment ¶
MentionsAttachment reports whether text holds an attachment word as a whole word.
func NeedsReminder ¶
NeedsReminder reports whether the user's own text mentions an attachment and none is attached.
func OwnText ¶
OwnText is the text the user wrote: no quotes, no attribution line, no signature (docs/specs/compose-ui.md, Attachment reminder).
func ParseAddresses ¶
ParseAddresses splits typed or pasted text into addresses, dropping repeats without regard to case; pieces that do not parse come back as invalid, trimmed.
func RecipientPrefix ¶ added in v0.10.0
RecipientPrefix returns the completed part of a field, including its last separator, and the last unfinished address for completion.
func RuneBefore ¶ added in v0.12.0
RuneBefore is the rune of text that ends at offset, or that holds it, from start to end in UTF-16 code units: what Backspace deletes in the message text. The rich editor counts its positions in UTF-16 code units. At the start of text, start and end are both 0.
Backspace takes 1 rune, not a whole character, because NSGo's rich editor also sends it once for each rune that an input method takes back from the text it typed: a character of several runes would delete more than the input method took.
func Token ¶
Token writes an address as a recipient field's token, which reads back as this one recipient whatever the mail it came from says: the text is untrusted. An address that cannot be written plainly becomes one quoted piece, which is invalid and holds the send back.
func TomorrowMorning ¶
TomorrowMorning is where the Send Later sheet starts.
func ValidAddress ¶
ValidAddress reports whether text is a plausible email address.