typograph-editor-documentation
    Preparing search index...

    Class Toolbar

    Index
    _add_caps_toggle _add_decoration_toggle _add_flip_toggle _add_hyphenation_toggle _add_list_toggle _add_palette _add_spellcheck_toggle _add_super_sub_control _add_table_control _capitalization_at_caret _decoration_color_hex _decoration_font _decoration_row _end_group _palette_row _palette_row_inline _read_selection_stroke _selection_stroke _sized_icon _start_group _update_drop_cap_inactive_state _update_hyphenation_inactive_state addBaselineOption addBlendMode addBorderColor addBorderDash addColumnControls addDropCapControls addElement addFillColor addGrab addHyphenationControls addImageControls addIndentControls addLineCap addLineJoin addMiterLimit addOpacity addOpenSelect addPath addSelect addSeparator addSpellCheckControls addStrokeAlignment addStrokeColor addStrokeSize addTableSelection addText addUndoRedo addVerticalAlign apply_table_stroke build_decoration build_decoration_one build_opacity_blend build_spacing build_stroke build_table_ops build_table_stroke build_text_position_params current_line_join current_stroke_alignment get_redo_id get_undo_id opacity_call_back opacity_drag_end opacity_drag_start paint_line_cap paint_line_join paint_stroke_alignment resolve_display_font_name set_active_object set_Align set_balanced set_columns set_drop_cap_characters set_drop_cap_font_size set_drop_cap_lines set_gutter set_hyphen_after set_hyphen_before set_hyphen_limit set_hyphenation_enabled set_Justify set_letter_spacing_str set_LineSpace set_lineSpace_str set_menuitems_font set_spellcheck_enabled set_table_stroke_dash_name set_table_stroke_weight setAlign setBorderColor setCellFillColor setColor setCursor setFillColor setGrab setJustify setLastTool setLineSpace setmenuitems setPath setSelect setSelect_open setShadowColor setStrokeColor setStrokeSize setTextColor sync_font_titles updateColor updateFontNamesMenu
    _raw_font_name: string = null
    _raw_font_style: string = null
    active_tool: HTMLDivElement
    balanced_btn: SVGcontrol
    baseline_options: Popupmenu
    bordercolor: Colorswatch
    borderdash: Popupmenu_canvas
    cellfill_swatch: Colorswatch = null
    columns_input: Inputfield
    drop_cap_chars_el: HTMLElement = null
    drop_cap_chars_input: Inputfield = null
    drop_cap_lines_input: Inputfield = null
    drop_cap_size_el: HTMLElement = null
    drop_cap_size_input: Inputfield = null
    fonts_sizes: Popupmenu_edit
    fonts_styles: Popupmenu
    grab: HTMLDivElement
    gutter_input: Inputfield
    hyphen_after_input: Inputfield = null
    hyphen_before_input: Inputfield = null
    hyphen_limit_input: Inputfield = null
    id: string
    justify_menu: Popupmenu_svg = null
    last_tool: HTMLDivElement
    letter_spacing_input: Popupmenu_edit
    line_spacing: Popupmenu_edit
    line_spacing_svg: SVGcontrol
    menuitems_font: menuitemdata_font[]
    miter_limit_input: HTMLInputElement = null
    on_tool_change: () => void = null
    path: HTMLDivElement
    popup_ui_blendmodes: Popupmenu
    redo: HTMLDivElement
    select: HTMLDivElement
    select_open: HTMLDivElement
    spellcheck_switch: Switch = null
    stroke_size: Popupmenu_edit = null
    strokecolor: Colorswatch
    textcolor: Colorswatch
    type: string
    unbalanced_btn: SVGcontrol
    undo: HTMLDivElement
    valign_menu: Popupmenu_svg = null
    • All caps: a plain on/off toggle, the same idiom as underline beside it — the icon swaps between its off and active artwork rather than being painted over.

      No params popup, because there is nothing to configure. Underline has a weight, an offset and a colour; a case transform has none of those, so a button that opened an empty panel would be worse than one that just toggles.

      Small caps is not offered. The schema carries the value and a conversion records it, but nothing renders it yet, and a control that writes a setting the page ignores is a promise the product does not keep (TYP-663).

      Parameters

      • el: PageElementRichText

      Returns void

    • Parameters

      • el: PageElementRichText
      • kind: "underline" | "strikethrough"
      • icon_off: string
      • icon_on: string

      Returns void

    • Flip horizontally and flip vertically, for whatever element is selected.

      On the base element rather than on images, so a shape, a path, a text frame and a picture all get it from one place — the same reason the canvas put the pair on PageElement and applied it in the one transform every draw and hit test already goes through (TYP-716).

      Two independent toggles, not a radio pair: an element can be mirrored in both axes, which is a different thing from either alone and the same thing as half a turn.

      ⚠️ set_undo() and set_redo() must bracket the change. set_undo() alone leaves the step open, and the next edit overwrites its before-state — the flip becomes un-undoable and takes whatever followed it down with it (TYP-653).

      Parameters

      • el: PageElement
      • axis: "horizontal" | "vertical"

      Returns void

    • Hyphenation: the button is the on/off switch, and turning it ON opens the params below.

      It used to be a plain palette whose popup carried an on/off switch as its first row, so turning hyphenation on took two clicks and the button's own state said nothing. Same shape as spell-check (a direct toggle) and as underline/strikethrough (turning it on reveals its parameters) — the popup now holds only the parameters.

      Parameters

      • el: PageElementRichText

      Returns void

    • One list toggle — bulleted or numbered — for the paragraph the caret is in.

      The icon SWAPS between its off and active variants rather than being painted over with a background, which is the idiom the four artworks in control_defaults were drawn for: the active pair carry their own plate behind the frame. The stroke-alignment row paints its own selection instead, and copying that here would put a highlight behind an icon that already has one.

      Two independent toggles rather than a radio row, so clicking the active one turns the list off. They are still mutually exclusive in effect — setListType writes one value — and each repaints both, since turning bullets on has to turn numbers off on screen as well.

      Greyed inside a table cell: v1 does not draw markers there, so an enabled button would write a setting that never shows.

      Parameters

      • el: PageElementRichText
      • kind: "number" | "bullet"

      Returns void

    • Icon-only palette trigger with an off/on push-button icon: shows icon_off normally and icon_on while its popup (opened below the button) is open. Pass one icon to keep a single visual. TYP-422 toolbar UX.

      Parameters

      • component: string
      • icon_off: string
      • build: () => void
      • Optionalicon_on: string

      Returns void

    • Parameters

      • el: PageElementRichText

      Returns void

    • Super/subscript control: a two-cell push-button (superscript | subscript). The whole icon swaps to reflect the active position (off / superscript-on / subscript-on). Clicking a cell toggles that position on the selection (click again clears to 'normal'); turning a position on opens the size % / position % params popup below (TYP-422 toolbar UX).

      Parameters

      • el: PageElementRichText

      Returns void

    • Parameters

      • el: PageElementRichText

      Returns void

    • The letter case in force where the caret is, or across a selection.

      Not read off the resolved font the way underline and strikethrough are: capitalization is deliberately not a font property — the font object the resolver returns is what gets serialized as the element's default_font — so the editor exposes it separately, through the caps_resolver that layout itself uses. Asking the same resolver keeps the button and the page answering the same question (TYP-663).

      Parameters

      • el: PageElementRichText

      Returns string

    • The colour to paint in the decoration's swatch well.

      resolved_hex is the decoration's colour as story_style_to_font worked it out — run override, then character style, then PARAGRAPH STYLE, then the text fill — already a hex. It comes first because this used to read the run's own override ALONE, so a colour stated by a paragraph style was invisible: H3 in the Project Proposal brochure states underline_color: Color/Paper, the canvas drew the bar white all along, and the well showed the text colour instead (TYP-705).

      The swatch-uuid path below is kept for the case where the resolved font carries no colour of its own, and fill_hex remains the last word.

      Parameters

      • el: PageElementRichText
      • prefix: string
      • fill_hex: string
      • Optionalresolved_hex: string

      Returns string

    • Resolves the font used to seed the decoration controls. get_font_at_cursor() reads at cursorLocation, which during a drag-selection sits on the anchor boundary; get_char_run_at_offset() resolves a boundary offset to the PRECEDING run, so a left-to-right drag that starts exactly on a decorated run's left edge reads the undecorated run before it (underline/strikethrough appear off). When a selection exists, read from the first character run that actually overlaps it — mirroring get_selection_point_size — so the state is correct regardless of drag direction or start position. Falls back to the cursor font when there is no selection.

      Parameters

      • el: PageElementRichText

      Returns any

    • Parameters

      • el: PageElementRichText
      • prefix: string
      • label_text: string
      • on: boolean
      • weight: number
      • offset: number
      • fill_hex: string
      • show_switch: boolean = true

      Returns void

    • Wraps one palette control in a data-pb-component row inside the current popup panel, runs fill with this._group pointed at the row so existing add* methods append into it.

      Parameters

      • component: string
      • fill: () => void

      Returns void

    • Two or more palette controls on ONE line. _palette_row stacks its rows, so a control that belongs beside its neighbour rather than under it needs a row to share. The nested rows keep their own data-pb-component, so EditorUI can still hide either control on its own; their padding is dropped afterwards, since it would otherwise widen the gap that gap is there to set.

      Parameters

      • gap_px: number
      • fill: () => void

      Returns void

    • Parameters

      • editor: any

      Returns { color_swatch_uuid: string; type: string; weight: number }

    • The stroke the flyout is describing: the SELECTED TEXT's while the editor has focus, and the frame's own otherwise.

      Every stroke setter in textcommands.ts is selection-first, frame-second — a selection writes the runs it covers, a bare caret writes the frame's default. The controls have to be read the same way round or they describe something the buttons will not change: a 4 pt run in a frame whose default is 0 showed 0 pt, and setting it to 2 pt left the popup saying 0 pt for ever after, because the frame's default never moved.

      Returns null outside text mode, or when there is no editor to ask. A property that DIFFERS across the selection comes back as null from canvas, and each caller shows that as blank rather than as one of the values (TYP-645).

      Parameters

      • el: PageElement
      • text_mode: boolean

      Returns any

    • Adds an icon-only toolbar trigger that opens a ToolbarPopup palette. The trigger lives in its own toolbar group (key toolbar.<component>), so the whole palette is hide/disable-able via the normal _apply_toolbar path. build populates the flyout panel; it runs with this._group pointed at the panel so the existing add methods and _palette_row append into it. Inner rows use data-pb-component so EditorUI keys resolve as toolbar.<component>.<row>.

      Parameters

      • svg: string
      • w: number = 23
      • h: number = 23

      Returns string

    • Parameters

      • name: string
      • container_id: string = 'tools'

      Returns void

    • Parameters

      • lines: number

      Returns void

    • Parameters

      • enabled: boolean

      Returns void

    • Parameters

      • el: PageElementRichText

      Returns void

    • Parameters

      • el: PageElement

      Returns HTMLElement

    • Parameters

      • el: PageElement

      Returns HTMLElement

    • Parameters

      • el: PageElement

      Returns HTMLElement

    • Parameters

      • el: PageElementRichText

      Returns void

    • Parameters

      • el: PageElementRichText

      Returns void

    • Parameters

      • element: HTMLElement
      • id: string = 'tools'

      Returns void

    • Parameters

      • e: PageElement

      Returns HTMLElement

    • Parameters

      • el: PageElementRichText

      Returns void

    • Parameters

      • el: PageElementImage

      Returns void

    • Left, right and first-line indent for the paragraph the caret is in, in millimetres.

      Reads the RESOLVED values, so a paragraph that inherits an indent from its style shows what the text actually does rather than an empty field. Each input writes only its own key, so changing one does not clear the other two.

      First line is offered as InDesign offers it — an offset from the left indent, negative for a hang. It is not clamped to zero here: a hanging indent IS the negative case, and it is the whole reason this control exists.

      Returns void

    • Parameters

      • el: PageElement

      Returns HTMLElement

    • Parameters

      • el: PageElement

      Returns HTMLElement

    • Parameters

      • el: PageElement

      Returns HTMLElement

    • Parameters

      • el: PageElement

      Returns HTMLElement

    • Parameters

      • id: string = 'tools'

      Returns HTMLDivElement

    • Parameters

      • el: PageElementRichText

      Returns void

    • Parameters

      • el: PageElement

      Returns HTMLElement

    • Parameters

      • el: PageElement

      Returns HTMLElement

    • Parameters

      • el: PageElement

      Returns HTMLElement

    • Parameters

      • e: PageElementRichText

      Returns void

    • Parameters

      • el: PageElementRichText

      Returns void

    • Parameters

      • el: PageElementRichText

      Returns void

    • Parameters

      • el: PageElementRichText
      • clear: boolean

      Returns void

    • Parameters

      • el: PageElementRichText

      Returns void

    • Parameters

      • el: PageElementRichText
      • kind: "underline" | "strikethrough"

      Returns void

    • Parameters

      • el: PageElement

      Returns void

    • Parameters

      • el: PageElementRichText
      • font_size: number

      Returns void

    • Parameters

      • el: PageElement

      Returns void

    • Parameters

      • el: PageElementRichText

      Returns void

    • Parameters

      • el: PageElementRichText

      Returns void

    • Params popup for super/subscript: size % and position % for the selection's active position. Writes superscript_size/position or subscript_size/position accordingly; greyed out when the selection is 'normal' or mixed.

      Parameters

      • el: PageElementRichText

      Returns void

    • The join the control should show, on the same selection-first rule as the alignment row.

      setLineJoin() writes three different places depending on where the caret is — the runs a selection covers, else the frame's text_stroke_join, else the border's line_join — while this control read the BORDER's join in every case, which is the one of the three a focused editor never writes.

      Unlike the width and the dash, a mixed selection cannot show blank: the control draws a corner rather than printing a word, and has no empty state. It falls back to the frame's own text join, which is what an un-joined run is drawn with anyway.

      Parameters

      • el: PageElement

      Returns line_join_type

    • Parameters

      • el: PageElement
      • text_mode: boolean

      Returns stroke_alignment_type

    • Parameters

      • n: number

      Returns void

    • Parameters

      • _n: number

      Returns void

    • Parameters

      • _n: number

      Returns void

    • Parameters

      • active: line_cap_type

      Returns void

    • Parameters

      • active: line_join_type

      Returns void

    • Parameters

      • active: stroke_alignment_type
      • text_mode: boolean

      Returns void

    • When toolbar.font_face.default_font is hidden and font_name equals the default font, returns the first non-default active font family name instead (or '' if none). Pass null (mixed selection) to get '' directly.

      Parameters

      • font_name: string

      Returns string

    • Parameters

      • el: PageElement = null

      Returns void

    • Parameters

      • id: string
      • callback: boolean = true

      Returns void

    • Parameters

      • id: string

      Returns void

    • Parameters

      • value: string

      Returns void

    • Parameters

      • value: string

      Returns void

    • Parameters

      • value: string

      Returns void

    • Parameters

      • value: string

      Returns void

    • Parameters

      • value: string

      Returns void

    • Parameters

      • value: string

      Returns void

    • Parameters

      • value: string

      Returns void

    • Parameters

      • value: string

      Returns void

    • Parameters

      • enabled: boolean

      Returns void

    • Parameters

      • id: string
      • callback: boolean = true

      Returns void

    • Parameters

      • str: string

      Returns void

    • Parameters

      • el: PageElementRichText
      • Optionalcursor_font_size: number

      Returns void

    • Parameters

      • value: string

      Returns void

    • Parameters

      • enabled: boolean

      Returns void

    • Parameters

      • name: string

      Returns void

    • Parameters

      • weight: number

      Returns void

    • Parameters

      • id: string
      • callback: boolean = true

      Returns void

    • Parameters

      • e: MouseEvent

      Returns void

    • Parameters

      • id: string
      • callback: boolean = true

      Returns void

    • Parameters

      • leading: string
      • update_titel: boolean = false
      • callback: boolean = true

      Returns void

    • Parameters

      • size: string

      Returns void

    • Re-resolve the displayed font-face and font-style titles immediately. Called by EditorUI.apply() so that hiding/showing default_font takes effect without requiring a full toolbar rebuild.

      Returns void