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.7.6 to 0.7.7

68

dist/index.js

@@ -351,2 +351,21 @@ 'use strict';

// (rect: {left: number, right: number, top: number, bottom: number}) → (selection: Selection) → boolean
// Checks if a given CellSelection rect is selected
var isRectSelected = function isRectSelected(rect) {
return function (selection) {
var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));
var start = selection.$anchorCell.start(-1);
var cells = map.cellsInRect(rect);
var selectedCells = map.cellsInRect(map.rectBetween(selection.$anchorCell.pos - start, selection.$headCell.pos - start));
for (var i = 0, count = cells.length; i < count; i++) {
if (selectedCells.indexOf(cells[i]) === -1) {
return false;
}
}
return true;
};
};
// :: (predicate: (node: ProseMirrorNode) → boolean) → (selection: Selection) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}

@@ -360,16 +379,5 @@ // Iterates over parent nodes, returning the closest node and its start position `predicate` returns truthy for. `start` points to the start position of the node, `pos` points directly before the node.

var findParentNode = function findParentNode(predicate) {
return function (selection) {
var $from = selection.$from;
for (var i = $from.depth; i > 0; i--) {
var node = $from.node(i);
if (predicate(node)) {
return {
pos: i > 0 ? $from.before(i) : 0,
start: $from.start(i),
depth: i,
node: node
};
}
}
return function (_ref) {
var $from = _ref.$from;
return findParentNodeClosestToPos($from, predicate);
};

@@ -726,7 +734,9 @@ };

if (isCellSelection(selection)) {
var rect = getSelectionRect(selection);
if (!rect) {
return false;
}
return selection.isColSelection() && columnIndex >= rect.left && columnIndex < rect.right;
var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));
return isRectSelected({
left: columnIndex,
right: columnIndex + 1,
top: 0,
bottom: map.height
})(selection);
}

@@ -747,7 +757,9 @@

if (isCellSelection(selection)) {
var rect = getSelectionRect(selection);
if (!rect) {
return false;
}
return selection.isRowSelection() && rowIndex >= rect.top && rowIndex < rect.bottom;
var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));
return isRectSelected({
left: 0,
right: map.width,
top: rowIndex,
bottom: rowIndex + 1
})(selection);
}

@@ -767,3 +779,9 @@

if (isCellSelection(selection)) {
return selection.isColSelection() && selection.isRowSelection();
var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));
return isRectSelected({
left: 0,
right: map.width,
top: 0,
bottom: map.height
})(selection);
}

@@ -770,0 +788,0 @@

{
"name": "prosemirror-utils",
"version": "0.7.6",
"version": "0.7.7",
"description": "Utils library for ProseMirror",

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

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