@remirror/core-utils
Advanced tools
Comparing version 1.0.0-next.49 to 1.0.0-next.50
# @remirror/core-utils | ||
## 1.0.0-next.50 | ||
> 2020-10-15 | ||
### Minor Changes | ||
- [`d27c6e1a`](https://github.com/remirror/remirror/commit/d27c6e1aa83bfd59bde0f1659f0989deb66dad24) [#758](https://github.com/remirror/remirror/pull/758) Thanks [@ifiokjr](https://github.com/ifiokjr)! - Support `EditorState | Selection | ResolvedPos` for the `findParentNodeOfType` function. | ||
### Patch Changes | ||
- [`bd8ac67d`](https://github.com/remirror/remirror/commit/bd8ac67da57c85e67f84cf41e04900f99f4f0455) Thanks [@ifiokjr](https://github.com/ifiokjr)! - Upgrade package dependencies. | ||
- Updated dependencies [[`bd8ac67d`](https://github.com/remirror/remirror/commit/bd8ac67da57c85e67f84cf41e04900f99f4f0455)]: | ||
- @remirror/core-constants@1.0.0-next.50 | ||
- @remirror/core-helpers@1.0.0-next.50 | ||
- @remirror/core-types@1.0.0-next.50 | ||
- @remirror/pm@1.0.0-next.50 | ||
## 1.0.0-next.49 | ||
@@ -4,0 +22,0 @@ |
@@ -537,6 +537,6 @@ "use strict"; | ||
function findParentNode(parameter) { | ||
for (var predicate = parameter.predicate, $from = parameter.selection.$from, depth = $from.depth; depth > 0; depth--) { | ||
var node = $from.node(depth); | ||
for (var predicate = parameter.predicate, selection = parameter.selection, $pos = isEditorState(selection) ? selection.selection.$from : isSelection(selection) ? selection.$from : selection, depth = $pos.depth; depth > 0; depth--) { | ||
var node = $pos.node(depth); | ||
if (predicate(node)) { | ||
var pos = depth > 0 ? $from.before(depth) : 0; | ||
var pos = depth > 0 ? $pos.before(depth) : 0; | ||
return { | ||
@@ -546,3 +546,3 @@ pos: pos, | ||
node: node, | ||
start: $from.start(depth), | ||
start: $pos.start(depth), | ||
end: pos + node.nodeSize | ||
@@ -549,0 +549,0 @@ }; |
@@ -106,3 +106,3 @@ import type { AttributesParameter, EditorSchema, EditorState, EditorView, Fragment, KeyBindingCommandFunction, KeyBindings, MarkTypesParameter, NodeTypeParameter, NodeTypesParameter, OptionalMarkParameter, OptionalProsemirrorNodeParameter, PosParameter, PredicateParameter, ProsemirrorKeyBindings, ProsemirrorNode, ProsemirrorNodeParameter, ResolvedPos, Selection, SelectionParameter, Transaction, TransactionParameter } from '@remirror/core-types'; | ||
export declare function findNodeAtSelection(selection: Selection): FindProsemirrorNodeResult; | ||
interface FindParentNodeOfTypeParameter extends NodeTypesParameter, SelectionParameter { | ||
interface FindParentNodeOfTypeParameter extends NodeTypesParameter, StateSelectionPosParameter { | ||
} | ||
@@ -181,4 +181,10 @@ /** | ||
} | ||
interface FindParentNodeParameter extends SelectionParameter, PredicateParameter<ProsemirrorNode> { | ||
interface StateSelectionPosParameter { | ||
/** | ||
* Provide an editor state, or the editor selection or a resolved position. | ||
*/ | ||
selection: EditorState | Selection | ResolvedPos; | ||
} | ||
interface FindParentNodeParameter extends StateSelectionPosParameter, PredicateParameter<ProsemirrorNode> { | ||
} | ||
/** | ||
@@ -185,0 +191,0 @@ * Returns the position of the node after the current position, selection or |
{ | ||
"name": "@remirror/core-utils", | ||
"version": "1.0.0-next.49", | ||
"version": "1.0.0-next.50", | ||
"description": "Core utilities for dealing with the dom and prosemirror within remirror", | ||
@@ -23,12 +23,12 @@ "homepage": "https://github.com/remirror/remirror/tree/HEAD/packages/@remirror/core-utils", | ||
"dependencies": { | ||
"@babel/runtime": "^7.11.0", | ||
"@remirror/core-constants": "1.0.0-next.49", | ||
"@remirror/core-helpers": "1.0.0-next.49", | ||
"@remirror/core-types": "1.0.0-next.49", | ||
"@babel/runtime": "^7.12.0", | ||
"@remirror/core-constants": "1.0.0-next.50", | ||
"@remirror/core-helpers": "1.0.0-next.50", | ||
"@remirror/core-types": "1.0.0-next.50", | ||
"@types/min-document": "^2.19.0", | ||
"min-document": "^2.19.0", | ||
"type-fest": "^0.17.0" | ||
"type-fest": "^0.18.0" | ||
}, | ||
"devDependencies": { | ||
"@remirror/pm": "1.0.0-next.49", | ||
"@remirror/pm": "1.0.0-next.50", | ||
"@types/node": "^14.11.8", | ||
@@ -38,3 +38,3 @@ "domino": "^2.1.6" | ||
"peerDependencies": { | ||
"@remirror/pm": "1.0.0-next.49", | ||
"@remirror/pm": "1.0.0-next.50", | ||
"@types/node": "*" | ||
@@ -41,0 +41,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
469425
12734
+ Added@remirror/core-constants@1.0.0-next.50(transitive)
+ Added@remirror/core-helpers@1.0.0-next.50(transitive)
+ Added@remirror/core-types@1.0.0-next.50(transitive)
+ Added@remirror/pm@1.0.0-next.50(transitive)
+ Addedtype-fest@0.18.1(transitive)
- Removed@remirror/core-constants@1.0.0-next.49(transitive)
- Removed@remirror/core-helpers@1.0.0-next.49(transitive)
- Removed@remirror/core-types@1.0.0-next.49(transitive)
- Removed@remirror/pm@1.0.0-next.49(transitive)
- Removedtype-fest@0.17.0(transitive)
Updated@babel/runtime@^7.12.0
Updatedtype-fest@^0.18.0