New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

prosemirror-utils

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-utils - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

15

dist/index.js

@@ -74,2 +74,16 @@ 'use strict';

// :: (nodeType: union<NodeType, [NodeType]>) → (selection: Selection) → ?ProseMirrorNode
// Returns a node of a given `nodeType` if its selected.
var findSelectedNodeOfType = function findSelectedNodeOfType(nodeType) {
return function (selection) {
if (selection.node) {
var node = selection.node;
if (Array.isArray(nodeType) && nodeType.indexOf(node.type) > -1 || node.type === nodeType) {
return node;
}
}
};
};
// :: (node: ProseMirrorNode, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]

@@ -412,2 +426,3 @@ // Flattens descendants of a given `node`. Doesn't descend into a `node` when `descend` argument is `false`. Defaults to `true`.

exports.findParentDomRefOfType = findParentDomRefOfType;
exports.findSelectedNodeOfType = findSelectedNodeOfType;
exports.flatten = flatten;

@@ -414,0 +429,0 @@ exports.findChildren = findChildren;

2

package.json
{
"name": "prosemirror-utils",
"version": "0.0.7",
"version": "0.0.8",
"description": "Utils library for ProseMirror",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -13,3 +13,3 @@ # Utils library for ProseMirror

Getting the parent node based on the current cursor position:
### Selection

@@ -34,3 +34,3 @@ * **`findParentNode`**`(predicate: fn(node: ProseMirrorNode) → boolean) → fn(selection: Selection) → ?{pos: number, node: ProseMirrorNode}`\

Getting descendants of a given node:
### Node

@@ -65,4 +65,7 @@ * **`flatten`**`(node: ProseMirrorNode, descend: ?boolean = true) → [{node: ProseMirrorNode, pos: number}]`\

Tables helpers:
- **`findSelectedNodeOfType`**`(nodeType: NodeType | [NodeType]) → fn(selection: Selection) → ?ProseMirrorNode`\
Returns a node of a given `nodeType` if its selected.
### Tables
* **`findTable`**`(selection: Selection) → ?{pos: number, node: ProseMirrorNode}`\

@@ -92,3 +95,3 @@ Iterates over parent nodes, returning the first found table node.

Transforms:
### Transforms

@@ -95,0 +98,0 @@ * **`removeParentNodeOfType`**`(nodeType: NodeType) → fn(tr: Transaction) → Transaction`\

@@ -8,3 +8,3 @@ import { Node as ProsemirrorNode, NodeType, MarkType } from 'prosemirror-model';

// ancestors
// Selection
export function findParentNode(predicate: Predicate): (selection: Selection) => {pos: number, node: ProsemirrorNode} | undefined;

@@ -22,3 +22,5 @@

// descendants
export function findSelectedNodeOfType(nodeType: NodeType | NodeType[]): (selection: Selection) => ProsemirrorNode | undefined;
// Node
export function flatten(node: ProsemirrorNode, descend?: boolean): {pos: number, node: ProsemirrorNode}[];

@@ -42,3 +44,3 @@

// table
// Tables
export function findTable(selection: Selection): {pos: number, node: ProsemirrorNode} | undefined;

@@ -45,0 +47,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc