Alternera.Plugin.Editor.CappedText (alternera_plugin_editor v0.9.0)

Copy Markdown View Source

A text shown inline after its label, wrapping anywhere. A long one shows its first cap characters with "Show more"; the whole text unfolds under it in a scrolling box, with "Show less". The execution view's step summaries and a plugin host editor's Try trace both show long values with it.

A native <details>, so no server round trip and no icon (nothing here trips the stream carve-out); open is the browser's (JS.ignore_attributes/1), so a re-render does not fold it again.

Summary

Functions

id is the text's (the <details> when long; -more, -less and -full follow it inside), label goes before the text, attrs on the outer element and class on the line.

Whether text is longer than cap characters, so that it folds.

Functions

capped_text(assigns)

id is the text's (the <details> when long; -more, -less and -full follow it inside), label goes before the text, attrs on the outer element and class on the line.

Attributes

  • id (:string) (required)
  • label (:string) - Defaults to "".
  • text (:string) (required)
  • cap (:integer) (required)
  • attrs (:map) - Defaults to %{}.
  • class (:any) - Defaults to nil.

long?(text, cap)

@spec long?(String.t(), non_neg_integer()) :: boolean()

Whether text is longer than cap characters, so that it folds.