ide-assi 0.436.0 → 0.438.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.
@@ -223561,6 +223561,13 @@ const defaultKeymap = /*@__PURE__*/[
223561
223561
  { key: "Alt-A", run: toggleBlockComment },
223562
223562
  { key: "Ctrl-m", mac: "Shift-Alt-m", run: toggleTabFocusMode },
223563
223563
  ].concat(standardKeymap);
223564
+ /**
223565
+ A binding that binds Tab to [`indentMore`](https://codemirror.net/6/docs/ref/#commands.indentMore) and
223566
+ Shift-Tab to [`indentLess`](https://codemirror.net/6/docs/ref/#commands.indentLess).
223567
+ Please see the [Tab example](../../examples/tab/) before using
223568
+ this.
223569
+ */
223570
+ const indentWithTab = { key: "Tab", run: indentMore, shift: indentLess };
223564
223571
 
223565
223572
  const basicNormalize = typeof String.prototype.normalize == "function"
223566
223573
  ? x => x.normalize("NFKD") : x => x;
@@ -234855,8 +234862,71 @@ const tobeDiffDecorations = StateField.define({
234855
234862
  });
234856
234863
 
234857
234864
 
234858
- class IdeDiff extends HTMLElement {
234865
+ // IdeDiff 클래스 외부 (파일 상단 or 하단)에 추가
234866
+ class MergeButtonWidget extends WidgetType {
234867
+ // ⭐️ diffRange는 변경이 발생할 대상 에디터의 범위입니다.
234868
+ // ⭐️ isAsisButton: ASIS 에디터 쪽에 붙는 버튼인가? (true면 ASIS -> TOBE 적용)
234869
+ // ⭐️ isAsisButton이 false면 TOBE 에디터 쪽에 붙는 버튼 (TOBE -> ASIS 되돌리기)
234870
+ constructor(isAsisButton, textToApply, targetEditorView, diffRange, hostComponent) {
234871
+ super();
234872
+ this.isAsisButton = isAsisButton; // 이 버튼이 ASIS 에디터에 붙는 버튼인가 (true) TOBE 에디터에 붙는 버튼인가 (false)
234873
+ this.textToApply = textToApply; // 적용할 텍스트
234874
+ this.targetEditorView = targetEditorView; // 텍스트를 적용할 에디터 뷰 (상대편 에디터)
234875
+ this.diffRange = diffRange; // 대상 에디터에서 변경이 일어날 정확한 from/to 오프셋
234876
+ this.hostComponent = hostComponent; // IdeDiff 인스턴스 참조
234877
+ }
234878
+
234879
+ // 위젯이 차지할 공간을 텍스트 줄에 할당할지 여부. false로 설정하여 버튼이 줄 사이에 끼어들지 않도록 함.
234880
+ eq(other) { return false; }
234881
+
234882
+ // 위젯의 DOM 요소를 생성합니다.
234883
+ toDOM(view) {
234884
+ const button = document.createElement("button");
234885
+ // 버튼 클래스 및 텍스트는 버튼의 위치(ASIS/TOBE)에 따라 결정됩니다.
234886
+ button.className = `cm-merge-button ${this.isAsisButton ? 'accept' : 'revert'}`;
234887
+ button.textContent = this.isAsisButton ? "→ 적용" : "← 되돌리기"; // ASIS 버튼: TOBE로 적용, TOBE 버튼: ASIS로 되돌리기
234888
+
234889
+ // 클릭 이벤트 핸들러
234890
+ button.addEventListener("click", () => {
234891
+ console.log(`버튼 클릭: ${this.isAsisButton ? 'ASIS -> TOBE' : 'TOBE -> ASIS'}`, this.textToApply);
234892
+ console.log("대상 에디터:", this.targetEditorView === this.hostComponent.asisEditorView ? "ASIS" : "TOBE");
234893
+ console.log("대상 범위:", this.diffRange);
234894
+
234895
+ this.applyChanges(this.textToApply, this.targetEditorView, this.diffRange);
234896
+ });
234897
+
234898
+ const container = document.createElement("div");
234899
+ container.className = "cm-merge-button-container";
234900
+ container.appendChild(button);
234901
+ return container;
234902
+ }
234903
+
234904
+ // 실제 변경 적용 로직
234905
+ applyChanges(text, editorView, range) {
234906
+ if (!editorView || !range) {
234907
+ console.error("Target editor view or range is undefined.", editorView, range);
234908
+ return;
234909
+ }
234910
+
234911
+ editorView.dispatch({
234912
+ changes: {
234913
+ from: range.from,
234914
+ to: range.to,
234915
+ insert: text
234916
+ }
234917
+ });
234918
+
234919
+ // 변경 후 Diff를 다시 계산하고 데코레이션을 업데이트합니다.
234920
+ // requestAnimationFrame으로 감싸서 다음 렌더링 사이클에서 Diff 계산이 이루어지도록 합니다.
234921
+ // 이렇게 하면 UI 블로킹을 줄일 수 있습니다.
234922
+ requestAnimationFrame(() => {
234923
+ this.hostComponent.recalculateDiff();
234924
+ });
234925
+ }
234926
+ }
234859
234927
 
234928
+
234929
+ class IdeDiff extends HTMLElement {
234860
234930
  #asisEditorView;
234861
234931
  #tobeEditorView;
234862
234932
  #asisEditorEl;
@@ -234869,17 +234939,79 @@ class IdeDiff extends HTMLElement {
234869
234939
  _tobeScrollHandler = null;
234870
234940
 
234871
234941
 
234942
+ get asisEditorView() {
234943
+ return this.#asisEditorView;
234944
+ };
234945
+
234872
234946
  constructor() {
234873
234947
  super();
234874
234948
  this.attachShadow({ mode: 'open' });
234875
234949
  }
234876
234950
 
234951
+
234952
+
234877
234953
  connectedCallback() {
234878
234954
  this.shadowRoot.innerHTML = `
234879
234955
  <style>
234880
234956
  /* ninegrid CSS 및 필요한 기본 스타일 */
234881
234957
  @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/ideDiff.css";
234882
234958
  ${ninegrid.getCustomPath(this, "ideDiff.css")}
234959
+
234960
+ /* --- 추가된 CSS 규칙 (버튼 및 선택 관련) --- */
234961
+ .cm-line {
234962
+ position: relative;
234963
+ }
234964
+ .cm-merge-button-container {
234965
+ position: absolute;
234966
+ right: 5px;
234967
+ top: 50%;
234968
+ transform: translateY(-50%);
234969
+ z-index: 10;
234970
+ display: flex;
234971
+ gap: 5px;
234972
+ }
234973
+ .cm-merge-button {
234974
+ background-color: #f0f0f0;
234975
+ border: 1px solid #ccc;
234976
+ border-radius: 3px;
234977
+ padding: 2px 6px;
234978
+ cursor: pointer;
234979
+ font-size: 0.8em;
234980
+ line-height: 1;
234981
+ white-space: nowrap;
234982
+ opacity: 0.7;
234983
+ transition: opacity 0.2s ease-in-out;
234984
+ }
234985
+ .cm-merge-button:hover {
234986
+ opacity: 1;
234987
+ background-color: #e0e0e0;
234988
+ }
234989
+ .cm-merge-button.accept {
234990
+ background-color: #4CAF50;
234991
+ color: white;
234992
+ border-color: #4CAF50;
234993
+ }
234994
+ .cm-merge-button.revert {
234995
+ background-color: #f44336;
234996
+ color: white;
234997
+ border-color: #f44336;
234998
+ }
234999
+ /* Diff 데코레이션 CSS (ideDiff.css에 없으면 여기에 추가) */
235000
+ .cm-inserted-line-bg { background-color: #e6ffed; border-left: 3px solid #66bb6a; }
235001
+ .cm-deleted-line-bg { background-color: #ffebe9; border-left: 3px solid #ef5350; }
235002
+
235003
+ /* CodeMirror 선택 스타일 (ideDiff.css에 없으면 여기에 추가) */
235004
+ .cm-selectionBackground {
235005
+ background-color: #d7d4f9 !important;
235006
+ }
235007
+ .cm-editor ::selection {
235008
+ background-color: #d7d4f9 !important;
235009
+ color: inherit !important;
235010
+ }
235011
+ .cm-editor::-moz-selection {
235012
+ background-color: #d7d4f9 !important;
235013
+ color: inherit !important;
235014
+ }
234883
235015
  </style>
234884
235016
 
234885
235017
  <div class="wrapper">
@@ -234925,7 +235057,7 @@ class IdeDiff extends HTMLElement {
234925
235057
  drawSelection(),
234926
235058
  dropCursor(),
234927
235059
  EditorState.allowMultipleSelections.of(true),
234928
- indentOnInput(), // ⭐️ 함수 호출
235060
+ indentOnInput(),
234929
235061
  bracketMatching(),
234930
235062
  highlightActiveLine(),
234931
235063
  highlightActiveLineGutter(),
@@ -234936,11 +235068,11 @@ class IdeDiff extends HTMLElement {
234936
235068
  ...historyKeymap,
234937
235069
  ...lintKeymap,
234938
235070
  ...completionKeymap,
234939
- //indentWithTab(), // ⭐️ 함수 호출
234940
- //selectAll() // ⭐️ 함수 호출
235071
+ indentWithTab, // ⭐️ 함수가 아닌 확장 자체를 전달
235072
+ selectAll // ⭐️ 함수가 아닌 확장 자체를 전달
234941
235073
  ]),
234942
- syntaxHighlighting(defaultHighlightStyle), // { fallback: true } 제거 확인
234943
- autocompletion(), // ⭐️ 함수 호출
235074
+ syntaxHighlighting(defaultHighlightStyle),
235075
+ autocompletion(),
234944
235076
  ];
234945
235077
 
234946
235078
  // ASIS 에디터 뷰 초기화
@@ -234949,9 +235081,9 @@ class IdeDiff extends HTMLElement {
234949
235081
  doc: '',
234950
235082
  extensions: [
234951
235083
  basicExtensions,
234952
- this.#languageCompartment.of(javascript()), // 초기 언어 설정
234953
- EditorState.readOnly.of(true),
234954
- asisDiffDecorations, // ASIS Diff 데코레이션 필드
235084
+ this.#languageCompartment.of(javascript()),
235085
+ EditorState.readOnly.of(true), // ASIS는 읽기 전용 유지
235086
+ asisDiffDecorations,
234955
235087
  EditorView.updateListener.of((update) => {
234956
235088
  if (update.view.contentDOM.firstChild && !update.view._initialAsisContentLoaded) {
234957
235089
  update.view._initialAsisContentLoaded = true;
@@ -234969,9 +235101,9 @@ class IdeDiff extends HTMLElement {
234969
235101
  doc: '',
234970
235102
  extensions: [
234971
235103
  basicExtensions,
234972
- this.#languageCompartment.of(javascript()), // 초기 언어 설정
234973
- //EditorState.readOnly.of(true),
234974
- tobeDiffDecorations, // TOBE Diff 데코레이션 필드
235104
+ this.#languageCompartment.of(javascript()),
235105
+ // EditorState.readOnly.of(true), // TOBE는 편집 가능하도록 주석 처리 유지
235106
+ tobeDiffDecorations,
234975
235107
  EditorView.updateListener.of((update) => {
234976
235108
  if (update.view.contentDOM.firstChild && !update.view._initialTobeContentLoaded) {
234977
235109
  update.view._initialTobeContentLoaded = true;
@@ -235024,96 +235156,66 @@ class IdeDiff extends HTMLElement {
235024
235156
  #applyDiffDecorations = (asisSrc, tobeSrc) => {
235025
235157
  const dmp = new diffMatchPatchExports.diff_match_patch();
235026
235158
 
235027
- // dmp의 기본 cleanupThreshold를 줄여서 더 세밀한 차이를 감지하도록 시도
235028
- // 기본값은 0.5인데, 0으로 하면 더 많은 변화를 감지할 수 있습니다.
235029
- // 하지만 너무 낮추면 노이즈가 많아질 수 있습니다.
235030
- // dmp.Diff_EditCost = 4; // 편집 비용 조정, 기본 4
235031
- // dmp.Diff_DualThreshold = 0.5; // 불명확한 Diff에 대한 임계값. 기본 0.5
235032
- // dmp.Diff_Timeout = 1.0; // 타임아웃, 기본 1.0
235033
-
235034
- // 텍스트를 줄 단위로 변환하여 Diff 수행
235035
235159
  const a = dmp.diff_linesToChars_(asisSrc, tobeSrc);
235036
235160
  const lineText1 = a.chars1;
235037
235161
  const lineText2 = a.chars2;
235038
235162
  const lineArray = a.lineArray;
235039
235163
 
235040
- // dmp.diff_main(text1, text2, checklines, deadline)
235041
- // checklines: true (기본값)는 줄 단위 최적화, false는 문자 단위로.
235042
- // 여기서는 diff_linesToChars_를 사용했으므로 true가 적절.
235043
235164
  const diffs = dmp.diff_main(lineText1, lineText2, true);
235044
-
235045
- // cleanupEfficiency를 먼저 적용하여 효율적인 Diff를 만듭니다.
235046
- // 이는 작은 변경사항이 인접해 있을 때 하나의 큰 변경으로 합치는 경향이 있습니다.
235047
- // dmp.diff_cleanupEfficiency(diffs); // 오히려 이동을 놓칠 수 있음
235048
-
235049
- // 그 다음 의미론적 정리를 적용합니다.
235050
235165
  dmp.diff_cleanupSemantic(diffs);
235051
-
235052
- // 다시 문자열로 변환
235053
235166
  dmp.diff_charsToLines_(diffs, lineArray);
235054
235167
 
235055
- console.log(diffs);
235168
+ console.log("Calculated Diffs:", diffs); // Diff 결과 확인용
235056
235169
 
235057
235170
  const asisLineBuilder = new RangeSetBuilder();
235058
235171
  const tobeLineBuilder = new RangeSetBuilder();
235059
235172
 
235060
- let asisCursor = 0;
235061
- let tobeCursor = 0;
235173
+ let asisCursor = 0; // ASIS 텍스트에서의 현재 오프셋
235174
+ let tobeCursor = 0; // TOBE 텍스트에서의 현재 오프셋
235062
235175
 
235063
- // 변경된 줄에 대한 새로운 데코레이션 클래스를 추가할 수 있습니다.
235064
235176
  const insertedLineDeco = Decoration.line({ class: "cm-inserted-line-bg" });
235065
235177
  const deletedLineDeco = Decoration.line({ class: "cm-deleted-line-bg" });
235066
- // const changedLineDeco = Decoration.line({ class: "cm-changed-line-bg" }); // 필요하다면
235067
235178
 
235068
- // ⭐️ IdeDiff 인스턴스에 대한 참조를 위젯에 넘겨주기 위해 임시 변수 사용
235069
- // 실제로는 Closure나 Bound method로 넘겨줄 수 있음
235070
235179
  const currentInstance = this;
235071
235180
 
235072
235181
  for (const [op, text] of diffs) {
235073
235182
  const len = text.length;
235074
235183
 
235075
- // ⭐️ 해당 diff 청크의 시작 오프셋을 저장 (버튼 위젯 위치 결정용)
235076
- const currentAsisOffset = asisCursor;
235077
- const currentTobeOffset = tobeCursor;
235184
+ // diff op 이전에 현재 커서 위치를 저장
235185
+ const asisRangeStart = asisCursor;
235186
+ const tobeRangeStart = tobeCursor;
235078
235187
 
235079
235188
  switch (op) {
235080
- case diffMatchPatchExports.diff_match_patch.DIFF_INSERT:
235081
- console.log(diffMatchPatchExports.diff_match_patch.DIFF_INSERT, text);
235189
+ case diffMatchPatchExports.diff_match_patch.DIFF_INSERT: // TOBE에 추가된 내용 (ASIS에는 없음)
235190
+ console.log("DIFF_INSERT (TOBE added):", JSON.stringify(text));
235082
235191
  const tobeLines = text.split('\n');
235083
-
235084
235192
  for (let i = 0; i < tobeLines.length; i++) {
235085
- // 빈 줄이 아니고, 마지막 줄이면서 줄바꿈이 없는 경우가 아니면 데코레이션
235086
- /**
235087
- if (!(i === tobeLines.length - 1 && tobeLines[i] === '' && !text.endsWith('\n'))) {
235088
- tobeLineBuilder.add(tobeCursor, tobeCursor, insertedLineDeco);
235089
- }
235090
- tobeCursor += tobeLines[i].length + (i < tobeLines.length - 1 ? 1 : 0);
235091
- */
235092
235193
  if (!(i === tobeLines.length - 1 && tobeLines[i] === '' && text.endsWith('\n'))) {
235093
235194
  tobeLineBuilder.add(tobeCursor, tobeCursor, insertedLineDeco);
235094
235195
  }
235095
235196
  tobeCursor += tobeLines[i].length + (i < tobeLines.length - 1 ? 1 : 0);
235096
235197
  }
235097
235198
 
235199
+ // ⭐️ TOBE 에디터에 버튼 추가: TOBE의 추가 내용을 ASIS로 '되돌리기' (ASIS에서 삭제)
235200
+ // 즉, TOBE에서 삽입된 내용을 ASIS에서 '없애는' 작업
235098
235201
  tobeLineBuilder.add(
235099
- currentTobeOffset, // Diff 청크의 시작 오프셋
235100
- currentTobeOffset,
235202
+ tobeRangeStart, // TOBE에서의 해당 Diff 청크 시작 오프셋
235203
+ tobeRangeStart,
235101
235204
  Decoration.widget({
235102
- widget: // #applyDiffDecorations 내 MergeButtonWidget 생성 시
235103
- new MergeButtonWidget(
235104
- true, // ASIS 버튼 (적용)
235105
- text, // 적용할 텍스트
235106
- currentInstance.#tobeEditorView, // 적용 대상 에디터
235107
- { from: currentAsisOffset, to: currentAsisOffset + text.length }, // ⭐️ diffRange 전달
235108
- currentInstance // ⭐️ IdeDiff 인스턴스 전달
235109
- ),
235205
+ widget: new MergeButtonWidget(
235206
+ false, // 이 버튼은 TOBE 에디터에 붙는 버튼 (되돌리기)
235207
+ "", // 텍스트를 ""로 삽입하면 삭제 효과 (ASIS에서 없앨 내용)
235208
+ currentInstance.#asisEditorView, // 대상 에디터는 ASIS
235209
+ { from: asisRangeStart, to: asisRangeStart + 0 }, // ASIS에서의 대상 범위 (삽입 지점)
235210
+ currentInstance
235211
+ ),
235110
235212
  side: 1 // 텍스트 뒤에 삽입
235111
235213
  })
235112
235214
  );
235113
235215
  break;
235114
235216
 
235115
- case diffMatchPatchExports.diff_match_patch.DIFF_DELETE:
235116
- console.log(diffMatchPatchExports.diff_match_patch.DIFF_DELETE, text);
235217
+ case diffMatchPatchExports.diff_match_patch.DIFF_DELETE: // ASIS에서 삭제된 내용 (TOBE에는 없음)
235218
+ console.log("DIFF_DELETE (ASIS deleted):", JSON.stringify(text));
235117
235219
  const asisLines = text.split('\n');
235118
235220
  for (let i = 0; i < asisLines.length; i++) {
235119
235221
  if (!(i === asisLines.length - 1 && asisLines[i] === '' && text.endsWith('\n'))) {
@@ -235122,30 +235224,28 @@ class IdeDiff extends HTMLElement {
235122
235224
  asisCursor += asisLines[i].length + (i < asisLines.length - 1 ? 1 : 0);
235123
235225
  }
235124
235226
 
235125
- // ⭐️ ASIS 에디터에서 삭제된 청크의 경우, ASIS 쪽에 적용 버튼 (TOBE 적용) 추가
235227
+ // ⭐️ ASIS 에디터에 버튼 추가: ASIS 삭제 내용을 TOBE로 '적용' (TOBE 삽입)
235228
+ // 즉, ASIS에서 삭제된 내용을 TOBE에 '넣는' 작업
235126
235229
  asisLineBuilder.add(
235127
- currentAsisOffset, // Diff 청크의 시작 오프셋
235128
- currentAsisOffset,
235230
+ asisRangeStart, // ASIS에서의 해당 Diff 청크 시작 오프셋
235231
+ asisRangeStart,
235129
235232
  Decoration.widget({
235130
235233
  widget: new MergeButtonWidget(
235131
- true, // ASIS 버튼 (적용)
235132
- text, // 적용할 텍스트 (이 경우 ASIS에서 가져올 내용)
235133
- currentInstance.#tobeEditorView // 적용 대상은 TOBE 에디터
235234
+ true, // 이 버튼은 ASIS 에디터에 붙는 버튼 (적용)
235235
+ text, // ASIS에서 삭제된 내용을 TOBE에 삽입
235236
+ currentInstance.#tobeEditorView, // 대상 에디터는 TOBE
235237
+ { from: tobeRangeStart, to: tobeRangeStart + 0 }, // TOBE에서의 대상 범위 (삽입 지점)
235238
+ currentInstance
235134
235239
  ),
235135
235240
  side: 1 // 텍스트 뒤에 삽입
235136
235241
  })
235137
235242
  );
235138
-
235139
235243
  break;
235140
235244
 
235141
- case diffMatchPatchExports.diff_match_patch.DIFF_EQUAL:
235245
+ case diffMatchPatchExports.diff_match_patch.DIFF_EQUAL: // 동일한 내용
235142
235246
  asisCursor += len;
235143
235247
  tobeCursor += len;
235144
235248
  break;
235145
-
235146
- default:
235147
- console.log(op);
235148
- break;
235149
235249
  }
235150
235250
  }
235151
235251
 
@@ -235155,7 +235255,6 @@ class IdeDiff extends HTMLElement {
235155
235255
  };
235156
235256
  };
235157
235257
 
235158
- // IdeDiff 클래스 내부에 변경 후 Diff를 다시 계산하는 메서드 추가
235159
235258
  recalculateDiff = () => {
235160
235259
  const asisDoc = this.#asisEditorView.state.doc.toString();
235161
235260
  const tobeDoc = this.#tobeEditorView.state.doc.toString();
@@ -235218,71 +235317,6 @@ class IdeDiff extends HTMLElement {
235218
235317
  };
235219
235318
  }
235220
235319
 
235221
- // IdeDiff 클래스 외부 (파일 상단 or 하단)에 추가
235222
- class MergeButtonWidget extends WidgetType {
235223
- constructor(isAsis, textToApply, targetEditorView, diffRange, hostComponent) {
235224
- super();
235225
- this.isAsis = isAsis; // ASIS 쪽 버튼인지 (true) TOBE 쪽 버튼인지 (false)
235226
- this.textToApply = textToApply; // 적용할 텍스트
235227
- this.targetEditorView = targetEditorView; // 텍스트를 적용할 에디터 뷰
235228
- this.diffRange = diffRange; // ⭐️ 추가된 속성
235229
- this.hostComponent = hostComponent; // ⭐️ IdeDiff 인스턴스 참조
235230
- }
235231
-
235232
- // 위젯이 차지할 공간을 텍스트 줄에 할당할지 여부. false로 설정하여 버튼이 줄 사이에 끼어들지 않도록 함.
235233
- eq(other) { return false; }
235234
-
235235
- // 위젯의 DOM 요소를 생성합니다.
235236
- toDOM(view) {
235237
- const button = document.createElement("button");
235238
- button.className = `cm-merge-button ${this.isAsis ? 'accept' : 'revert'}`;
235239
- button.textContent = this.isAsis ? "→ 적용" : "← 되돌리기"; // 버튼 텍스트
235240
-
235241
- // 클릭 이벤트 핸들러
235242
- button.addEventListener("click", () => {
235243
- // 이 로직은 나중에 구현할 `applyChanges` 메서드를 호출할 것입니다.
235244
- // 지금은 콘솔에 로그만 남깁니다.
235245
- console.log(`버튼 클릭: ${this.isAsis ? 'ASIS -> TOBE' : 'TOBE -> ASIS'}`, this.textToApply);
235246
-
235247
- // 실제 변경 로직 (아래 applyChanges 메서드 구현 후 주석 해제)
235248
- this.applyChanges(this.textToApply, this.targetEditorView);
235249
- });
235250
-
235251
- const container = document.createElement("div");
235252
- container.className = "cm-merge-button-container";
235253
- container.appendChild(button);
235254
- return container;
235255
- }
235256
-
235257
- // 실제 변경 적용 로직
235258
- applyChanges(text, editorView) {
235259
- if (!editorView || !this.diffRange) {
235260
- console.error("Target editor view or diffRange is undefined.");
235261
- return;
235262
- }
235263
-
235264
- // ⭐️ 해당 오프셋 범위의 내용을 교체 (삽입 또는 삭제)
235265
- editorView.dispatch({
235266
- changes: {
235267
- from: this.diffRange.from,
235268
- to: this.diffRange.to, // 삭제될 범위
235269
- insert: text // 삽입될 내용
235270
- }
235271
- });
235272
-
235273
- // 변경 후 Diff를 다시 계산하고 데코레이션을 업데이트해야 합니다.
235274
- // this.hostComponent.recalculateDiff(); 와 같은 메서드를 호출해야 함.
235275
- // 이 부분은 IdeDiff 클래스 내에서 구현해야 합니다.
235276
- // 일단은 콘솔 로그와 함께 작동하는지 확인합니다.
235277
- console.log("Changes applied and diff recalculation needed!");
235278
-
235279
- // 변경 후 Diff를 다시 계산하고 데코레이션을 업데이트합니다.
235280
- this.hostComponent.recalculateDiff(); // ⭐️ hostComponent를 통해 메서드 호출
235281
- }
235282
-
235283
-
235284
- }
235285
-
235286
235320
  customElements.define("ide-diff", IdeDiff);
235287
235321
 
235288
235322
  //import "./components/ideAssi.js";