From 876695b2d630f6de1becf87ff2d8401b36c24380 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 11 Aug 2024 20:41:22 +0800 Subject: [PATCH] Fix accessing toDelta on non-Y.Text instances --- src/plugins/sync-plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/sync-plugin.js b/src/plugins/sync-plugin.js index 5b9e5f9..772631c 100644 --- a/src/plugins/sync-plugin.js +++ b/src/plugins/sync-plugin.js @@ -669,7 +669,7 @@ export const createNodeFromYElement = ( // This is a fix for #160 -- duplication of characters when two Y.Text exist next to each // other. const nextytext = type._item.right?.content.type - if (nextytext != null && !nextytext._item.deleted && nextytext._item.id.client === nextytext.doc.clientID) { + if (nextytext instanceof Y.Text && !nextytext._item.deleted && nextytext._item.id.client === nextytext.doc.clientID) { type.applyDelta([ { retain: type.length }, ...nextytext.toDelta()