tiptap/docs/api/commands/cut.md
Dominik 7e38c0fa0a
New Cut Command & Position Mapping for insertContentAt (#4141)
* feature(core): add cut commandd and map positions for insertContent

* docs(core): added docs for cut command

* chore(demos): added demo for cut command

---------

Co-authored-by: bdbch <dominik@bdbch.com>
2023-07-07 13:17:13 +02:00

369 B

cut

This command cuts out content and places it into the given position.

See also: focus

Usage

const from = editor.state.selection.from
const to = editor.state.selection.to

const endPos = editor.state.doc.nodeSize - 2

// Cut out content from range and put it at the end of the document
editor.commands.cut({ from, to }, endPos)