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

slate

Package Overview
Dependencies
Maintainers
1
Versions
750
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slate - npm Package Compare versions

Comparing version 0.9.0 to 0.9.1

27

dist/models/node.js

@@ -367,2 +367,29 @@ 'use strict';

/**
* Get the common ancestor of nodes `one` and `two` by keys.
*
* @param {String or Node} one
* @param {String or Node} two
* @return {Node}
*/
getCommonAncestor: function getCommonAncestor(one, two) {
this.assertDescendant(one);
this.assertDescendant(two);
var ancestors = new _immutable.List();
var oneParent = this.getParent(one);
var twoParent = this.getParent(two);
while (oneParent) {
ancestors = ancestors.push(oneParent);
oneParent = this.getParent(oneParent);
}
while (twoParent) {
if (ancestors.includes(twoParent)) return twoParent;
twoParent = this.getParent(twoParent);
}
},
/**
* Get a descendant node by `key`.

@@ -369,0 +396,0 @@ *

40

dist/models/transforms.js

@@ -136,41 +136,47 @@ 'use strict';

var end = range.collapseToEnd();
node = node.splitBlockAtRange(start, Infinity);
node = node.splitBlockAtRange(end, Infinity);
var ancestor = node.getCommonAncestor(startKey, endKey);
var isAncestor = ancestor == node;
var startText = node.getDescendant(startKey);
var startEdgeText = node.getNextText(startKey);
ancestor = ancestor.splitBlockAtRange(start, Infinity);
ancestor = ancestor.splitBlockAtRange(end, Infinity);
var endText = node.getNextText(endKey);
var endEdgeText = node.getDescendant(endKey);
var startText = ancestor.getDescendant(startKey);
var startEdgeText = ancestor.getNextText(startKey);
var endText = ancestor.getNextText(endKey);
var endEdgeText = ancestor.getDescendant(endKey);
// Remove the new blocks inside the edges.
var startEdgeBlock = node.getFurthestBlock(startEdgeText);
var endEdgeBlock = node.getFurthestBlock(endEdgeText);
var startEdgeBlock = ancestor.getFurthestBlock(startEdgeText);
var endEdgeBlock = ancestor.getFurthestBlock(endEdgeText);
var nodes = node.nodes.takeUntil(function (n) {
var nodes = ancestor.nodes.takeUntil(function (n) {
return n == startEdgeBlock;
}).concat(node.nodes.skipUntil(function (n) {
}).concat(ancestor.nodes.skipUntil(function (n) {
return n == endEdgeBlock;
}).rest());
node = node.merge({ nodes: nodes });
ancestor = ancestor.merge({ nodes: nodes });
// Take the end edge's split text and move it to the start edge.
var startBlock = node.getClosestBlock(startText);
var endChild = node.getFurthestInline(endText) || endText;
var startBlock = ancestor.getClosestBlock(startText);
var endChild = ancestor.getFurthestInline(endText) || endText;
var startNodes = startBlock.nodes.push(endChild);
startBlock = startBlock.merge({ nodes: startNodes });
node = node.updateDescendant(startBlock);
ancestor = ancestor.updateDescendant(startBlock);
// While the end child is an only child, remove the block it's in.
var endParent = node.getClosestBlock(endChild);
var endParent = ancestor.getClosestBlock(endChild);
while (endParent && endParent.nodes.size == 1) {
endChild = endParent;
endParent = node.getClosestBlock(endParent);
endParent = ancestor.getClosestBlock(endParent);
}
node = node.removeDescendant(endChild);
ancestor = ancestor.removeDescendant(endChild);
// Update the node.
node = isAncestor ? ancestor : node.updateDescendant(ancestor);
// Normalize the adjacent text nodes.

@@ -177,0 +183,0 @@ return node.normalize();

{
"name": "slate",
"description": "A completely customizable framework for building rich text editors.",
"version": "0.9.0",
"version": "0.9.1",
"license": "MIT",

@@ -53,5 +53,5 @@ "repository": "git://github.com/ianstormtaylor/slate.git",

"selection-position": "^1.0.0",
"slate-auto-replace-text": "^0.2.0",
"slate-collapse-on-escape": "^0.1.0",
"slate-soft-break": "^0.1.0",
"slate-auto-replace-text": "^0.3.0",
"slate-collapse-on-escape": "^0.2.0",
"slate-soft-break": "^0.2.0",
"source-map-support": "^0.4.0",

@@ -58,0 +58,0 @@ "to-camel-case": "^1.0.0",

Sorry, the diff of this file is too big to display

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