ide-assi 0.367.0 → 0.369.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -234929,9 +234929,6 @@ class IdeDiff extends HTMLElement {
234929
234929
  if (update.view.contentDOM.firstChild && !update.view._initialAsisContentLoaded) {
234930
234930
  update.view._initialAsisContentLoaded = true; // 플래그 설정
234931
234931
  console.log("CodeMirror ASIS view is ready for initial content.");
234932
- // 뷰가 준비되었을 때 initialize를 호출해야 한다면 여기에 로직 추가 (예: 외부에서 데이터 주입)
234933
- // 예시: this.initialize("초기 ASIS 코드", "초기 TOBE 코드");
234934
- // 단, initialize는 한 번만 호출되도록 외부 로직을 구성해야 합니다.
234935
234932
  }
234936
234933
  })
234937
234934
  ]
@@ -234962,16 +234959,12 @@ class IdeDiff extends HTMLElement {
234962
234959
  parent: this.#tobeEditorEl
234963
234960
  });
234964
234961
 
234965
- // ⭐️ 스크롤 동기화는 여기서 설정만 하고, `initialize` 함수 내에서 활성화 시점을 제어합니다.
234966
- // (이전 단계에서 이미 `initialize`에 활성/비활성화 로직을 추가했다고 가정)
234962
+ // ⭐️ 초기 스크롤 동기화는 여기서 설정만 하고, initialize에서 활성화 제어
234967
234963
  this.#setupScrollSync();
234968
234964
  };
234969
234965
 
234970
234966
  // ⭐️ 스크롤 리스너를 제어할 수 있도록 플래그 및 클래스 메서드 사용
234971
234967
  #setupScrollSync = () => {
234972
-
234973
- console.log("setupScrollSync");
234974
-
234975
234968
  // 기존 리스너가 있다면 제거 (중복 방지 및 disconnectedCallback에서 제거 용이)
234976
234969
  if (this._asisScrollHandler) { // 핸들러가 이미 할당되어 있다면
234977
234970
  this.#asisEditorView.scrollDOM.removeEventListener('scroll', this._asisScrollHandler);
@@ -235130,7 +235123,7 @@ class IdeDiff extends HTMLElement {
235130
235123
  return;
235131
235124
  }
235132
235125
 
235133
- // ⭐️ initialize 시작 시 스크롤 동기화 일시 중지
235126
+ // 초기화 시작 시 스크롤 동기화 일시 중지
235134
235127
  this.#isScrollSyncActive = false;
235135
235128
 
235136
235129
  let langExtension;
@@ -235142,45 +235135,53 @@ class IdeDiff extends HTMLElement {
235142
235135
  langExtension = javascript();
235143
235136
  }
235144
235137
 
235145
- // 먼저 데코레이션 효과를 계산하여 가져옵니다.
235138
+ // 데코레이션 효과는 미리 계산해 둡니다.
235146
235139
  const { asisEffect, tobeEffect } = this.#applyDiffDecorations(src1, src2);
235147
235140
 
235148
-
235149
- // asis 에디터의 텍스트 변경 및 데코레이션 효과를 단일 트랜잭션으로 디스패치합니다.
235141
+ // 1단계: 텍스트 내용 변경과 언어 확장을 먼저 디스패치합니다.
235150
235142
  this.#asisEditorView.dispatch({
235151
235143
  changes: { from: 0, to: this.#asisEditorView.state.doc.length, insert: src1 },
235152
235144
  effects: [
235153
- this.#languageCompartment.reconfigure(langExtension),
235154
- //asisEffect
235145
+ this.#languageCompartment.reconfigure(langExtension)
235155
235146
  ]
235156
235147
  });
235157
235148
 
235158
- // tobe 에디터의 텍스트 변경 및 데코레이션 효과를 단일 트랜잭션으로 디스패치합니다.
235159
235149
  this.#tobeEditorView.dispatch({
235160
235150
  changes: { from: 0, to: this.#tobeEditorView.state.doc.length, insert: src2 },
235161
235151
  effects: [
235162
- this.#languageCompartment.reconfigure(langExtension), // <-- 이 주석을 풀어주세요!
235163
- //tobeEffect // <-- 이 주석을 풀어주세요!
235152
+ this.#languageCompartment.reconfigure(langExtension)
235164
235153
  ]
235165
235154
  });
235166
235155
 
235167
- // ⭐️ 모든 업데이트가 완료된 스크롤 동기화를 다시 활성화
235168
- // requestAnimationFrame을 사용하여 다음 브라우저 렌더링 사이클에서 실행
235156
+ // 2단계: 텍스트 언어 변경이 완전히 적용되고 뷰가 안정화된 후,
235157
+ // 다음 프레임에서 데코레이션 효과만 별도로 디스패치합니다.
235169
235158
  requestAnimationFrame(() => {
235170
- this.#isScrollSyncActive = true;
235171
- // 필요하다면 여기서 초기 스크롤 위치를 0으로 리셋하여 정렬을 보장할 수 있습니다.
235172
- // this.#asisEditorView.scrollDOM.scrollTop = 0;
235173
- // this.#tobeEditorView.scrollDOM.scrollTop = 0;
235159
+ console.log(asisEffect, tobeEffect);
235160
+ this.#asisEditorView.dispatch({
235161
+ effects: [asisEffect]
235162
+ });
235163
+ this.#tobeEditorView.dispatch({
235164
+ effects: [tobeEffect]
235165
+ });
235166
+
235167
+ // 3단계: 데코레이션까지 적용된 후 스크롤 동기화 활성화
235168
+ // (필요하다면 여기도 requestAnimationFrame으로 한 번 더 지연시킬 수 있습니다.)
235169
+ requestAnimationFrame(() => {
235170
+ this.#isScrollSyncActive = true;
235171
+ // 필요하다면 여기서 초기 스크롤 위치를 0으로 리셋하여 정렬을 보장할 수 있습니다.
235172
+ // this.#asisEditorView.scrollDOM.scrollTop = 0;
235173
+ // this.#tobeEditorView.scrollDOM.scrollTop = 0;
235174
+ });
235174
235175
  });
235175
235176
  };
235176
235177
 
235177
235178
  disconnectedCallback() {
235178
235179
  // 컴포넌트 해제 시 스크롤 리스너 제거
235179
- if (this._asisScrollHandler) { // 핸들러가 존재하면 제거
235180
+ if (this._asisScrollHandler) {
235180
235181
  this.#asisEditorView.scrollDOM.removeEventListener('scroll', this._asisScrollHandler);
235181
235182
  this.#tobeEditorView.scrollDOM.removeEventListener('scroll', this._tobeScrollHandler);
235182
- this._asisScrollHandler = null; // 참조 제거
235183
- this._tobeScrollHandler = null; // 참조 제거
235183
+ this._asisScrollHandler = null;
235184
+ this._tobeScrollHandler = null;
235184
235185
  }
235185
235186
  if (this.#asisEditorView) {
235186
235187
  this.#asisEditorView.destroy();
@@ -234925,9 +234925,6 @@ class IdeDiff extends HTMLElement {
234925
234925
  if (update.view.contentDOM.firstChild && !update.view._initialAsisContentLoaded) {
234926
234926
  update.view._initialAsisContentLoaded = true; // 플래그 설정
234927
234927
  console.log("CodeMirror ASIS view is ready for initial content.");
234928
- // 뷰가 준비되었을 때 initialize를 호출해야 한다면 여기에 로직 추가 (예: 외부에서 데이터 주입)
234929
- // 예시: this.initialize("초기 ASIS 코드", "초기 TOBE 코드");
234930
- // 단, initialize는 한 번만 호출되도록 외부 로직을 구성해야 합니다.
234931
234928
  }
234932
234929
  })
234933
234930
  ]
@@ -234958,16 +234955,12 @@ class IdeDiff extends HTMLElement {
234958
234955
  parent: this.#tobeEditorEl
234959
234956
  });
234960
234957
 
234961
- // ⭐️ 스크롤 동기화는 여기서 설정만 하고, `initialize` 함수 내에서 활성화 시점을 제어합니다.
234962
- // (이전 단계에서 이미 `initialize`에 활성/비활성화 로직을 추가했다고 가정)
234958
+ // ⭐️ 초기 스크롤 동기화는 여기서 설정만 하고, initialize에서 활성화 제어
234963
234959
  this.#setupScrollSync();
234964
234960
  };
234965
234961
 
234966
234962
  // ⭐️ 스크롤 리스너를 제어할 수 있도록 플래그 및 클래스 메서드 사용
234967
234963
  #setupScrollSync = () => {
234968
-
234969
- console.log("setupScrollSync");
234970
-
234971
234964
  // 기존 리스너가 있다면 제거 (중복 방지 및 disconnectedCallback에서 제거 용이)
234972
234965
  if (this._asisScrollHandler) { // 핸들러가 이미 할당되어 있다면
234973
234966
  this.#asisEditorView.scrollDOM.removeEventListener('scroll', this._asisScrollHandler);
@@ -235126,7 +235119,7 @@ class IdeDiff extends HTMLElement {
235126
235119
  return;
235127
235120
  }
235128
235121
 
235129
- // ⭐️ initialize 시작 시 스크롤 동기화 일시 중지
235122
+ // 초기화 시작 시 스크롤 동기화 일시 중지
235130
235123
  this.#isScrollSyncActive = false;
235131
235124
 
235132
235125
  let langExtension;
@@ -235138,45 +235131,53 @@ class IdeDiff extends HTMLElement {
235138
235131
  langExtension = javascript();
235139
235132
  }
235140
235133
 
235141
- // 먼저 데코레이션 효과를 계산하여 가져옵니다.
235134
+ // 데코레이션 효과는 미리 계산해 둡니다.
235142
235135
  const { asisEffect, tobeEffect } = this.#applyDiffDecorations(src1, src2);
235143
235136
 
235144
-
235145
- // asis 에디터의 텍스트 변경 및 데코레이션 효과를 단일 트랜잭션으로 디스패치합니다.
235137
+ // 1단계: 텍스트 내용 변경과 언어 확장을 먼저 디스패치합니다.
235146
235138
  this.#asisEditorView.dispatch({
235147
235139
  changes: { from: 0, to: this.#asisEditorView.state.doc.length, insert: src1 },
235148
235140
  effects: [
235149
- this.#languageCompartment.reconfigure(langExtension),
235150
- //asisEffect
235141
+ this.#languageCompartment.reconfigure(langExtension)
235151
235142
  ]
235152
235143
  });
235153
235144
 
235154
- // tobe 에디터의 텍스트 변경 및 데코레이션 효과를 단일 트랜잭션으로 디스패치합니다.
235155
235145
  this.#tobeEditorView.dispatch({
235156
235146
  changes: { from: 0, to: this.#tobeEditorView.state.doc.length, insert: src2 },
235157
235147
  effects: [
235158
- this.#languageCompartment.reconfigure(langExtension), // <-- 이 주석을 풀어주세요!
235159
- //tobeEffect // <-- 이 주석을 풀어주세요!
235148
+ this.#languageCompartment.reconfigure(langExtension)
235160
235149
  ]
235161
235150
  });
235162
235151
 
235163
- // ⭐️ 모든 업데이트가 완료된 스크롤 동기화를 다시 활성화
235164
- // requestAnimationFrame을 사용하여 다음 브라우저 렌더링 사이클에서 실행
235152
+ // 2단계: 텍스트 언어 변경이 완전히 적용되고 뷰가 안정화된 후,
235153
+ // 다음 프레임에서 데코레이션 효과만 별도로 디스패치합니다.
235165
235154
  requestAnimationFrame(() => {
235166
- this.#isScrollSyncActive = true;
235167
- // 필요하다면 여기서 초기 스크롤 위치를 0으로 리셋하여 정렬을 보장할 수 있습니다.
235168
- // this.#asisEditorView.scrollDOM.scrollTop = 0;
235169
- // this.#tobeEditorView.scrollDOM.scrollTop = 0;
235155
+ console.log(asisEffect, tobeEffect);
235156
+ this.#asisEditorView.dispatch({
235157
+ effects: [asisEffect]
235158
+ });
235159
+ this.#tobeEditorView.dispatch({
235160
+ effects: [tobeEffect]
235161
+ });
235162
+
235163
+ // 3단계: 데코레이션까지 적용된 후 스크롤 동기화 활성화
235164
+ // (필요하다면 여기도 requestAnimationFrame으로 한 번 더 지연시킬 수 있습니다.)
235165
+ requestAnimationFrame(() => {
235166
+ this.#isScrollSyncActive = true;
235167
+ // 필요하다면 여기서 초기 스크롤 위치를 0으로 리셋하여 정렬을 보장할 수 있습니다.
235168
+ // this.#asisEditorView.scrollDOM.scrollTop = 0;
235169
+ // this.#tobeEditorView.scrollDOM.scrollTop = 0;
235170
+ });
235170
235171
  });
235171
235172
  };
235172
235173
 
235173
235174
  disconnectedCallback() {
235174
235175
  // 컴포넌트 해제 시 스크롤 리스너 제거
235175
- if (this._asisScrollHandler) { // 핸들러가 존재하면 제거
235176
+ if (this._asisScrollHandler) {
235176
235177
  this.#asisEditorView.scrollDOM.removeEventListener('scroll', this._asisScrollHandler);
235177
235178
  this.#tobeEditorView.scrollDOM.removeEventListener('scroll', this._tobeScrollHandler);
235178
- this._asisScrollHandler = null; // 참조 제거
235179
- this._tobeScrollHandler = null; // 참조 제거
235179
+ this._asisScrollHandler = null;
235180
+ this._tobeScrollHandler = null;
235180
235181
  }
235181
235182
  if (this.#asisEditorView) {
235182
235183
  this.#asisEditorView.destroy();
@@ -177,9 +177,6 @@ export class IdeDiff extends HTMLElement {
177
177
  if (update.view.contentDOM.firstChild && !update.view._initialAsisContentLoaded) {
178
178
  update.view._initialAsisContentLoaded = true; // 플래그 설정
179
179
  console.log("CodeMirror ASIS view is ready for initial content.");
180
- // 뷰가 준비되었을 때 initialize를 호출해야 한다면 여기에 로직 추가 (예: 외부에서 데이터 주입)
181
- // 예시: this.initialize("초기 ASIS 코드", "초기 TOBE 코드");
182
- // 단, initialize는 한 번만 호출되도록 외부 로직을 구성해야 합니다.
183
180
  }
184
181
  })
185
182
  ]
@@ -210,16 +207,12 @@ export class IdeDiff extends HTMLElement {
210
207
  parent: this.#tobeEditorEl
211
208
  });
212
209
 
213
- // ⭐️ 스크롤 동기화는 여기서 설정만 하고, `initialize` 함수 내에서 활성화 시점을 제어합니다.
214
- // (이전 단계에서 이미 `initialize`에 활성/비활성화 로직을 추가했다고 가정)
210
+ // ⭐️ 초기 스크롤 동기화는 여기서 설정만 하고, initialize에서 활성화 제어
215
211
  this.#setupScrollSync();
216
212
  };
217
213
 
218
214
  // ⭐️ 스크롤 리스너를 제어할 수 있도록 플래그 및 클래스 메서드 사용
219
215
  #setupScrollSync = () => {
220
-
221
- console.log("setupScrollSync");
222
-
223
216
  // 기존 리스너가 있다면 제거 (중복 방지 및 disconnectedCallback에서 제거 용이)
224
217
  if (this._asisScrollHandler) { // 핸들러가 이미 할당되어 있다면
225
218
  this.#asisEditorView.scrollDOM.removeEventListener('scroll', this._asisScrollHandler);
@@ -378,7 +371,7 @@ export class IdeDiff extends HTMLElement {
378
371
  return;
379
372
  }
380
373
 
381
- // ⭐️ initialize 시작 시 스크롤 동기화 일시 중지
374
+ // 초기화 시작 시 스크롤 동기화 일시 중지
382
375
  this.#isScrollSyncActive = false;
383
376
 
384
377
  let langExtension;
@@ -390,45 +383,53 @@ export class IdeDiff extends HTMLElement {
390
383
  langExtension = javascript();
391
384
  }
392
385
 
393
- // 먼저 데코레이션 효과를 계산하여 가져옵니다.
386
+ // 데코레이션 효과는 미리 계산해 둡니다.
394
387
  const { asisEffect, tobeEffect } = this.#applyDiffDecorations(src1, src2);
395
388
 
396
-
397
- // asis 에디터의 텍스트 변경 및 데코레이션 효과를 단일 트랜잭션으로 디스패치합니다.
389
+ // 1단계: 텍스트 내용 변경과 언어 확장을 먼저 디스패치합니다.
398
390
  this.#asisEditorView.dispatch({
399
391
  changes: { from: 0, to: this.#asisEditorView.state.doc.length, insert: src1 },
400
392
  effects: [
401
- this.#languageCompartment.reconfigure(langExtension),
402
- //asisEffect
393
+ this.#languageCompartment.reconfigure(langExtension)
403
394
  ]
404
395
  });
405
396
 
406
- // tobe 에디터의 텍스트 변경 및 데코레이션 효과를 단일 트랜잭션으로 디스패치합니다.
407
397
  this.#tobeEditorView.dispatch({
408
398
  changes: { from: 0, to: this.#tobeEditorView.state.doc.length, insert: src2 },
409
399
  effects: [
410
- this.#languageCompartment.reconfigure(langExtension), // <-- 이 주석을 풀어주세요!
411
- //tobeEffect // <-- 이 주석을 풀어주세요!
400
+ this.#languageCompartment.reconfigure(langExtension)
412
401
  ]
413
402
  });
414
403
 
415
- // ⭐️ 모든 업데이트가 완료된 스크롤 동기화를 다시 활성화
416
- // requestAnimationFrame을 사용하여 다음 브라우저 렌더링 사이클에서 실행
404
+ // 2단계: 텍스트 언어 변경이 완전히 적용되고 뷰가 안정화된 후,
405
+ // 다음 프레임에서 데코레이션 효과만 별도로 디스패치합니다.
417
406
  requestAnimationFrame(() => {
418
- this.#isScrollSyncActive = true;
419
- // 필요하다면 여기서 초기 스크롤 위치를 0으로 리셋하여 정렬을 보장할 수 있습니다.
420
- // this.#asisEditorView.scrollDOM.scrollTop = 0;
421
- // this.#tobeEditorView.scrollDOM.scrollTop = 0;
407
+ console.log(asisEffect, tobeEffect);
408
+ this.#asisEditorView.dispatch({
409
+ effects: [asisEffect]
410
+ });
411
+ this.#tobeEditorView.dispatch({
412
+ effects: [tobeEffect]
413
+ });
414
+
415
+ // 3단계: 데코레이션까지 적용된 후 스크롤 동기화 활성화
416
+ // (필요하다면 여기도 requestAnimationFrame으로 한 번 더 지연시킬 수 있습니다.)
417
+ requestAnimationFrame(() => {
418
+ this.#isScrollSyncActive = true;
419
+ // 필요하다면 여기서 초기 스크롤 위치를 0으로 리셋하여 정렬을 보장할 수 있습니다.
420
+ // this.#asisEditorView.scrollDOM.scrollTop = 0;
421
+ // this.#tobeEditorView.scrollDOM.scrollTop = 0;
422
+ });
422
423
  });
423
424
  };
424
425
 
425
426
  disconnectedCallback() {
426
427
  // 컴포넌트 해제 시 스크롤 리스너 제거
427
- if (this._asisScrollHandler) { // 핸들러가 존재하면 제거
428
+ if (this._asisScrollHandler) {
428
429
  this.#asisEditorView.scrollDOM.removeEventListener('scroll', this._asisScrollHandler);
429
430
  this.#tobeEditorView.scrollDOM.removeEventListener('scroll', this._tobeScrollHandler);
430
- this._asisScrollHandler = null; // 참조 제거
431
- this._tobeScrollHandler = null; // 참조 제거
431
+ this._asisScrollHandler = null;
432
+ this._tobeScrollHandler = null;
432
433
  }
433
434
  if (this.#asisEditorView) {
434
435
  this.#asisEditorView.destroy();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ide-assi",
3
3
  "type": "module",
4
- "version": "0.367.0",
4
+ "version": "0.369.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -177,9 +177,6 @@ export class IdeDiff extends HTMLElement {
177
177
  if (update.view.contentDOM.firstChild && !update.view._initialAsisContentLoaded) {
178
178
  update.view._initialAsisContentLoaded = true; // 플래그 설정
179
179
  console.log("CodeMirror ASIS view is ready for initial content.");
180
- // 뷰가 준비되었을 때 initialize를 호출해야 한다면 여기에 로직 추가 (예: 외부에서 데이터 주입)
181
- // 예시: this.initialize("초기 ASIS 코드", "초기 TOBE 코드");
182
- // 단, initialize는 한 번만 호출되도록 외부 로직을 구성해야 합니다.
183
180
  }
184
181
  })
185
182
  ]
@@ -210,16 +207,12 @@ export class IdeDiff extends HTMLElement {
210
207
  parent: this.#tobeEditorEl
211
208
  });
212
209
 
213
- // ⭐️ 스크롤 동기화는 여기서 설정만 하고, `initialize` 함수 내에서 활성화 시점을 제어합니다.
214
- // (이전 단계에서 이미 `initialize`에 활성/비활성화 로직을 추가했다고 가정)
210
+ // ⭐️ 초기 스크롤 동기화는 여기서 설정만 하고, initialize에서 활성화 제어
215
211
  this.#setupScrollSync();
216
212
  };
217
213
 
218
214
  // ⭐️ 스크롤 리스너를 제어할 수 있도록 플래그 및 클래스 메서드 사용
219
215
  #setupScrollSync = () => {
220
-
221
- console.log("setupScrollSync");
222
-
223
216
  // 기존 리스너가 있다면 제거 (중복 방지 및 disconnectedCallback에서 제거 용이)
224
217
  if (this._asisScrollHandler) { // 핸들러가 이미 할당되어 있다면
225
218
  this.#asisEditorView.scrollDOM.removeEventListener('scroll', this._asisScrollHandler);
@@ -378,7 +371,7 @@ export class IdeDiff extends HTMLElement {
378
371
  return;
379
372
  }
380
373
 
381
- // ⭐️ initialize 시작 시 스크롤 동기화 일시 중지
374
+ // 초기화 시작 시 스크롤 동기화 일시 중지
382
375
  this.#isScrollSyncActive = false;
383
376
 
384
377
  let langExtension;
@@ -390,45 +383,53 @@ export class IdeDiff extends HTMLElement {
390
383
  langExtension = javascript();
391
384
  }
392
385
 
393
- // 먼저 데코레이션 효과를 계산하여 가져옵니다.
386
+ // 데코레이션 효과는 미리 계산해 둡니다.
394
387
  const { asisEffect, tobeEffect } = this.#applyDiffDecorations(src1, src2);
395
388
 
396
-
397
- // asis 에디터의 텍스트 변경 및 데코레이션 효과를 단일 트랜잭션으로 디스패치합니다.
389
+ // 1단계: 텍스트 내용 변경과 언어 확장을 먼저 디스패치합니다.
398
390
  this.#asisEditorView.dispatch({
399
391
  changes: { from: 0, to: this.#asisEditorView.state.doc.length, insert: src1 },
400
392
  effects: [
401
- this.#languageCompartment.reconfigure(langExtension),
402
- //asisEffect
393
+ this.#languageCompartment.reconfigure(langExtension)
403
394
  ]
404
395
  });
405
396
 
406
- // tobe 에디터의 텍스트 변경 및 데코레이션 효과를 단일 트랜잭션으로 디스패치합니다.
407
397
  this.#tobeEditorView.dispatch({
408
398
  changes: { from: 0, to: this.#tobeEditorView.state.doc.length, insert: src2 },
409
399
  effects: [
410
- this.#languageCompartment.reconfigure(langExtension), // <-- 이 주석을 풀어주세요!
411
- //tobeEffect // <-- 이 주석을 풀어주세요!
400
+ this.#languageCompartment.reconfigure(langExtension)
412
401
  ]
413
402
  });
414
403
 
415
- // ⭐️ 모든 업데이트가 완료된 스크롤 동기화를 다시 활성화
416
- // requestAnimationFrame을 사용하여 다음 브라우저 렌더링 사이클에서 실행
404
+ // 2단계: 텍스트 언어 변경이 완전히 적용되고 뷰가 안정화된 후,
405
+ // 다음 프레임에서 데코레이션 효과만 별도로 디스패치합니다.
417
406
  requestAnimationFrame(() => {
418
- this.#isScrollSyncActive = true;
419
- // 필요하다면 여기서 초기 스크롤 위치를 0으로 리셋하여 정렬을 보장할 수 있습니다.
420
- // this.#asisEditorView.scrollDOM.scrollTop = 0;
421
- // this.#tobeEditorView.scrollDOM.scrollTop = 0;
407
+ console.log(asisEffect, tobeEffect);
408
+ this.#asisEditorView.dispatch({
409
+ effects: [asisEffect]
410
+ });
411
+ this.#tobeEditorView.dispatch({
412
+ effects: [tobeEffect]
413
+ });
414
+
415
+ // 3단계: 데코레이션까지 적용된 후 스크롤 동기화 활성화
416
+ // (필요하다면 여기도 requestAnimationFrame으로 한 번 더 지연시킬 수 있습니다.)
417
+ requestAnimationFrame(() => {
418
+ this.#isScrollSyncActive = true;
419
+ // 필요하다면 여기서 초기 스크롤 위치를 0으로 리셋하여 정렬을 보장할 수 있습니다.
420
+ // this.#asisEditorView.scrollDOM.scrollTop = 0;
421
+ // this.#tobeEditorView.scrollDOM.scrollTop = 0;
422
+ });
422
423
  });
423
424
  };
424
425
 
425
426
  disconnectedCallback() {
426
427
  // 컴포넌트 해제 시 스크롤 리스너 제거
427
- if (this._asisScrollHandler) { // 핸들러가 존재하면 제거
428
+ if (this._asisScrollHandler) {
428
429
  this.#asisEditorView.scrollDOM.removeEventListener('scroll', this._asisScrollHandler);
429
430
  this.#tobeEditorView.scrollDOM.removeEventListener('scroll', this._tobeScrollHandler);
430
- this._asisScrollHandler = null; // 참조 제거
431
- this._tobeScrollHandler = null; // 참조 제거
431
+ this._asisScrollHandler = null;
432
+ this._tobeScrollHandler = null;
432
433
  }
433
434
  if (this.#asisEditorView) {
434
435
  this.#asisEditorView.destroy();