y-prosemirror
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -830,3 +830,3 @@ 'use strict'; | ||
const yUndoPlugin = new prosemirrorState.Plugin({ | ||
const yUndoPlugin = ({ protectedNodes = new Set(['paragraph']) } = {}) => new prosemirrorState.Plugin({ | ||
key: yUndoPluginKey, | ||
@@ -837,3 +837,10 @@ state: { | ||
const ystate = ySyncPluginKey.getState(state); | ||
const undoManager = new Y.UndoManager(ystate.type, new Set([null, ySyncPluginKey])); | ||
const undoManager = new Y.UndoManager(ystate.type, { | ||
trackedOrigins: new Set([null, ySyncPluginKey]), | ||
deleteFilter: item => !(item instanceof Y.Item) || | ||
!(item.content instanceof Y.ContentType) || | ||
!(item.content.type instanceof Y.Text || | ||
(item.content.type instanceof Y.XmlElement && protectedNodes.has(item.content.type.nodeName))) || | ||
item.content.type._length === 0 | ||
}); | ||
return { | ||
@@ -840,0 +847,0 @@ undoManager, |
{ | ||
"name": "y-prosemirror", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "Prosemirror bindings for Yjs", | ||
@@ -41,6 +41,6 @@ "main": "./dist/y-prosemirror.js", | ||
"dependencies": { | ||
"lib0": "0.0.5" | ||
"lib0": "0.0.6" | ||
}, | ||
"peerDependencies": { | ||
"yjs": ">=13.0.0-93", | ||
"yjs": ">=13.0.0-96", | ||
"y-protocols": ">=0.0.7", | ||
@@ -64,4 +64,4 @@ "prosemirror-model": "^1.7.0", | ||
"y-protocols": "0.0.7", | ||
"yjs": "13.0.0-93" | ||
"yjs": "13.0.0-96" | ||
} | ||
} |
@@ -30,3 +30,3 @@ # y-prosemirror | ||
yCursorPlugin(provider.awareness), | ||
yUndoPlugin, | ||
yUndoPlugin(), | ||
keymap({ | ||
@@ -33,0 +33,0 @@ 'Mod-z': undo, |
@@ -5,3 +5,3 @@ | ||
import { ySyncPluginKey, getRelativeSelection } from './sync-plugin.js' | ||
import { UndoManager } from 'yjs' | ||
import { UndoManager, Item, ContentType, XmlElement, Text } from 'yjs' | ||
@@ -26,3 +26,3 @@ export const undo = state => { | ||
export const yUndoPlugin = new Plugin({ | ||
export const yUndoPlugin = ({ protectedNodes = new Set(['paragraph']) } = {}) => new Plugin({ | ||
key: yUndoPluginKey, | ||
@@ -33,3 +33,10 @@ state: { | ||
const ystate = ySyncPluginKey.getState(state) | ||
const undoManager = new UndoManager(ystate.type, new Set([null, ySyncPluginKey])) | ||
const undoManager = new UndoManager(ystate.type, { | ||
trackedOrigins: new Set([null, ySyncPluginKey]), | ||
deleteFilter: item => !(item instanceof Item) || | ||
!(item.content instanceof ContentType) || | ||
!(item.content.type instanceof Text || | ||
(item.content.type instanceof XmlElement && protectedNodes.has(item.content.type.nodeName))) || | ||
item.content.type._length === 0 | ||
}) | ||
return { | ||
@@ -36,0 +43,0 @@ undoManager, |
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
2338609
21002
+ Addedlib0@0.0.6(transitive)
- Removedlib0@0.0.5(transitive)
Updatedlib0@0.0.6