remove duplicate Transaction.callAll logic
This commit is contained in:
		
							parent
							
								
									5d862477cd
								
							
						
					
					
						commit
						942c8a267b
					
				@ -275,11 +275,10 @@ const cleanupTransactions = (transactionCleanups, i) => {
 | 
				
			|||||||
      )
 | 
					      )
 | 
				
			||||||
      fs.push(() => {
 | 
					      fs.push(() => {
 | 
				
			||||||
        // deep observe events
 | 
					        // deep observe events
 | 
				
			||||||
        transaction.changedParentTypes.forEach((events, type) =>
 | 
					        transaction.changedParentTypes.forEach((events, type) => {
 | 
				
			||||||
          fs.push(() => {
 | 
					 | 
				
			||||||
          // We need to think about the possibility that the user transforms the
 | 
					          // We need to think about the possibility that the user transforms the
 | 
				
			||||||
          // Y.Doc in the event.
 | 
					          // Y.Doc in the event.
 | 
				
			||||||
            if (type._item === null || !type._item.deleted) {
 | 
					          if (type._dEH.l.length > 0 && (type._item === null || !type._item.deleted)) {
 | 
				
			||||||
            events = events
 | 
					            events = events
 | 
				
			||||||
              .filter(event =>
 | 
					              .filter(event =>
 | 
				
			||||||
                event.target._item === null || !event.target._item.deleted
 | 
					                event.target._item === null || !event.target._item.deleted
 | 
				
			||||||
@ -287,6 +286,7 @@ const cleanupTransactions = (transactionCleanups, i) => {
 | 
				
			|||||||
            events
 | 
					            events
 | 
				
			||||||
              .forEach(event => {
 | 
					              .forEach(event => {
 | 
				
			||||||
                event.currentTarget = type
 | 
					                event.currentTarget = type
 | 
				
			||||||
 | 
					                // path is relative to the current target
 | 
				
			||||||
                event._path = null
 | 
					                event._path = null
 | 
				
			||||||
              })
 | 
					              })
 | 
				
			||||||
            // sort events by path length so that top-level events are fired first.
 | 
					            // sort events by path length so that top-level events are fired first.
 | 
				
			||||||
@ -297,9 +297,8 @@ const cleanupTransactions = (transactionCleanups, i) => {
 | 
				
			|||||||
            callEventHandlerListeners(type._dEH, events, transaction)
 | 
					            callEventHandlerListeners(type._dEH, events, transaction)
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
        )
 | 
					 | 
				
			||||||
        fs.push(() => doc.emit('afterTransaction', [transaction, doc]))
 | 
					 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
 | 
					      fs.push(() => doc.emit('afterTransaction', [transaction, doc]))
 | 
				
			||||||
      callAll(fs, [])
 | 
					      callAll(fs, [])
 | 
				
			||||||
      if (transaction._needFormattingCleanup) {
 | 
					      if (transaction._needFormattingCleanup) {
 | 
				
			||||||
        cleanupYTextAfterTransaction(transaction)
 | 
					        cleanupYTextAfterTransaction(transaction)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user