SectionContextMenu

A context menu for section break operations (edit name, remove).

Constructor

new SectionContextMenu(x, y, options)

Parameters:
NameTypeDescription
xnumberPreferred left position in viewport pixels.
ynumberPreferred top position in viewport pixels.
optionsobjectOptions and callback functions for the menu.
Properties
NameTypeAttributesDescription
numbernumber<optional>
1-based section number shown in the info block.
namestring<optional>
Current section name shown in the info block.
onEditNamefunctionCalled when "Edit name" is clicked.
onRemovefunctionCalled when "Remove section" is clicked.
onDismissfunction<optional>
Called when the menu is dismissed via outside click.
infoObject | null<optional>
Info widget config passed to the base ContextMenu.
Example
new SectionContextMenu(event.clientX, event.clientY, {
  number: 2,
  name: 'Introduction',
  onEditName: () => focusSectionNameInput(),
  onRemove:   () => workspace._removeSectionBreakWithHistory(beforeSegStart),
  onDismiss:  () => {},
});

Classes

SectionContextMenu