❯ ~/robonen/tools
core
  • stdlibapi
  • platformapi
  • fetchapi
  • encodingapi
  • crdtapi
vue
  • vueapi
  • writekitapi
    ❯
    guide
    • Introduction
    • Playground
    • ❯addMark
    • ❯applyInputRule
    • ❯chainCommands
    • ❯convertBlock
    • ❯defaultTextType
    • ❯deleteSelection
    • ❯deleteSelectionInto
    • ❯duplicateBlock
    • ❯ensureNotEmpty
    • ❯exitAtom
    • ❯focusBlock
    • ❯indentListItem
    • ❯insertBlockBeside
    • ❯insertHardBreak
    • ❯insertSliceAt
    • ❯isBlockActive
    • ❯isMarkActive
    • ❯isTextBlockType
    • ❯joinBackward
    • ❯joinForward
    • ❯landingAfter
    • ❯moveBlockDown
    • ❯moveBlocks
    • ❯moveBlockUp
    • ❯outdentListItem
    • ❯removeBlock
    • ❯removeMark
    • ❯replaceSelection
    • ❯selectAll
    • ❯selectionBlockId
    • ❯setBlockType
    • ❯splitBlock
    • ❯toggleBlockType
    • ❯toggleChecked
    • ❯toggleMark
  • primitivesui
configs
  • eslintguide
  • tsconfigguide
  • tsdownguide
infra
  • renovateguide
@robonen/writekit/deleteSelection
V

deleteSelection

tested

Delete the current selection. Handles a node (block-level) selection, a same-block range, and a cross-block range (delete the partial ends, drop the blocks in between, merge the last block into the first). Never leaves an empty document — a fresh paragraph is inserted if everything was removed.

Source Tests

Signature

ts
const deleteSelection: Command
on this page
  • Signature