prosemirror-utils
Advanced tools
Comparing version 0.8.3 to 0.9.0
{ | ||
"name": "prosemirror-utils", | ||
"version": "0.8.3", | ||
"version": "0.9.0", | ||
"description": "Utils library for ProseMirror", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -826,3 +826,3 @@ # Utils library for ProseMirror | ||
* **`replaceSelectedNode`**`(node: ProseMirrorNode) → fn(tr: Transaction) → Transaction`\ | ||
Returns a new transaction that replaces selected node with a given `node`. | ||
Returns a new transaction that replaces selected node with a given `node`, keeping NodeSelection on the new `node`. | ||
It will return the original transaction if either current selection is not a NodeSelection or replacing is not possible. | ||
@@ -850,4 +850,5 @@ | ||
* **`safeInsert`**`(content: ProseMirrorNode | Fragment, position: ?number) → fn(tr: Transaction) → Transaction`\ | ||
* **`safeInsert`**`(content: ProseMirrorNode | Fragment, position: ?number, tryToReplace: ?boolean) → fn(tr: Transaction) → Transaction`\ | ||
Returns a new transaction that inserts a given `content` at the current cursor position, or at a given `position`, if it is allowed by schema. If schema restricts such nesting, it will try to find an appropriate place for a given node in the document, looping through parent nodes up until the root document node. | ||
If `tryToReplace` is true and current selection is a NodeSelection, it will replace selected node with inserted content if its allowed by schema. | ||
If cursor is inside of an empty paragraph, it will try to replace that paragraph with the given content. If insertion is successful and inserted node has content, it will set cursor inside of that content. | ||
@@ -854,0 +855,0 @@ It will return an original transaction if the place for insertion hasn't been found. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
236188
2139
965