Shun Miyazawa 11 месяцев назад
Родитель
Сommit
9ad5a5f4b3
1 измененных файлов с 2 добавлено и 6 удалено
  1. 2 6
      packages/editor/src/client/services/unified-merge-view/index.ts

+ 2 - 6
packages/editor/src/client/services/unified-merge-view/index.ts

@@ -13,15 +13,11 @@ import type { UseCodeMirrorEditor } from '..';
 export const acceptAllChunks = (view: EditorView): void => {
   // Get all chunks from the editor state
   const chunkData = getChunks(view.state);
-  if (!chunkData || chunkData.chunks.length === 0) {
+  if (chunkData == null || chunkData.chunks.length === 0) {
     return;
   }
 
-  // Get all chunks and sort them in reverse order by position
-  const chunks = [...chunkData.chunks].sort((a, b) => b.fromB - a.fromB);
-
-  // Process each chunk from bottom to top
-  for (const chunk of chunks) {
+  for (const chunk of chunkData.chunks) {
     // Use a position inside the chunk (middle point is safe)
     const pos = chunk.fromB + Math.floor((chunk.endB - chunk.fromB) / 2);
     acceptChunk(view, pos);