Skip to main content

Module compose

Module compose 

Source
Expand description

The composer view for Avestruz: a note, a reply or a quote being written.

A reply shows what it answers above the text, in brief, and a quote what it quotes under the text, set apart as other clients will show it. The text is in an editor whose state is in the app model, so a popup that closes takes nothing with it. Ctrl+Enter publishes, as the button does; Cancel, beside it, leaves and keeps nothing of what was written.

Above the text, a control chooses between writing it and looking at how it would show: the note as a row of a list would have it, whole, in a frame that stands where the text does and scrolls when it has more than there is room for (see crate::handlers::compose).

The paperclip under the text attaches a file, which is sent to the accountโ€™s media servers; while it is on its way it shows under the text with how far it has got, and when it is there its address goes into the text.

Constantsยง

AROUND_THE_PREVIEW ๐Ÿ”’
How much of the popupโ€™s height is not the frameโ€™s: the line above the composer, the note written to, the files on their way, and the line with the way to publish, with the room between them.
COMPOSE_TAB_WIDTH ๐Ÿ”’
How wide each of the two choices above the text is at least: writing it, and looking at how it would show.
EDITOR_MAX_HEIGHT ๐Ÿ”’
EDITOR_MIN_HEIGHT ๐Ÿ”’
How tall the editor is with little in it, and how tall it grows before the text scrolls inside it.
PREVIEW_PADDING ๐Ÿ”’
The room between the frame what is written shows in and what it shows, as the text has in its own.
PREVIEW_SCROLLBAR ๐Ÿ”’
The room kept on the right of what the frame shows for the bar it scrolls by.
QUOTE_AVATAR_SIZE ๐Ÿ”’
QUOTE_MAX_CHARS ๐Ÿ”’
How much of the note replied to or quoted is shown with the text, in characters, and how wide its authorโ€™s picture is.

Staticsยง

COMPOSE_EDITOR_ID
The editor the text is written in.

Functionsยง

editor_style ๐Ÿ”’
How the editor looks: the themeโ€™s editor, with the thin rounded border its text inputs have rather than a heavy square one.
framed ๐Ÿ”’
shown, which is what is being written as it would show, in the frame that stands where the text does: as tall as what it holds, no shorter than the text is at its shortest and no taller than room, past which it scrolls.
key_binding ๐Ÿ”’
What the keys do in the editor: Ctrl+Enter publishes; pasting asks what is on the clipboard, which may be a file to attach and not text (see crate::handlers::media); Backspace with nothing in the text (empty) for it to rub out leaves the composer (see crate::handlers::compose); and the rest is the editorโ€™s own.
plain_text ๐Ÿ”’
What a note says as one line of plain text: links by their label, people by name, and line breaks as spaces.
quoted_style ๐Ÿ”’
How the note a quote quotes is set apart under the text: in a thin rounded border, as the editor is, in the colour of the lines between rows.
view_leaving ๐Ÿ”’
Whether what was written is kept as a draft, asked of whoever pressed Backspace to leave the composer, and the three answers there are, each with the key that gives it.
view_upload ๐Ÿ”’
A file on its way to a media server: what it is called, how far it has got, and the way to call it off.