@@ -10,7 +10,7 @@ export const yAttributionDecorations = cmState.StateField.define({
1010 create ( state ) {
1111 const conf = state . facet ( ySyncFacet )
1212 const ytext = conf . ytext
13- const delta = ytext . getContent ( conf . am , { retainInserts : true , retainDeletes : true } )
13+ const delta = ytext . toDelta ( conf . am , { retainInserts : true , retainDeletes : true } )
1414 const { decorations } = ydeltaToCmChanges ( delta , false )
1515 return cmView . Decoration . set ( decorations )
1616 } ,
@@ -78,13 +78,13 @@ const createAttributionDecoration = (type, username) => {
7878
7979export class YSyncConfig {
8080 /**
81- * @param {Y.Text<never > } ytext
81+ * @param {Y.Type<{ text: true } > } ytext
8282 * @param {import('@y/protocols/awareness').Awareness } awareness
8383 * @param {Y.AbstractAttributionManager } am
8484 */
8585 constructor ( ytext , awareness , am ) {
8686 /**
87- * @type {Y.Text<never > }
87+ * @type {Y.Type<{ text: true } > }
8888 */
8989 this . ytext = ytext
9090 this . awareness = awareness
@@ -235,12 +235,12 @@ class YSyncPluginValue {
235235 this . _ytext = this . conf . ytext
236236 this . _observer = this . _ytext . observe ( ( event , tr ) => {
237237 /**
238- * @type {delta.DeltaAny ? }
238+ * @type {delta.Delta<{text: true}> ? }
239239 */
240240 let delta = null
241241 if ( tr . origin === this . conf && this . conf . am !== Y . noAttributionsManager ) {
242242 const changes = Y . mergeIdSets ( [ tr . insertSet , tr . deleteSet ] )
243- delta = this . _ytext . getContent ( this . conf . am , { itemsToRender : changes , retainInserts : true } )
243+ delta = this . _ytext . toDelta ( this . conf . am , { itemsToRender : changes , retainInserts : true } )
244244 } else if ( tr . origin !== this . conf ) {
245245 delta = event . getDelta ( this . conf . am )
246246 }
@@ -252,7 +252,7 @@ class YSyncPluginValue {
252252 }
253253 } )
254254 this . _onAttrChange = this . conf . am . on ( 'change' , ( changes ) => {
255- const delta = this . _ytext . getContent ( this . conf . am , { itemsToRender : changes , retainInserts : true , retainDeletes : true } )
255+ const delta = this . _ytext . toDelta ( this . conf . am , { itemsToRender : changes , retainInserts : true , retainDeletes : true } )
256256 if ( ! delta . isEmpty ( ) ) {
257257 const { changes, decorations } = ydeltaToCmChanges ( delta , false )
258258 if ( changes . length > 0 && decorations . length > 0 ) {
@@ -276,7 +276,7 @@ class YSyncPluginValue {
276276 * This variable adjusts the fromA position to the current position in the Y.Text type.
277277 */
278278 let adj = 0
279- const d = delta . text ( )
279+ const d = delta . create ( delta . $delta ( { text : true } ) )
280280 update . changes . iterChanges ( ( fromA , toA , fromB , toB , insert ) => {
281281 const insertText = insert . sliceString ( 0 , insert . length , '\n' )
282282 if ( fromA !== toA ) {
@@ -290,7 +290,7 @@ class YSyncPluginValue {
290290 ytext . applyDelta ( d , this . conf . am )
291291 const attributedDeletes = tr . meta . get ( 'attributedDeletes' )
292292 if ( attributedDeletes != null ) {
293- const updateFix = this . _ytext . getContent ( this . conf . am , { itemsToRender : attributedDeletes } )
293+ const updateFix = this . _ytext . toDelta ( this . conf . am , { itemsToRender : attributedDeletes } )
294294 const { changes, decorations } = ydeltaToCmChanges ( updateFix , false )
295295 const dispatch = ( ) => this . view . dispatch ( { changes, annotations : [ ySyncAnnotation . of ( this . conf ) , yAttributionAnnotation . of ( decorations ) ] } )
296296 setTimeout ( dispatch , 0 )
0 commit comments