pub struct Capabilities {Show 28 fields
pub bold: bool,
pub italic: bool,
pub code: bool,
pub mark: bool,
pub underline: bool,
pub strike: bool,
pub mark_color: bool,
pub superscript: bool,
pub subscript: bool,
pub heading: bool,
pub blockquote: bool,
pub bullet_list: bool,
pub ordered_list: bool,
pub task: bool,
pub link: bool,
pub image: bool,
pub thematic_break: bool,
pub footnote: bool,
pub code_block: bool,
pub code_language: bool,
pub table: bool,
pub cell_line_break: bool,
pub alignment: bool,
pub line_spacing: bool,
pub font_size: bool,
pub font_family: bool,
pub text_color: bool,
pub page_break: bool,
}Expand description
Which formatting controls this document’s format can spell — the toolbar’s
enabled state, one flag per button, from LeafDoc::capabilities. Mirrors
leaf_core::Capabilities, where the reasoning lives.
Its shape is a flat record of Bools rather than a query taking a gesture
because the Swift side wants exactly one crossing and a value it can hold in
an @Observable: let caps = doc.capabilities(), then
.disabled(!caps.bold) on each control.
Fields§
§bold: bool§italic: bool§code: bool§mark: bool§underline: bool§strike: bool§mark_color: boolLeafDoc::set_mark_color — the highlight palette, which Markdown
spells and djot does not, though both spell the highlight itself. Gate
the swatches on this and on LeafDoc::caret_in_mark, the way the grid
controls take table and caret_in_table: one is a fact about the
format, the other about where the caret is standing.
superscript: bool§subscript: bool§heading: boolBoth LeafDoc::set_heading and LeafDoc::set_paragraph — they are
the same gesture in core and stand or fall together.
blockquote: bool§bullet_list: bool§ordered_list: bool§task: boolLeafDoc::toggle_task_item, LeafDoc::toggle_task_checked and
LeafDoc::toggle_task_at — including a tap on a rendered checkbox,
which should not be live where the box cannot be spelled.
link: bool§image: bool[LeafDoc::insert_image] and LeafDoc::insert_media both.
thematic_break: bool§footnote: boolLeafDoc::insert_footnote. Markdown and djot spell the pair; HTML does
not, so the button goes rather than dims into a refusal.
code_block: boolLeafDoc::toggle_code_block. Markdown and djot spell the fence; HTML
rebuilds the block as <pre><code>. Pair with DocView::code_block
for the button’s lit state.
code_language: bool§table: boolThe grid controls. Gate them on this and LeafDoc::caret_in_table:
this asks whether the format’s tables are editable, that whether the
caret is in one.
cell_line_break: boolShift+Return inside a cell — LeafDoc::cell_line_break.
alignment: boolThe alignment control — LeafDoc::set_alignment. Every format leaf
opens but XML spells a block’s attributes.
line_spacing: boolThe line-spacing menu — LeafDoc::set_line_spacing. The same gesture
as alignment and so the same answer, and its own
flag because a toolbar dims controls one at a time.
font_size: boolThe size menu — LeafDoc::set_font_size. Narrower than the block
pair: it wraps a selection in an attributed span, which AsciiDoc has no
slot for, so this is false there while alignment is
true. The block-level form of the same property — the caret in a
paragraph, nothing selected — still works, which is why the flag
describes the control rather than the caret.
font_family: boolThe face menu — LeafDoc::set_font_family. A span, as
font_size is.
text_color: boolThe text-colour swatches — LeafDoc::set_text_color. A span again, and
not to be confused with mark_color: that is a
highlight’s background and rides the mark node, this is a run’s
foreground and rides an attributed span.
page_break: boolThe page-break button — LeafDoc::insert_page_break. Markdown and djot
and no others, though twig spells the gesture in HTML and AsciiDoc too:
the flag describes what leaf can show, and the walker draws neither of
those spellings yet.