Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@slate-yjs/core

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@slate-yjs/core - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

test/collaboration/mergeNode/inSameParent.tsx

6

CHANGELOG.md
# @slate-yjs/core
## 1.0.2
### Patch Changes
- [#411](https://github.com/BitPhinix/slate-yjs/pull/411) [`117c9e5`](https://github.com/BitPhinix/slate-yjs/commit/117c9e504d826ea3ea4e69437f671ada8a44855f) Thanks [@BrentFarese](https://github.com/BrentFarese)! - Patch bug in mergeNode that causes getYTarget to error.
## 1.0.1

@@ -4,0 +10,0 @@

19

dist/index.js

@@ -683,8 +683,17 @@ var __defProp = Object.defineProperty;

if (!prev.yTarget || !target.yTarget) {
const { yParent: parent, textRange } = target;
const previousSibling = Node6.get(slateRoot, Path3.previous(op.path));
if (!Text7.isText(previousSibling)) {
throw new Error("Path points to a y text but not a slate node");
const { yParent: parent, textRange, slateTarget } = target;
if (!slateTarget) {
throw new Error("Expected Slate target node for merge op.");
}
return parent.format(textRange.start, textRange.start - textRange.end, getProperties(previousSibling));
const prevSibling = Node6.get(slateRoot, Path3.previous(op.path));
if (!Text7.isText(prevSibling)) {
throw new Error("Path points to Y.Text but not a Slate text node.");
}
const targetProps = getProperties(slateTarget);
const prevSiblingProps = getProperties(prevSibling);
const unsetProps = Object.keys(targetProps).reduce((acc, key) => {
const prevSiblingHasProp = key in prevSiblingProps;
return prevSiblingHasProp ? acc : __spreadProps(__spreadValues({}, acc), { [key]: null });
}, {});
return parent.format(textRange.start, textRange.end - textRange.start, __spreadValues(__spreadValues({}, unsetProps), prevSiblingProps));
}

@@ -691,0 +700,0 @@ const deltaApplyYOffset = prev.yTarget.length;

{
"name": "@slate-yjs/core",
"sideEffects": false,
"version": "1.0.1",
"version": "1.0.2",
"description": "Yjs binding for Slate.",

@@ -6,0 +6,0 @@ "keywords": [

@@ -30,14 +30,23 @@ import { MergeNodeOperation, Node, Path, Text } from 'slate';

if (!prev.yTarget || !target.yTarget) {
const { yParent: parent, textRange } = target;
const { yParent: parent, textRange, slateTarget } = target;
if (!slateTarget) {
throw new Error('Expected Slate target node for merge op.');
}
const previousSibling = Node.get(slateRoot, Path.previous(op.path));
if (!Text.isText(previousSibling)) {
throw new Error('Path points to a y text but not a slate node');
const prevSibling = Node.get(slateRoot, Path.previous(op.path));
if (!Text.isText(prevSibling)) {
throw new Error('Path points to Y.Text but not a Slate text node.');
}
return parent.format(
textRange.start,
textRange.start - textRange.end,
getProperties(previousSibling)
);
const targetProps = getProperties(slateTarget);
const prevSiblingProps = getProperties(prevSibling);
const unsetProps = Object.keys(targetProps).reduce((acc, key) => {
const prevSiblingHasProp = key in prevSiblingProps;
return prevSiblingHasProp ? acc : { ...acc, [key]: null };
}, {});
return parent.format(textRange.start, textRange.end - textRange.start, {
...unsetProps,
...prevSiblingProps,
});
}

@@ -44,0 +53,0 @@

@@ -40,3 +40,3 @@ import * as Y from 'yjs';

export function yTextToInsertDelta(yText: Y.XmlText): InsertDelta {
return normalizeInsertDelta(yText.toDelta()) as InsertDelta;
return normalizeInsertDelta(yText.toDelta());
}

@@ -43,0 +43,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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