ide-assi 0.350.0 → 0.352.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.
- package/dist/bundle.cjs.js +36 -55
- package/dist/bundle.esm.js +36 -55
- package/dist/components/ideDiff.js +3 -1
- package/package.json +1 -1
- package/src/components/ideDiff.js +3 -1
package/dist/bundle.cjs.js
CHANGED
|
@@ -202480,7 +202480,7 @@ function codePointSize$1(code) { return code < 0x10000 ? 1 : 2 }
|
|
|
202480
202480
|
/**
|
|
202481
202481
|
The data structure for documents. @nonabstract
|
|
202482
202482
|
*/
|
|
202483
|
-
|
|
202483
|
+
class Text {
|
|
202484
202484
|
/**
|
|
202485
202485
|
Get the line description around the given position.
|
|
202486
202486
|
*/
|
|
@@ -202604,11 +202604,11 @@ let Text$1 = class Text {
|
|
|
202604
202604
|
return Text.empty;
|
|
202605
202605
|
return text.length <= 32 /* Tree.Branch */ ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, []));
|
|
202606
202606
|
}
|
|
202607
|
-
}
|
|
202607
|
+
}
|
|
202608
202608
|
// Leaves store an array of line strings. There are always line breaks
|
|
202609
202609
|
// between these strings. Leaves are limited in size and have to be
|
|
202610
202610
|
// contained in TextNode instances for bigger documents.
|
|
202611
|
-
class TextLeaf extends Text
|
|
202611
|
+
class TextLeaf extends Text {
|
|
202612
202612
|
constructor(text, length = textLength(text)) {
|
|
202613
202613
|
super();
|
|
202614
202614
|
this.text = text;
|
|
@@ -202691,7 +202691,7 @@ class TextLeaf extends Text$1 {
|
|
|
202691
202691
|
// number of other nodes or leaves, taking care to balance themselves
|
|
202692
202692
|
// on changes. There are implied line breaks _between_ the children of
|
|
202693
202693
|
// a node (but not before the first or after the last child).
|
|
202694
|
-
class TextNode extends Text
|
|
202694
|
+
class TextNode extends Text {
|
|
202695
202695
|
constructor(children, length) {
|
|
202696
202696
|
super();
|
|
202697
202697
|
this.children = children;
|
|
@@ -202827,7 +202827,7 @@ class TextNode extends Text$1 {
|
|
|
202827
202827
|
return chunked.length == 1 ? chunked[0] : new TextNode(chunked, length);
|
|
202828
202828
|
}
|
|
202829
202829
|
}
|
|
202830
|
-
Text
|
|
202830
|
+
Text.empty = /*@__PURE__*/new TextLeaf([""], 0);
|
|
202831
202831
|
function textLength(text) {
|
|
202832
202832
|
let length = -1;
|
|
202833
202833
|
for (let line of text)
|
|
@@ -202994,7 +202994,7 @@ class LineCursor {
|
|
|
202994
202994
|
get lineBreak() { return false; }
|
|
202995
202995
|
}
|
|
202996
202996
|
if (typeof Symbol != "undefined") {
|
|
202997
|
-
Text
|
|
202997
|
+
Text.prototype[Symbol.iterator] = function () { return this.iter(); };
|
|
202998
202998
|
RawTextCursor.prototype[Symbol.iterator] = PartialTextCursor.prototype[Symbol.iterator] =
|
|
202999
202999
|
LineCursor.prototype[Symbol.iterator] = function () { return this; };
|
|
203000
203000
|
}
|
|
@@ -203318,8 +203318,8 @@ class ChangeSet extends ChangeDesc {
|
|
|
203318
203318
|
sections[i + 1] = len;
|
|
203319
203319
|
let index = i >> 1;
|
|
203320
203320
|
while (inserted.length < index)
|
|
203321
|
-
inserted.push(Text
|
|
203322
|
-
inserted.push(len ? doc.slice(pos, pos + len) : Text
|
|
203321
|
+
inserted.push(Text.empty);
|
|
203322
|
+
inserted.push(len ? doc.slice(pos, pos + len) : Text.empty);
|
|
203323
203323
|
}
|
|
203324
203324
|
pos += len;
|
|
203325
203325
|
}
|
|
@@ -203446,7 +203446,7 @@ class ChangeSet extends ChangeDesc {
|
|
|
203446
203446
|
let { from, to = from, insert } = spec;
|
|
203447
203447
|
if (from > to || from < 0 || to > length)
|
|
203448
203448
|
throw new RangeError(`Invalid change range ${from} to ${to} (in doc of length ${length})`);
|
|
203449
|
-
let insText = !insert ? Text
|
|
203449
|
+
let insText = !insert ? Text.empty : typeof insert == "string" ? Text.of(insert.split(lineSep || DefaultSplit)) : insert;
|
|
203450
203450
|
let insLen = insText.length;
|
|
203451
203451
|
if (from == to && insLen == 0)
|
|
203452
203452
|
return;
|
|
@@ -203490,8 +203490,8 @@ class ChangeSet extends ChangeDesc {
|
|
|
203490
203490
|
}
|
|
203491
203491
|
else {
|
|
203492
203492
|
while (inserted.length < i)
|
|
203493
|
-
inserted.push(Text
|
|
203494
|
-
inserted[i] = Text
|
|
203493
|
+
inserted.push(Text.empty);
|
|
203494
|
+
inserted[i] = Text.of(part.slice(1));
|
|
203495
203495
|
sections.push(part[0], inserted[i].length);
|
|
203496
203496
|
}
|
|
203497
203497
|
}
|
|
@@ -203528,7 +203528,7 @@ function addInsert(values, sections, value) {
|
|
|
203528
203528
|
}
|
|
203529
203529
|
else {
|
|
203530
203530
|
while (values.length < index)
|
|
203531
|
-
values.push(Text
|
|
203531
|
+
values.push(Text.empty);
|
|
203532
203532
|
values.push(value);
|
|
203533
203533
|
}
|
|
203534
203534
|
}
|
|
@@ -203541,7 +203541,7 @@ function iterChanges(desc, f, individual) {
|
|
|
203541
203541
|
posB += len;
|
|
203542
203542
|
}
|
|
203543
203543
|
else {
|
|
203544
|
-
let endA = posA, endB = posB, text = Text
|
|
203544
|
+
let endA = posA, endB = posB, text = Text.empty;
|
|
203545
203545
|
for (;;) {
|
|
203546
203546
|
endA += len;
|
|
203547
203547
|
endB += ins;
|
|
@@ -203697,11 +203697,11 @@ class SectionIter {
|
|
|
203697
203697
|
get len2() { return this.ins < 0 ? this.len : this.ins; }
|
|
203698
203698
|
get text() {
|
|
203699
203699
|
let { inserted } = this.set, index = (this.i - 2) >> 1;
|
|
203700
|
-
return index >= inserted.length ? Text
|
|
203700
|
+
return index >= inserted.length ? Text.empty : inserted[index];
|
|
203701
203701
|
}
|
|
203702
203702
|
textBit(len) {
|
|
203703
203703
|
let { inserted } = this.set, index = (this.i - 2) >> 1;
|
|
203704
|
-
return index >= inserted.length && !len ? Text
|
|
203704
|
+
return index >= inserted.length && !len ? Text.empty
|
|
203705
203705
|
: inserted[index].slice(this.off, len == null ? undefined : this.off + len);
|
|
203706
203706
|
}
|
|
203707
203707
|
forward(len) {
|
|
@@ -205145,7 +205145,7 @@ class EditorState {
|
|
|
205145
205145
|
[`Text`](https://codemirror.net/6/docs/ref/#state.Text) instance from the given string.
|
|
205146
205146
|
*/
|
|
205147
205147
|
toText(string) {
|
|
205148
|
-
return Text
|
|
205148
|
+
return Text.of(string.split(this.facet(EditorState.lineSeparator) || DefaultSplit));
|
|
205149
205149
|
}
|
|
205150
205150
|
/**
|
|
205151
205151
|
Return the given range of the document as a string.
|
|
@@ -205212,8 +205212,8 @@ class EditorState {
|
|
|
205212
205212
|
*/
|
|
205213
205213
|
static create(config = {}) {
|
|
205214
205214
|
let configuration = Configuration.resolve(config.extensions || [], new Map);
|
|
205215
|
-
let doc = config.doc instanceof Text
|
|
205216
|
-
: Text
|
|
205215
|
+
let doc = config.doc instanceof Text ? config.doc
|
|
205216
|
+
: Text.of((config.doc || "").split(configuration.staticFacet(EditorState.lineSeparator) || DefaultSplit));
|
|
205217
205217
|
let selection = !config.selection ? EditorSelection.single(0)
|
|
205218
205218
|
: config.selection instanceof EditorSelection ? config.selection
|
|
205219
205219
|
: EditorSelection.single(config.selection.anchor, config.selection.head);
|
|
@@ -207625,12 +207625,12 @@ class WidgetView extends ContentView {
|
|
|
207625
207625
|
ignoreEvent(event) { return this.widget.ignoreEvent(event); }
|
|
207626
207626
|
get overrideDOMText() {
|
|
207627
207627
|
if (this.length == 0)
|
|
207628
|
-
return Text
|
|
207628
|
+
return Text.empty;
|
|
207629
207629
|
let top = this;
|
|
207630
207630
|
while (top.parent)
|
|
207631
207631
|
top = top.parent;
|
|
207632
207632
|
let { view } = top, text = view && view.state.doc, start = this.posAtStart;
|
|
207633
|
-
return text ? text.slice(start, start + this.length) : Text
|
|
207633
|
+
return text ? text.slice(start, start + this.length) : Text.empty;
|
|
207634
207634
|
}
|
|
207635
207635
|
domAtPos(pos) {
|
|
207636
207636
|
return (this.length ? pos == 0 : this.side > 0)
|
|
@@ -207692,7 +207692,7 @@ class WidgetBufferView extends ContentView {
|
|
|
207692
207692
|
return this.dom.getBoundingClientRect();
|
|
207693
207693
|
}
|
|
207694
207694
|
get overrideDOMText() {
|
|
207695
|
-
return Text
|
|
207695
|
+
return Text.empty;
|
|
207696
207696
|
}
|
|
207697
207697
|
get isHidden() { return true; }
|
|
207698
207698
|
}
|
|
@@ -208316,7 +208316,7 @@ class BlockWidgetView extends ContentView {
|
|
|
208316
208316
|
}
|
|
208317
208317
|
}
|
|
208318
208318
|
get overrideDOMText() {
|
|
208319
|
-
return this.parent ? this.parent.view.state.doc.slice(this.posAtStart, this.posAtEnd) : Text
|
|
208319
|
+
return this.parent ? this.parent.view.state.doc.slice(this.posAtStart, this.posAtEnd) : Text.empty;
|
|
208320
208320
|
}
|
|
208321
208321
|
domBoundsAround() { return null; }
|
|
208322
208322
|
become(other) {
|
|
@@ -210656,7 +210656,7 @@ function applyDOMChange(view, domChange) {
|
|
|
210656
210656
|
diff.toB == diff.from + 2 && domChange.text.slice(diff.from, diff.toB) == LineBreakPlaceholder + LineBreakPlaceholder)
|
|
210657
210657
|
diff.toB--;
|
|
210658
210658
|
change = { from: from + diff.from, to: from + diff.toA,
|
|
210659
|
-
insert: Text
|
|
210659
|
+
insert: Text.of(domChange.text.slice(diff.from, diff.toB).split(LineBreakPlaceholder)) };
|
|
210660
210660
|
}
|
|
210661
210661
|
}
|
|
210662
210662
|
else if (newSel && (!view.hasFocus && view.state.facet(editable) || newSel.main.eq(sel))) {
|
|
@@ -210674,7 +210674,7 @@ function applyDOMChange(view, domChange) {
|
|
|
210674
210674
|
// and transform it into a regular space insert.
|
|
210675
210675
|
if (newSel && change.insert.length == 2)
|
|
210676
210676
|
newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
|
|
210677
|
-
change = { from: change.from, to: change.to, insert: Text
|
|
210677
|
+
change = { from: change.from, to: change.to, insert: Text.of([change.insert.toString().replace(".", " ")]) };
|
|
210678
210678
|
}
|
|
210679
210679
|
else if (change && change.from >= sel.from && change.to <= sel.to &&
|
|
210680
210680
|
(change.from != sel.from || change.to != sel.to) &&
|
|
@@ -210694,7 +210694,7 @@ function applyDOMChange(view, domChange) {
|
|
|
210694
210694
|
// bogus new line to be created in CodeMirror (#968)
|
|
210695
210695
|
if (newSel)
|
|
210696
210696
|
newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
|
|
210697
|
-
change = { from: sel.from, to: sel.to, insert: Text
|
|
210697
|
+
change = { from: sel.from, to: sel.to, insert: Text.of([" "]) };
|
|
210698
210698
|
}
|
|
210699
210699
|
if (change) {
|
|
210700
210700
|
return applyDOMChangeInner(view, change, newSel, lastKey);
|
|
@@ -211747,7 +211747,7 @@ function clearHeightChangeFlag() { heightChangeFlag = false; }
|
|
|
211747
211747
|
class HeightOracle {
|
|
211748
211748
|
constructor(lineWrapping) {
|
|
211749
211749
|
this.lineWrapping = lineWrapping;
|
|
211750
|
-
this.doc = Text
|
|
211750
|
+
this.doc = Text.empty;
|
|
211751
211751
|
this.heightSamples = {};
|
|
211752
211752
|
this.lineHeight = 14; // The height of an entire line (line-height)
|
|
211753
211753
|
this.charWidth = 7;
|
|
@@ -212594,7 +212594,7 @@ class ViewState {
|
|
|
212594
212594
|
let guessWrapping = state.facet(contentAttributes).some(v => typeof v != "function" && v.class == "cm-lineWrapping");
|
|
212595
212595
|
this.heightOracle = new HeightOracle(guessWrapping);
|
|
212596
212596
|
this.stateDeco = state.facet(decorations).filter(d => typeof d != "function");
|
|
212597
|
-
this.heightMap = HeightMap.empty().applyChanges(this.stateDeco, Text
|
|
212597
|
+
this.heightMap = HeightMap.empty().applyChanges(this.stateDeco, Text.empty, this.heightOracle.setDoc(state.doc), [new ChangedRange(0, 0, 0, state.doc.length)]);
|
|
212598
212598
|
for (let i = 0; i < 2; i++) {
|
|
212599
212599
|
this.viewport = this.getViewport(0, null);
|
|
212600
212600
|
if (!this.updateForViewport())
|
|
@@ -212746,7 +212746,7 @@ class ViewState {
|
|
|
212746
212746
|
clearHeightChangeFlag();
|
|
212747
212747
|
for (let vp of this.viewports) {
|
|
212748
212748
|
let heights = vp.from == this.viewport.from ? lineHeights : view.docView.measureVisibleLineHeights(vp);
|
|
212749
|
-
this.heightMap = (refresh ? HeightMap.empty().applyChanges(this.stateDeco, Text
|
|
212749
|
+
this.heightMap = (refresh ? HeightMap.empty().applyChanges(this.stateDeco, Text.empty, this.heightOracle, [new ChangedRange(0, 0, 0, view.state.doc.length)]) : this.heightMap).updateHeight(oracle, 0, refresh, new MeasuredHeights(vp.from, heights));
|
|
212750
212750
|
}
|
|
212751
212751
|
if (heightChangeFlag)
|
|
212752
212752
|
result |= 2 /* UpdateFlag.Height */;
|
|
@@ -213932,7 +213932,7 @@ class EditContextManager {
|
|
|
213932
213932
|
let from = this.toEditorPos(e.updateRangeStart), to = this.toEditorPos(e.updateRangeEnd);
|
|
213933
213933
|
if (view.inputState.composing >= 0 && !this.composing)
|
|
213934
213934
|
this.composing = { contextBase: e.updateRangeStart, editorBase: from, drifted: false };
|
|
213935
|
-
let change = { from, to, insert: Text
|
|
213935
|
+
let change = { from, to, insert: Text.of(e.text.split("\n")) };
|
|
213936
213936
|
// If the window doesn't include the anchor, assume changes
|
|
213937
213937
|
// adjacent to a side go up to the anchor.
|
|
213938
213938
|
if (change.from == this.from && anchor < this.from)
|
|
@@ -213948,7 +213948,7 @@ class EditContextManager {
|
|
|
213948
213948
|
}
|
|
213949
213949
|
if ((browser.mac || browser.android) && change.from == head - 1 &&
|
|
213950
213950
|
/^\. ?$/.test(e.text) && view.contentDOM.getAttribute("autocorrect") == "off")
|
|
213951
|
-
change = { from, to, insert: Text
|
|
213951
|
+
change = { from, to, insert: Text.of([e.text.replace(".", " ")]) };
|
|
213952
213952
|
this.pendingContextChange = change;
|
|
213953
213953
|
if (!view.state.readOnly) {
|
|
213954
213954
|
let newLen = this.to - this.from + (change.to - change.from + change.insert.length);
|
|
@@ -223080,7 +223080,7 @@ const splitLine = ({ state, dispatch }) => {
|
|
|
223080
223080
|
if (state.readOnly)
|
|
223081
223081
|
return false;
|
|
223082
223082
|
let changes = state.changeByRange(range => {
|
|
223083
|
-
return { changes: { from: range.from, to: range.to, insert: Text
|
|
223083
|
+
return { changes: { from: range.from, to: range.to, insert: Text.of(["", ""]) },
|
|
223084
223084
|
range: EditorSelection.cursor(range.from) };
|
|
223085
223085
|
});
|
|
223086
223086
|
dispatch(state.update(changes, { scrollIntoView: true, userEvent: "input" }));
|
|
@@ -223254,7 +223254,7 @@ function newlineAndIndent(atEof) {
|
|
|
223254
223254
|
let insert = ["", indentString(state, indent)];
|
|
223255
223255
|
if (explode)
|
|
223256
223256
|
insert.push(indentString(state, cx.lineIndent(line.from, -1)));
|
|
223257
|
-
return { changes: { from, to, insert: Text
|
|
223257
|
+
return { changes: { from, to, insert: Text.of(insert) },
|
|
223258
223258
|
range: EditorSelection.cursor(from + 1 + insert[1].length) };
|
|
223259
223259
|
});
|
|
223260
223260
|
dispatch(state.update(changes, { scrollIntoView: true, userEvent: "input" }));
|
|
@@ -229931,7 +229931,7 @@ function snippet(template) {
|
|
|
229931
229931
|
let { text, ranges } = snippet.instantiate(editor.state, from);
|
|
229932
229932
|
let { main } = editor.state.selection;
|
|
229933
229933
|
let spec = {
|
|
229934
|
-
changes: { from, to: to == main.from ? main.to : to, insert: Text
|
|
229934
|
+
changes: { from, to: to == main.from ? main.to : to, insert: Text.of(text) },
|
|
229935
229935
|
scrollIntoView: true,
|
|
229936
229936
|
annotations: completion ? [pickedCompletion.of(completion), Transaction.userEvent.of("input.complete")] : undefined
|
|
229937
229937
|
};
|
|
@@ -235064,36 +235064,17 @@ class IdeDiff extends HTMLElement {
|
|
|
235064
235064
|
console.warn('CodeMirror Editors not initialized yet.');
|
|
235065
235065
|
return;
|
|
235066
235066
|
}
|
|
235067
|
-
|
|
235068
|
-
let langExtension;
|
|
235069
235067
|
switch(language) {
|
|
235070
235068
|
case 'javascript':
|
|
235071
|
-
|
|
235069
|
+
javascript();
|
|
235072
235070
|
break;
|
|
235073
235071
|
default:
|
|
235074
|
-
|
|
235072
|
+
javascript();
|
|
235075
235073
|
}
|
|
235076
235074
|
|
|
235077
235075
|
// 먼저 데코레이션 효과를 계산하여 가져옵니다.
|
|
235078
235076
|
const { asisEffect, tobeEffect } = this.#applyDiffDecorations(src1, src2);
|
|
235079
|
-
|
|
235080
|
-
// asis 에디터의 텍스트 변경 및 데코레이션 효과를 단일 트랜잭션으로 디스패치합니다.
|
|
235081
|
-
this.#asisEditorView.dispatch({
|
|
235082
|
-
changes: { from: 0, to: this.#asisEditorView.state.doc.length, insert: src1 },
|
|
235083
|
-
effects: [
|
|
235084
|
-
this.#languageCompartment.reconfigure(langExtension),
|
|
235085
|
-
asisEffect // 계산된 데코레이션 효과를 포함
|
|
235086
|
-
]
|
|
235087
|
-
});
|
|
235088
|
-
|
|
235089
|
-
// tobe 에디터의 텍스트 변경 및 데코레이션 효과를 단일 트랜잭션으로 디스패치합니다.
|
|
235090
|
-
this.#tobeEditorView.dispatch({
|
|
235091
|
-
changes: { from: 0, to: this.#tobeEditorView.state.doc.length, insert: src2 },
|
|
235092
|
-
effects: [
|
|
235093
|
-
this.#languageCompartment.reconfigure(langExtension),
|
|
235094
|
-
tobeEffect // 계산된 데코레이션 효과를 포함
|
|
235095
|
-
]
|
|
235096
|
-
});
|
|
235077
|
+
return;
|
|
235097
235078
|
};
|
|
235098
235079
|
|
|
235099
235080
|
disconnectedCallback() {
|
package/dist/bundle.esm.js
CHANGED
|
@@ -202476,7 +202476,7 @@ function codePointSize$1(code) { return code < 0x10000 ? 1 : 2 }
|
|
|
202476
202476
|
/**
|
|
202477
202477
|
The data structure for documents. @nonabstract
|
|
202478
202478
|
*/
|
|
202479
|
-
|
|
202479
|
+
class Text {
|
|
202480
202480
|
/**
|
|
202481
202481
|
Get the line description around the given position.
|
|
202482
202482
|
*/
|
|
@@ -202600,11 +202600,11 @@ let Text$1 = class Text {
|
|
|
202600
202600
|
return Text.empty;
|
|
202601
202601
|
return text.length <= 32 /* Tree.Branch */ ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, []));
|
|
202602
202602
|
}
|
|
202603
|
-
}
|
|
202603
|
+
}
|
|
202604
202604
|
// Leaves store an array of line strings. There are always line breaks
|
|
202605
202605
|
// between these strings. Leaves are limited in size and have to be
|
|
202606
202606
|
// contained in TextNode instances for bigger documents.
|
|
202607
|
-
class TextLeaf extends Text
|
|
202607
|
+
class TextLeaf extends Text {
|
|
202608
202608
|
constructor(text, length = textLength(text)) {
|
|
202609
202609
|
super();
|
|
202610
202610
|
this.text = text;
|
|
@@ -202687,7 +202687,7 @@ class TextLeaf extends Text$1 {
|
|
|
202687
202687
|
// number of other nodes or leaves, taking care to balance themselves
|
|
202688
202688
|
// on changes. There are implied line breaks _between_ the children of
|
|
202689
202689
|
// a node (but not before the first or after the last child).
|
|
202690
|
-
class TextNode extends Text
|
|
202690
|
+
class TextNode extends Text {
|
|
202691
202691
|
constructor(children, length) {
|
|
202692
202692
|
super();
|
|
202693
202693
|
this.children = children;
|
|
@@ -202823,7 +202823,7 @@ class TextNode extends Text$1 {
|
|
|
202823
202823
|
return chunked.length == 1 ? chunked[0] : new TextNode(chunked, length);
|
|
202824
202824
|
}
|
|
202825
202825
|
}
|
|
202826
|
-
Text
|
|
202826
|
+
Text.empty = /*@__PURE__*/new TextLeaf([""], 0);
|
|
202827
202827
|
function textLength(text) {
|
|
202828
202828
|
let length = -1;
|
|
202829
202829
|
for (let line of text)
|
|
@@ -202990,7 +202990,7 @@ class LineCursor {
|
|
|
202990
202990
|
get lineBreak() { return false; }
|
|
202991
202991
|
}
|
|
202992
202992
|
if (typeof Symbol != "undefined") {
|
|
202993
|
-
Text
|
|
202993
|
+
Text.prototype[Symbol.iterator] = function () { return this.iter(); };
|
|
202994
202994
|
RawTextCursor.prototype[Symbol.iterator] = PartialTextCursor.prototype[Symbol.iterator] =
|
|
202995
202995
|
LineCursor.prototype[Symbol.iterator] = function () { return this; };
|
|
202996
202996
|
}
|
|
@@ -203314,8 +203314,8 @@ class ChangeSet extends ChangeDesc {
|
|
|
203314
203314
|
sections[i + 1] = len;
|
|
203315
203315
|
let index = i >> 1;
|
|
203316
203316
|
while (inserted.length < index)
|
|
203317
|
-
inserted.push(Text
|
|
203318
|
-
inserted.push(len ? doc.slice(pos, pos + len) : Text
|
|
203317
|
+
inserted.push(Text.empty);
|
|
203318
|
+
inserted.push(len ? doc.slice(pos, pos + len) : Text.empty);
|
|
203319
203319
|
}
|
|
203320
203320
|
pos += len;
|
|
203321
203321
|
}
|
|
@@ -203442,7 +203442,7 @@ class ChangeSet extends ChangeDesc {
|
|
|
203442
203442
|
let { from, to = from, insert } = spec;
|
|
203443
203443
|
if (from > to || from < 0 || to > length)
|
|
203444
203444
|
throw new RangeError(`Invalid change range ${from} to ${to} (in doc of length ${length})`);
|
|
203445
|
-
let insText = !insert ? Text
|
|
203445
|
+
let insText = !insert ? Text.empty : typeof insert == "string" ? Text.of(insert.split(lineSep || DefaultSplit)) : insert;
|
|
203446
203446
|
let insLen = insText.length;
|
|
203447
203447
|
if (from == to && insLen == 0)
|
|
203448
203448
|
return;
|
|
@@ -203486,8 +203486,8 @@ class ChangeSet extends ChangeDesc {
|
|
|
203486
203486
|
}
|
|
203487
203487
|
else {
|
|
203488
203488
|
while (inserted.length < i)
|
|
203489
|
-
inserted.push(Text
|
|
203490
|
-
inserted[i] = Text
|
|
203489
|
+
inserted.push(Text.empty);
|
|
203490
|
+
inserted[i] = Text.of(part.slice(1));
|
|
203491
203491
|
sections.push(part[0], inserted[i].length);
|
|
203492
203492
|
}
|
|
203493
203493
|
}
|
|
@@ -203524,7 +203524,7 @@ function addInsert(values, sections, value) {
|
|
|
203524
203524
|
}
|
|
203525
203525
|
else {
|
|
203526
203526
|
while (values.length < index)
|
|
203527
|
-
values.push(Text
|
|
203527
|
+
values.push(Text.empty);
|
|
203528
203528
|
values.push(value);
|
|
203529
203529
|
}
|
|
203530
203530
|
}
|
|
@@ -203537,7 +203537,7 @@ function iterChanges(desc, f, individual) {
|
|
|
203537
203537
|
posB += len;
|
|
203538
203538
|
}
|
|
203539
203539
|
else {
|
|
203540
|
-
let endA = posA, endB = posB, text = Text
|
|
203540
|
+
let endA = posA, endB = posB, text = Text.empty;
|
|
203541
203541
|
for (;;) {
|
|
203542
203542
|
endA += len;
|
|
203543
203543
|
endB += ins;
|
|
@@ -203693,11 +203693,11 @@ class SectionIter {
|
|
|
203693
203693
|
get len2() { return this.ins < 0 ? this.len : this.ins; }
|
|
203694
203694
|
get text() {
|
|
203695
203695
|
let { inserted } = this.set, index = (this.i - 2) >> 1;
|
|
203696
|
-
return index >= inserted.length ? Text
|
|
203696
|
+
return index >= inserted.length ? Text.empty : inserted[index];
|
|
203697
203697
|
}
|
|
203698
203698
|
textBit(len) {
|
|
203699
203699
|
let { inserted } = this.set, index = (this.i - 2) >> 1;
|
|
203700
|
-
return index >= inserted.length && !len ? Text
|
|
203700
|
+
return index >= inserted.length && !len ? Text.empty
|
|
203701
203701
|
: inserted[index].slice(this.off, len == null ? undefined : this.off + len);
|
|
203702
203702
|
}
|
|
203703
203703
|
forward(len) {
|
|
@@ -205141,7 +205141,7 @@ class EditorState {
|
|
|
205141
205141
|
[`Text`](https://codemirror.net/6/docs/ref/#state.Text) instance from the given string.
|
|
205142
205142
|
*/
|
|
205143
205143
|
toText(string) {
|
|
205144
|
-
return Text
|
|
205144
|
+
return Text.of(string.split(this.facet(EditorState.lineSeparator) || DefaultSplit));
|
|
205145
205145
|
}
|
|
205146
205146
|
/**
|
|
205147
205147
|
Return the given range of the document as a string.
|
|
@@ -205208,8 +205208,8 @@ class EditorState {
|
|
|
205208
205208
|
*/
|
|
205209
205209
|
static create(config = {}) {
|
|
205210
205210
|
let configuration = Configuration.resolve(config.extensions || [], new Map);
|
|
205211
|
-
let doc = config.doc instanceof Text
|
|
205212
|
-
: Text
|
|
205211
|
+
let doc = config.doc instanceof Text ? config.doc
|
|
205212
|
+
: Text.of((config.doc || "").split(configuration.staticFacet(EditorState.lineSeparator) || DefaultSplit));
|
|
205213
205213
|
let selection = !config.selection ? EditorSelection.single(0)
|
|
205214
205214
|
: config.selection instanceof EditorSelection ? config.selection
|
|
205215
205215
|
: EditorSelection.single(config.selection.anchor, config.selection.head);
|
|
@@ -207621,12 +207621,12 @@ class WidgetView extends ContentView {
|
|
|
207621
207621
|
ignoreEvent(event) { return this.widget.ignoreEvent(event); }
|
|
207622
207622
|
get overrideDOMText() {
|
|
207623
207623
|
if (this.length == 0)
|
|
207624
|
-
return Text
|
|
207624
|
+
return Text.empty;
|
|
207625
207625
|
let top = this;
|
|
207626
207626
|
while (top.parent)
|
|
207627
207627
|
top = top.parent;
|
|
207628
207628
|
let { view } = top, text = view && view.state.doc, start = this.posAtStart;
|
|
207629
|
-
return text ? text.slice(start, start + this.length) : Text
|
|
207629
|
+
return text ? text.slice(start, start + this.length) : Text.empty;
|
|
207630
207630
|
}
|
|
207631
207631
|
domAtPos(pos) {
|
|
207632
207632
|
return (this.length ? pos == 0 : this.side > 0)
|
|
@@ -207688,7 +207688,7 @@ class WidgetBufferView extends ContentView {
|
|
|
207688
207688
|
return this.dom.getBoundingClientRect();
|
|
207689
207689
|
}
|
|
207690
207690
|
get overrideDOMText() {
|
|
207691
|
-
return Text
|
|
207691
|
+
return Text.empty;
|
|
207692
207692
|
}
|
|
207693
207693
|
get isHidden() { return true; }
|
|
207694
207694
|
}
|
|
@@ -208312,7 +208312,7 @@ class BlockWidgetView extends ContentView {
|
|
|
208312
208312
|
}
|
|
208313
208313
|
}
|
|
208314
208314
|
get overrideDOMText() {
|
|
208315
|
-
return this.parent ? this.parent.view.state.doc.slice(this.posAtStart, this.posAtEnd) : Text
|
|
208315
|
+
return this.parent ? this.parent.view.state.doc.slice(this.posAtStart, this.posAtEnd) : Text.empty;
|
|
208316
208316
|
}
|
|
208317
208317
|
domBoundsAround() { return null; }
|
|
208318
208318
|
become(other) {
|
|
@@ -210652,7 +210652,7 @@ function applyDOMChange(view, domChange) {
|
|
|
210652
210652
|
diff.toB == diff.from + 2 && domChange.text.slice(diff.from, diff.toB) == LineBreakPlaceholder + LineBreakPlaceholder)
|
|
210653
210653
|
diff.toB--;
|
|
210654
210654
|
change = { from: from + diff.from, to: from + diff.toA,
|
|
210655
|
-
insert: Text
|
|
210655
|
+
insert: Text.of(domChange.text.slice(diff.from, diff.toB).split(LineBreakPlaceholder)) };
|
|
210656
210656
|
}
|
|
210657
210657
|
}
|
|
210658
210658
|
else if (newSel && (!view.hasFocus && view.state.facet(editable) || newSel.main.eq(sel))) {
|
|
@@ -210670,7 +210670,7 @@ function applyDOMChange(view, domChange) {
|
|
|
210670
210670
|
// and transform it into a regular space insert.
|
|
210671
210671
|
if (newSel && change.insert.length == 2)
|
|
210672
210672
|
newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
|
|
210673
|
-
change = { from: change.from, to: change.to, insert: Text
|
|
210673
|
+
change = { from: change.from, to: change.to, insert: Text.of([change.insert.toString().replace(".", " ")]) };
|
|
210674
210674
|
}
|
|
210675
210675
|
else if (change && change.from >= sel.from && change.to <= sel.to &&
|
|
210676
210676
|
(change.from != sel.from || change.to != sel.to) &&
|
|
@@ -210690,7 +210690,7 @@ function applyDOMChange(view, domChange) {
|
|
|
210690
210690
|
// bogus new line to be created in CodeMirror (#968)
|
|
210691
210691
|
if (newSel)
|
|
210692
210692
|
newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
|
|
210693
|
-
change = { from: sel.from, to: sel.to, insert: Text
|
|
210693
|
+
change = { from: sel.from, to: sel.to, insert: Text.of([" "]) };
|
|
210694
210694
|
}
|
|
210695
210695
|
if (change) {
|
|
210696
210696
|
return applyDOMChangeInner(view, change, newSel, lastKey);
|
|
@@ -211743,7 +211743,7 @@ function clearHeightChangeFlag() { heightChangeFlag = false; }
|
|
|
211743
211743
|
class HeightOracle {
|
|
211744
211744
|
constructor(lineWrapping) {
|
|
211745
211745
|
this.lineWrapping = lineWrapping;
|
|
211746
|
-
this.doc = Text
|
|
211746
|
+
this.doc = Text.empty;
|
|
211747
211747
|
this.heightSamples = {};
|
|
211748
211748
|
this.lineHeight = 14; // The height of an entire line (line-height)
|
|
211749
211749
|
this.charWidth = 7;
|
|
@@ -212590,7 +212590,7 @@ class ViewState {
|
|
|
212590
212590
|
let guessWrapping = state.facet(contentAttributes).some(v => typeof v != "function" && v.class == "cm-lineWrapping");
|
|
212591
212591
|
this.heightOracle = new HeightOracle(guessWrapping);
|
|
212592
212592
|
this.stateDeco = state.facet(decorations).filter(d => typeof d != "function");
|
|
212593
|
-
this.heightMap = HeightMap.empty().applyChanges(this.stateDeco, Text
|
|
212593
|
+
this.heightMap = HeightMap.empty().applyChanges(this.stateDeco, Text.empty, this.heightOracle.setDoc(state.doc), [new ChangedRange(0, 0, 0, state.doc.length)]);
|
|
212594
212594
|
for (let i = 0; i < 2; i++) {
|
|
212595
212595
|
this.viewport = this.getViewport(0, null);
|
|
212596
212596
|
if (!this.updateForViewport())
|
|
@@ -212742,7 +212742,7 @@ class ViewState {
|
|
|
212742
212742
|
clearHeightChangeFlag();
|
|
212743
212743
|
for (let vp of this.viewports) {
|
|
212744
212744
|
let heights = vp.from == this.viewport.from ? lineHeights : view.docView.measureVisibleLineHeights(vp);
|
|
212745
|
-
this.heightMap = (refresh ? HeightMap.empty().applyChanges(this.stateDeco, Text
|
|
212745
|
+
this.heightMap = (refresh ? HeightMap.empty().applyChanges(this.stateDeco, Text.empty, this.heightOracle, [new ChangedRange(0, 0, 0, view.state.doc.length)]) : this.heightMap).updateHeight(oracle, 0, refresh, new MeasuredHeights(vp.from, heights));
|
|
212746
212746
|
}
|
|
212747
212747
|
if (heightChangeFlag)
|
|
212748
212748
|
result |= 2 /* UpdateFlag.Height */;
|
|
@@ -213928,7 +213928,7 @@ class EditContextManager {
|
|
|
213928
213928
|
let from = this.toEditorPos(e.updateRangeStart), to = this.toEditorPos(e.updateRangeEnd);
|
|
213929
213929
|
if (view.inputState.composing >= 0 && !this.composing)
|
|
213930
213930
|
this.composing = { contextBase: e.updateRangeStart, editorBase: from, drifted: false };
|
|
213931
|
-
let change = { from, to, insert: Text
|
|
213931
|
+
let change = { from, to, insert: Text.of(e.text.split("\n")) };
|
|
213932
213932
|
// If the window doesn't include the anchor, assume changes
|
|
213933
213933
|
// adjacent to a side go up to the anchor.
|
|
213934
213934
|
if (change.from == this.from && anchor < this.from)
|
|
@@ -213944,7 +213944,7 @@ class EditContextManager {
|
|
|
213944
213944
|
}
|
|
213945
213945
|
if ((browser.mac || browser.android) && change.from == head - 1 &&
|
|
213946
213946
|
/^\. ?$/.test(e.text) && view.contentDOM.getAttribute("autocorrect") == "off")
|
|
213947
|
-
change = { from, to, insert: Text
|
|
213947
|
+
change = { from, to, insert: Text.of([e.text.replace(".", " ")]) };
|
|
213948
213948
|
this.pendingContextChange = change;
|
|
213949
213949
|
if (!view.state.readOnly) {
|
|
213950
213950
|
let newLen = this.to - this.from + (change.to - change.from + change.insert.length);
|
|
@@ -223076,7 +223076,7 @@ const splitLine = ({ state, dispatch }) => {
|
|
|
223076
223076
|
if (state.readOnly)
|
|
223077
223077
|
return false;
|
|
223078
223078
|
let changes = state.changeByRange(range => {
|
|
223079
|
-
return { changes: { from: range.from, to: range.to, insert: Text
|
|
223079
|
+
return { changes: { from: range.from, to: range.to, insert: Text.of(["", ""]) },
|
|
223080
223080
|
range: EditorSelection.cursor(range.from) };
|
|
223081
223081
|
});
|
|
223082
223082
|
dispatch(state.update(changes, { scrollIntoView: true, userEvent: "input" }));
|
|
@@ -223250,7 +223250,7 @@ function newlineAndIndent(atEof) {
|
|
|
223250
223250
|
let insert = ["", indentString(state, indent)];
|
|
223251
223251
|
if (explode)
|
|
223252
223252
|
insert.push(indentString(state, cx.lineIndent(line.from, -1)));
|
|
223253
|
-
return { changes: { from, to, insert: Text
|
|
223253
|
+
return { changes: { from, to, insert: Text.of(insert) },
|
|
223254
223254
|
range: EditorSelection.cursor(from + 1 + insert[1].length) };
|
|
223255
223255
|
});
|
|
223256
223256
|
dispatch(state.update(changes, { scrollIntoView: true, userEvent: "input" }));
|
|
@@ -229927,7 +229927,7 @@ function snippet(template) {
|
|
|
229927
229927
|
let { text, ranges } = snippet.instantiate(editor.state, from);
|
|
229928
229928
|
let { main } = editor.state.selection;
|
|
229929
229929
|
let spec = {
|
|
229930
|
-
changes: { from, to: to == main.from ? main.to : to, insert: Text
|
|
229930
|
+
changes: { from, to: to == main.from ? main.to : to, insert: Text.of(text) },
|
|
229931
229931
|
scrollIntoView: true,
|
|
229932
229932
|
annotations: completion ? [pickedCompletion.of(completion), Transaction.userEvent.of("input.complete")] : undefined
|
|
229933
229933
|
};
|
|
@@ -235060,36 +235060,17 @@ class IdeDiff extends HTMLElement {
|
|
|
235060
235060
|
console.warn('CodeMirror Editors not initialized yet.');
|
|
235061
235061
|
return;
|
|
235062
235062
|
}
|
|
235063
|
-
|
|
235064
|
-
let langExtension;
|
|
235065
235063
|
switch(language) {
|
|
235066
235064
|
case 'javascript':
|
|
235067
|
-
|
|
235065
|
+
javascript();
|
|
235068
235066
|
break;
|
|
235069
235067
|
default:
|
|
235070
|
-
|
|
235068
|
+
javascript();
|
|
235071
235069
|
}
|
|
235072
235070
|
|
|
235073
235071
|
// 먼저 데코레이션 효과를 계산하여 가져옵니다.
|
|
235074
235072
|
const { asisEffect, tobeEffect } = this.#applyDiffDecorations(src1, src2);
|
|
235075
|
-
|
|
235076
|
-
// asis 에디터의 텍스트 변경 및 데코레이션 효과를 단일 트랜잭션으로 디스패치합니다.
|
|
235077
|
-
this.#asisEditorView.dispatch({
|
|
235078
|
-
changes: { from: 0, to: this.#asisEditorView.state.doc.length, insert: src1 },
|
|
235079
|
-
effects: [
|
|
235080
|
-
this.#languageCompartment.reconfigure(langExtension),
|
|
235081
|
-
asisEffect // 계산된 데코레이션 효과를 포함
|
|
235082
|
-
]
|
|
235083
|
-
});
|
|
235084
|
-
|
|
235085
|
-
// tobe 에디터의 텍스트 변경 및 데코레이션 효과를 단일 트랜잭션으로 디스패치합니다.
|
|
235086
|
-
this.#tobeEditorView.dispatch({
|
|
235087
|
-
changes: { from: 0, to: this.#tobeEditorView.state.doc.length, insert: src2 },
|
|
235088
|
-
effects: [
|
|
235089
|
-
this.#languageCompartment.reconfigure(langExtension),
|
|
235090
|
-
tobeEffect // 계산된 데코레이션 효과를 포함
|
|
235091
|
-
]
|
|
235092
|
-
});
|
|
235073
|
+
return;
|
|
235093
235074
|
};
|
|
235094
235075
|
|
|
235095
235076
|
disconnectedCallback() {
|
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
EditorState, Compartment, StateField,
|
|
11
11
|
RangeSetBuilder,
|
|
12
|
-
StateEffect
|
|
12
|
+
StateEffect,
|
|
13
|
+
Text
|
|
13
14
|
} from "@codemirror/state";
|
|
14
15
|
import { history, historyKeymap, indentWithTab } from "@codemirror/commands";
|
|
15
16
|
import { defaultKeymap, selectAll } from "@codemirror/commands";
|
|
@@ -349,6 +350,7 @@ export class IdeDiff extends HTMLElement {
|
|
|
349
350
|
|
|
350
351
|
// 먼저 데코레이션 효과를 계산하여 가져옵니다.
|
|
351
352
|
const { asisEffect, tobeEffect } = this.#applyDiffDecorations(src1, src2);
|
|
353
|
+
return;
|
|
352
354
|
|
|
353
355
|
// asis 에디터의 텍스트 변경 및 데코레이션 효과를 단일 트랜잭션으로 디스패치합니다.
|
|
354
356
|
this.#asisEditorView.dispatch({
|
package/package.json
CHANGED
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
EditorState, Compartment, StateField,
|
|
11
11
|
RangeSetBuilder,
|
|
12
|
-
StateEffect
|
|
12
|
+
StateEffect,
|
|
13
|
+
Text
|
|
13
14
|
} from "@codemirror/state";
|
|
14
15
|
import { history, historyKeymap, indentWithTab } from "@codemirror/commands";
|
|
15
16
|
import { defaultKeymap, selectAll } from "@codemirror/commands";
|
|
@@ -349,6 +350,7 @@ export class IdeDiff extends HTMLElement {
|
|
|
349
350
|
|
|
350
351
|
// 먼저 데코레이션 효과를 계산하여 가져옵니다.
|
|
351
352
|
const { asisEffect, tobeEffect } = this.#applyDiffDecorations(src1, src2);
|
|
353
|
+
return;
|
|
352
354
|
|
|
353
355
|
// asis 에디터의 텍스트 변경 및 데코레이션 효과를 단일 트랜잭션으로 디스패치합니다.
|
|
354
356
|
this.#asisEditorView.dispatch({
|