Skip to content

Commit

Permalink
Allow custom tracked origins from undo plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanprimost committed Jan 14, 2020
1 parent e195c62 commit 2f00b1e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plugins/undo-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export const redo = state => {

export const yUndoPluginKey = new PluginKey('y-undo')

export const yUndoPlugin = ({ protectedNodes = new Set(['paragraph']) } = {}) => new Plugin({
export const yUndoPlugin = ({ protectedNodes = new Set(['paragraph']), trackedOrigins = [] } = {}) => new Plugin({
key: yUndoPluginKey,
state: {
init: (initargs, state) => {
// TODO: check if plugin order matches and fix
const ystate = ySyncPluginKey.getState(state)
const undoManager = new UndoManager(ystate.type, {
trackedOrigins: new Set([null, ySyncPluginKey]),
trackedOrigins: new Set([null, ySyncPluginKey].concat(trackedOrigins)),
deleteFilter: item => !(item instanceof Item) ||
!(item.content instanceof ContentType) ||
!(item.content.type instanceof Text ||
Expand Down

0 comments on commit 2f00b1e

Please sign in to comment.