prosemirror-utils
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -190,5 +190,10 @@ 'use strict'; | ||
if (maybeSelection && nodeBefore) { | ||
var parent = findParentNodeOfType(nodeBefore.type)(maybeSelection); | ||
if (parent) { | ||
return parent.pos; | ||
// leaf node | ||
if (isNodeSelection(maybeSelection)) { | ||
return maybeSelection.$to.pos; | ||
} else { | ||
var parent = findParentNodeOfType(nodeBefore.type)(maybeSelection); | ||
if (parent) { | ||
return parent.pos; | ||
} | ||
} | ||
@@ -666,3 +671,3 @@ } | ||
// Tries to find a valid cursor selection **starting** at the given `position` and returns a new transaction. | ||
// If a valid cursor position hasn't been not found, it will return the original transaction. | ||
// If a valid cursor position hasn't been found, it will return the original transaction. | ||
var setTextSelection = function setTextSelection(position) { | ||
@@ -669,0 +674,0 @@ return function (tr) { |
{ | ||
"name": "prosemirror-utils", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Utils library for ProseMirror", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -223,3 +223,3 @@ # Utils library for ProseMirror | ||
Tries to find a valid cursor selection **starting** at the given `position` and returns a new transaction. | ||
If a valid cursor position hasn't been not found, it will return the original transaction. | ||
If a valid cursor position hasn't been found, it will return the original transaction. | ||
@@ -226,0 +226,0 @@ |
Sorry, the diff of this file is not supported yet
93730
777