You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

y-prosemirror

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.4 to 0.1.5

32

dist/y-prosemirror.js

@@ -222,3 +222,6 @@ 'use strict';

props: {
editable: (state) => ySyncPluginKey.getState(state).snapshot == null
editable: (state) => {
const syncState = ySyncPluginKey.getState(state);
return syncState.snapshot == null && syncState.prevSnapshot == null
}
},

@@ -251,3 +254,3 @@ key: ySyncPluginKey,

if (pluginState.binding !== null) {
if (change !== undefined && change.snapshot != null) {
if (change !== undefined && (change.snapshot != null || change.prevSnapshot != null)) {
// snapshot changed, rerender next

@@ -281,3 +284,3 @@ setTimeout(() => {

const pluginState = plugin.getState(view.state);
if (pluginState.snapshot == null) {
if (pluginState.snapshot == null && pluginState.prevSnapshot == null) {
if (changedInitialContent || view.state.doc.content.size > 2) {

@@ -385,2 +388,5 @@ changedInitialContent = true;

_renderSnapshot (snapshot, prevSnapshot, pluginState) {
if (!snapshot) {
snapshot = Y.snapshot(this.doc);
}
// clear mapping because we are going to rerender

@@ -407,3 +413,11 @@ this.mapping = new Map();

// Create document fragment and render
const fragmentContent = Y.typeListToArraySnapshot(this.type, new Y.Snapshot(prevSnapshot.ds, snapshot.sv)).map(t => createNodeFromYElement(t, this.prosemirrorView.state.schema, new Map(), snapshot, prevSnapshot, computeYChange)).filter(n => n !== null);
const fragmentContent = Y.typeListToArraySnapshot(this.type, new Y.Snapshot(prevSnapshot.ds, snapshot.sv)).map(t => {
if (!t._item.deleted || isVisible(t._item, snapshot) || isVisible(t._item, prevSnapshot)) {
return createNodeFromYElement(t, this.prosemirrorView.state.schema, new Map(), snapshot, prevSnapshot, computeYChange)
} else {
// No need to render elements that are not visible by either snapshot.
// If a client adds and deletes content in the same snapshot the element is not visible by either snapshot.
return null
}
}).filter(n => n !== null);
const tr = this.prosemirrorView.state.tr.replace(0, this.prosemirrorView.state.doc.content.size, new PModel.Slice(new PModel.Fragment(fragmentContent), 0, 0));

@@ -419,7 +433,9 @@ this.prosemirrorView.dispatch(tr);

_typeChanged (events, transaction) {
const syncState = ySyncPluginKey.getState(this.prosemirrorView.state);
if (events.length === 0 || syncState.snapshot != null || syncState.prevSnapshot != null) {
// drop out if snapshot is active
this.renderSnapshot(syncState.snapshot, syncState.prevSnapshot);
return
}
this.mux(() => {
if (events.length === 0 || ySyncPluginKey.getState(this.prosemirrorView.state).snapshot != null) {
// drop out if snapshot is active
return
}
/**

@@ -426,0 +442,0 @@ * @param {any} _

{
"name": "y-prosemirror",
"version": "0.1.4",
"version": "0.1.5",
"description": "Prosemirror bindings for Yjs",

@@ -63,5 +63,5 @@ "main": "./dist/y-prosemirror.js",

"y-protocols": "^0.1.0",
"yjs": "13.0.0-98",
"yjs": "13.0.0-102",
"lib0": "^0.1.1"
}
}

@@ -85,3 +85,6 @@ /**

props: {
editable: (state) => ySyncPluginKey.getState(state).snapshot == null
editable: (state) => {
const syncState = ySyncPluginKey.getState(state)
return syncState.snapshot == null && syncState.prevSnapshot == null
}
},

@@ -114,3 +117,3 @@ key: ySyncPluginKey,

if (pluginState.binding !== null) {
if (change !== undefined && change.snapshot != null) {
if (change !== undefined && (change.snapshot != null || change.prevSnapshot != null)) {
// snapshot changed, rerender next

@@ -144,3 +147,3 @@ setTimeout(() => {

const pluginState = plugin.getState(view.state)
if (pluginState.snapshot == null) {
if (pluginState.snapshot == null && pluginState.prevSnapshot == null) {
if (changedInitialContent || view.state.doc.content.size > 2) {

@@ -248,2 +251,5 @@ changedInitialContent = true

_renderSnapshot (snapshot, prevSnapshot, pluginState) {
if (!snapshot) {
snapshot = Y.snapshot(this.doc)
}
// clear mapping because we are going to rerender

@@ -270,3 +276,11 @@ this.mapping = new Map()

// Create document fragment and render
const fragmentContent = Y.typeListToArraySnapshot(this.type, new Y.Snapshot(prevSnapshot.ds, snapshot.sv)).map(t => createNodeFromYElement(t, this.prosemirrorView.state.schema, new Map(), snapshot, prevSnapshot, computeYChange)).filter(n => n !== null)
const fragmentContent = Y.typeListToArraySnapshot(this.type, new Y.Snapshot(prevSnapshot.ds, snapshot.sv)).map(t => {
if (!t._item.deleted || isVisible(t._item, snapshot) || isVisible(t._item, prevSnapshot)) {
return createNodeFromYElement(t, this.prosemirrorView.state.schema, new Map(), snapshot, prevSnapshot, computeYChange)
} else {
// No need to render elements that are not visible by either snapshot.
// If a client adds and deletes content in the same snapshot the element is not visible by either snapshot.
return null
}
}).filter(n => n !== null)
const tr = this.prosemirrorView.state.tr.replace(0, this.prosemirrorView.state.doc.content.size, new PModel.Slice(new PModel.Fragment(fragmentContent), 0, 0))

@@ -282,7 +296,9 @@ this.prosemirrorView.dispatch(tr)

_typeChanged (events, transaction) {
const syncState = ySyncPluginKey.getState(this.prosemirrorView.state)
if (events.length === 0 || syncState.snapshot != null || syncState.prevSnapshot != null) {
// drop out if snapshot is active
this.renderSnapshot(syncState.snapshot, syncState.prevSnapshot)
return
}
this.mux(() => {
if (events.length === 0 || ySyncPluginKey.getState(this.prosemirrorView.state).snapshot != null) {
// drop out if snapshot is active
return
}
/**

@@ -289,0 +305,0 @@ * @param {any} _

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

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc