@nine-lab/nine-mu 0.1.133 → 0.1.134
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/nine-mu.js +284 -284
- package/dist/nine-mu.js.map +1 -1
- package/dist/nine-mu.umd.js +1 -1
- package/dist/nine-mu.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/NineChat.js +2 -2
package/dist/nine-mu.js
CHANGED
|
@@ -31,7 +31,7 @@ class NineMuService {
|
|
|
31
31
|
* @param {Array} targets - 체크된 생성 대상 (MyBatis, Service 등)
|
|
32
32
|
* @param {Array} currentRoutes - 현재 프로젝트 경로 정보
|
|
33
33
|
*/
|
|
34
|
-
async generate(command2, targets,
|
|
34
|
+
async generate(command2, targets, currentRoutes) {
|
|
35
35
|
try {
|
|
36
36
|
trace.log(`공정 시작: "${command2}" [대상: ${targets.join(", ")}]`);
|
|
37
37
|
const response = await fetch(`${this.connectorUrl}/api/mu/generate`, {
|
|
@@ -41,7 +41,7 @@ class NineMuService {
|
|
|
41
41
|
command: command2,
|
|
42
42
|
targets,
|
|
43
43
|
projectType: "spring-react",
|
|
44
|
-
currentRoutes
|
|
44
|
+
currentRoutes
|
|
45
45
|
})
|
|
46
46
|
});
|
|
47
47
|
const result = await response.json();
|
|
@@ -56,7 +56,7 @@ class NineMuService {
|
|
|
56
56
|
}
|
|
57
57
|
async generateAll(command2) {
|
|
58
58
|
}
|
|
59
|
-
async generateAll_BAK(command2, targets,
|
|
59
|
+
async generateAll_BAK(command2, targets, currentRoutes) {
|
|
60
60
|
try {
|
|
61
61
|
trace.log(`공정 시작: "${command2}" [대상: ${targets.join(", ")}]`);
|
|
62
62
|
const srcPath = __privateGet(this, _getSourcePath).call(this, "/admin/payment/order-list");
|
|
@@ -10329,7 +10329,7 @@ function requireCore$1() {
|
|
|
10329
10329
|
errorsText(errors2 = this.errors, { separator = ", ", dataVar = "data" } = {}) {
|
|
10330
10330
|
if (!errors2 || errors2.length === 0)
|
|
10331
10331
|
return "No errors";
|
|
10332
|
-
return errors2.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((
|
|
10332
|
+
return errors2.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text, msg) => text + separator + msg);
|
|
10333
10333
|
}
|
|
10334
10334
|
$dataMetaSchema(metaSchema, keywordsJsonPointers) {
|
|
10335
10335
|
const rules2 = this.RULES.all;
|
|
@@ -13702,8 +13702,8 @@ initActions_fn = function() {
|
|
|
13702
13702
|
const response = await __privateGet(this, _mcpClient).callTool({
|
|
13703
13703
|
name: "ask_nine_engine",
|
|
13704
13704
|
arguments: {
|
|
13705
|
-
prompt:
|
|
13706
|
-
routes:
|
|
13705
|
+
prompt: userInput,
|
|
13706
|
+
routes: []
|
|
13707
13707
|
// 현재 화면의 메뉴 정보
|
|
13708
13708
|
}
|
|
13709
13709
|
});
|
|
@@ -13719,7 +13719,7 @@ render_fn = function() {
|
|
|
13719
13719
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
13720
13720
|
this.shadowRoot.innerHTML = `
|
|
13721
13721
|
<style>
|
|
13722
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
13722
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.133"}/dist/css/nine-mu.css";
|
|
13723
13723
|
${customImport}
|
|
13724
13724
|
</style>
|
|
13725
13725
|
<div class="wrapper">
|
|
@@ -13854,7 +13854,7 @@ class Text {
|
|
|
13854
13854
|
/**
|
|
13855
13855
|
Replace a range of the text with the given content.
|
|
13856
13856
|
*/
|
|
13857
|
-
replace(from, to,
|
|
13857
|
+
replace(from, to, text) {
|
|
13858
13858
|
[from, to] = clip(this, from, to);
|
|
13859
13859
|
let parts = [];
|
|
13860
13860
|
this.decompose(
|
|
@@ -13864,10 +13864,10 @@ class Text {
|
|
|
13864
13864
|
2
|
|
13865
13865
|
/* Open.To */
|
|
13866
13866
|
);
|
|
13867
|
-
if (
|
|
13868
|
-
|
|
13867
|
+
if (text.length)
|
|
13868
|
+
text.decompose(
|
|
13869
13869
|
0,
|
|
13870
|
-
|
|
13870
|
+
text.length,
|
|
13871
13871
|
parts,
|
|
13872
13872
|
1 | 2
|
|
13873
13873
|
/* Open.To */
|
|
@@ -13879,7 +13879,7 @@ class Text {
|
|
|
13879
13879
|
1
|
|
13880
13880
|
/* Open.From */
|
|
13881
13881
|
);
|
|
13882
|
-
return TextNode.from(parts, this.length - (to - from) +
|
|
13882
|
+
return TextNode.from(parts, this.length - (to - from) + text.length);
|
|
13883
13883
|
}
|
|
13884
13884
|
/**
|
|
13885
13885
|
Append another document to this one.
|
|
@@ -13975,18 +13975,18 @@ class Text {
|
|
|
13975
13975
|
/**
|
|
13976
13976
|
Create a `Text` instance for the given array of lines.
|
|
13977
13977
|
*/
|
|
13978
|
-
static of(
|
|
13979
|
-
if (
|
|
13978
|
+
static of(text) {
|
|
13979
|
+
if (text.length == 0)
|
|
13980
13980
|
throw new RangeError("A document must have at least one line");
|
|
13981
|
-
if (
|
|
13981
|
+
if (text.length == 1 && !text[0])
|
|
13982
13982
|
return Text.empty;
|
|
13983
|
-
return
|
|
13983
|
+
return text.length <= 32 ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, []));
|
|
13984
13984
|
}
|
|
13985
13985
|
}
|
|
13986
13986
|
class TextLeaf extends Text {
|
|
13987
|
-
constructor(
|
|
13987
|
+
constructor(text, length = textLength(text)) {
|
|
13988
13988
|
super();
|
|
13989
|
-
this.text =
|
|
13989
|
+
this.text = text;
|
|
13990
13990
|
this.length = length;
|
|
13991
13991
|
}
|
|
13992
13992
|
get lines() {
|
|
@@ -14005,26 +14005,26 @@ class TextLeaf extends Text {
|
|
|
14005
14005
|
}
|
|
14006
14006
|
}
|
|
14007
14007
|
decompose(from, to, target, open) {
|
|
14008
|
-
let
|
|
14008
|
+
let text = from <= 0 && to >= this.length ? this : new TextLeaf(sliceText(this.text, from, to), Math.min(to, this.length) - Math.max(0, from));
|
|
14009
14009
|
if (open & 1) {
|
|
14010
14010
|
let prev = target.pop();
|
|
14011
|
-
let joined = appendText(
|
|
14011
|
+
let joined = appendText(text.text, prev.text.slice(), 0, text.length);
|
|
14012
14012
|
if (joined.length <= 32) {
|
|
14013
|
-
target.push(new TextLeaf(joined, prev.length +
|
|
14013
|
+
target.push(new TextLeaf(joined, prev.length + text.length));
|
|
14014
14014
|
} else {
|
|
14015
14015
|
let mid = joined.length >> 1;
|
|
14016
14016
|
target.push(new TextLeaf(joined.slice(0, mid)), new TextLeaf(joined.slice(mid)));
|
|
14017
14017
|
}
|
|
14018
14018
|
} else {
|
|
14019
|
-
target.push(
|
|
14019
|
+
target.push(text);
|
|
14020
14020
|
}
|
|
14021
14021
|
}
|
|
14022
|
-
replace(from, to,
|
|
14023
|
-
if (!(
|
|
14024
|
-
return super.replace(from, to,
|
|
14022
|
+
replace(from, to, text) {
|
|
14023
|
+
if (!(text instanceof TextLeaf))
|
|
14024
|
+
return super.replace(from, to, text);
|
|
14025
14025
|
[from, to] = clip(this, from, to);
|
|
14026
|
-
let lines = appendText(this.text, appendText(
|
|
14027
|
-
let newLen = this.length +
|
|
14026
|
+
let lines = appendText(this.text, appendText(text.text, sliceText(this.text, 0, from)), to);
|
|
14027
|
+
let newLen = this.length + text.length - (to - from);
|
|
14028
14028
|
if (lines.length <= 32)
|
|
14029
14029
|
return new TextLeaf(lines, newLen);
|
|
14030
14030
|
return TextNode.from(TextLeaf.split(lines, []), newLen);
|
|
@@ -14049,9 +14049,9 @@ class TextLeaf extends Text {
|
|
|
14049
14049
|
scanIdentical() {
|
|
14050
14050
|
return 0;
|
|
14051
14051
|
}
|
|
14052
|
-
static split(
|
|
14052
|
+
static split(text, target) {
|
|
14053
14053
|
let part = [], len = -1;
|
|
14054
|
-
for (let line of
|
|
14054
|
+
for (let line of text) {
|
|
14055
14055
|
part.push(line);
|
|
14056
14056
|
len += line.length + 1;
|
|
14057
14057
|
if (part.length == 32) {
|
|
@@ -14096,24 +14096,24 @@ class TextNode extends Text {
|
|
|
14096
14096
|
pos = end + 1;
|
|
14097
14097
|
}
|
|
14098
14098
|
}
|
|
14099
|
-
replace(from, to,
|
|
14099
|
+
replace(from, to, text) {
|
|
14100
14100
|
[from, to] = clip(this, from, to);
|
|
14101
|
-
if (
|
|
14101
|
+
if (text.lines < this.lines)
|
|
14102
14102
|
for (let i = 0, pos = 0; i < this.children.length; i++) {
|
|
14103
14103
|
let child = this.children[i], end = pos + child.length;
|
|
14104
14104
|
if (from >= pos && to <= end) {
|
|
14105
|
-
let updated = child.replace(from - pos, to - pos,
|
|
14105
|
+
let updated = child.replace(from - pos, to - pos, text);
|
|
14106
14106
|
let totalLines = this.lines - child.lines + updated.lines;
|
|
14107
14107
|
if (updated.lines < totalLines >> 5 - 1 && updated.lines > totalLines >> 5 + 1) {
|
|
14108
14108
|
let copy = this.children.slice();
|
|
14109
14109
|
copy[i] = updated;
|
|
14110
|
-
return new TextNode(copy, this.length - (to - from) +
|
|
14110
|
+
return new TextNode(copy, this.length - (to - from) + text.length);
|
|
14111
14111
|
}
|
|
14112
14112
|
return super.replace(pos, end, updated);
|
|
14113
14113
|
}
|
|
14114
14114
|
pos = end + 1;
|
|
14115
14115
|
}
|
|
14116
|
-
return super.replace(from, to,
|
|
14116
|
+
return super.replace(from, to, text);
|
|
14117
14117
|
}
|
|
14118
14118
|
sliceString(from, to = this.length, lineSep = "\n") {
|
|
14119
14119
|
[from, to] = clip(this, from, to);
|
|
@@ -14196,15 +14196,15 @@ class TextNode extends Text {
|
|
|
14196
14196
|
}
|
|
14197
14197
|
}
|
|
14198
14198
|
Text.empty = /* @__PURE__ */ new TextLeaf([""], 0);
|
|
14199
|
-
function textLength(
|
|
14199
|
+
function textLength(text) {
|
|
14200
14200
|
let length = -1;
|
|
14201
|
-
for (let line of
|
|
14201
|
+
for (let line of text)
|
|
14202
14202
|
length += line.length + 1;
|
|
14203
14203
|
return length;
|
|
14204
14204
|
}
|
|
14205
|
-
function appendText(
|
|
14206
|
-
for (let pos = 0, i = 0, first = true; i <
|
|
14207
|
-
let line =
|
|
14205
|
+
function appendText(text, target, from = 0, to = 1e9) {
|
|
14206
|
+
for (let pos = 0, i = 0, first = true; i < text.length && pos <= to; i++) {
|
|
14207
|
+
let line = text[i], end = pos + line.length;
|
|
14208
14208
|
if (end >= from) {
|
|
14209
14209
|
if (end > to)
|
|
14210
14210
|
line = line.slice(0, to - pos);
|
|
@@ -14220,17 +14220,17 @@ function appendText(text2, target, from = 0, to = 1e9) {
|
|
|
14220
14220
|
}
|
|
14221
14221
|
return target;
|
|
14222
14222
|
}
|
|
14223
|
-
function sliceText(
|
|
14224
|
-
return appendText(
|
|
14223
|
+
function sliceText(text, from, to) {
|
|
14224
|
+
return appendText(text, [""], from, to);
|
|
14225
14225
|
}
|
|
14226
14226
|
class RawTextCursor {
|
|
14227
|
-
constructor(
|
|
14227
|
+
constructor(text, dir = 1) {
|
|
14228
14228
|
this.dir = dir;
|
|
14229
14229
|
this.done = false;
|
|
14230
14230
|
this.lineBreak = false;
|
|
14231
14231
|
this.value = "";
|
|
14232
|
-
this.nodes = [
|
|
14233
|
-
this.offsets = [dir > 0 ? 1 : (
|
|
14232
|
+
this.nodes = [text];
|
|
14233
|
+
this.offsets = [dir > 0 ? 1 : (text instanceof TextLeaf ? text.text.length : text.children.length) << 1];
|
|
14234
14234
|
}
|
|
14235
14235
|
nextInner(skip, dir) {
|
|
14236
14236
|
this.done = this.lineBreak = false;
|
|
@@ -14287,11 +14287,11 @@ class RawTextCursor {
|
|
|
14287
14287
|
}
|
|
14288
14288
|
}
|
|
14289
14289
|
class PartialTextCursor {
|
|
14290
|
-
constructor(
|
|
14290
|
+
constructor(text, start, end) {
|
|
14291
14291
|
this.value = "";
|
|
14292
14292
|
this.done = false;
|
|
14293
|
-
this.cursor = new RawTextCursor(
|
|
14294
|
-
this.pos = start > end ?
|
|
14293
|
+
this.cursor = new RawTextCursor(text, start > end ? -1 : 1);
|
|
14294
|
+
this.pos = start > end ? text.length : 0;
|
|
14295
14295
|
this.from = Math.min(start, end);
|
|
14296
14296
|
this.to = Math.max(start, end);
|
|
14297
14297
|
}
|
|
@@ -14367,11 +14367,11 @@ class Line {
|
|
|
14367
14367
|
/**
|
|
14368
14368
|
@internal
|
|
14369
14369
|
*/
|
|
14370
|
-
constructor(from, to, number2,
|
|
14370
|
+
constructor(from, to, number2, text) {
|
|
14371
14371
|
this.from = from;
|
|
14372
14372
|
this.to = to;
|
|
14373
14373
|
this.number = number2;
|
|
14374
|
-
this.text =
|
|
14374
|
+
this.text = text;
|
|
14375
14375
|
}
|
|
14376
14376
|
/**
|
|
14377
14377
|
The length of the line (not including any line break after it).
|
|
@@ -14380,9 +14380,9 @@ class Line {
|
|
|
14380
14380
|
return this.to - this.from;
|
|
14381
14381
|
}
|
|
14382
14382
|
}
|
|
14383
|
-
function clip(
|
|
14384
|
-
from = Math.max(0, Math.min(
|
|
14385
|
-
return [from, Math.max(from, Math.min(
|
|
14383
|
+
function clip(text, from, to) {
|
|
14384
|
+
from = Math.max(0, Math.min(text.length, from));
|
|
14385
|
+
return [from, Math.max(from, Math.min(text.length, to))];
|
|
14386
14386
|
}
|
|
14387
14387
|
function findClusterBreak(str, pos, forward = true, includeExtending = true) {
|
|
14388
14388
|
return findClusterBreak$1(str, pos, forward, includeExtending);
|
|
@@ -14600,7 +14600,7 @@ class ChangeSet extends ChangeDesc {
|
|
|
14600
14600
|
apply(doc2) {
|
|
14601
14601
|
if (this.length != doc2.length)
|
|
14602
14602
|
throw new RangeError("Applying change set to a document with the wrong length");
|
|
14603
|
-
iterChanges(this, (fromA, toA, fromB, _toB,
|
|
14603
|
+
iterChanges(this, (fromA, toA, fromB, _toB, text) => doc2 = doc2.replace(fromB, fromB + (toA - fromA), text), false);
|
|
14604
14604
|
return doc2;
|
|
14605
14605
|
}
|
|
14606
14606
|
mapDesc(other, before = false) {
|
|
@@ -14844,18 +14844,18 @@ function iterChanges(desc, f, individual) {
|
|
|
14844
14844
|
posA += len;
|
|
14845
14845
|
posB += len;
|
|
14846
14846
|
} else {
|
|
14847
|
-
let endA = posA, endB = posB,
|
|
14847
|
+
let endA = posA, endB = posB, text = Text.empty;
|
|
14848
14848
|
for (; ; ) {
|
|
14849
14849
|
endA += len;
|
|
14850
14850
|
endB += ins;
|
|
14851
14851
|
if (ins && inserted)
|
|
14852
|
-
|
|
14852
|
+
text = text.append(inserted[i - 2 >> 1]);
|
|
14853
14853
|
if (individual || i == desc.sections.length || desc.sections[i + 1] < 0)
|
|
14854
14854
|
break;
|
|
14855
14855
|
len = desc.sections[i++];
|
|
14856
14856
|
ins = desc.sections[i++];
|
|
14857
14857
|
}
|
|
14858
|
-
f(posA, endA, posB, endB,
|
|
14858
|
+
f(posA, endA, posB, endB, text);
|
|
14859
14859
|
posA = endA;
|
|
14860
14860
|
posB = endB;
|
|
14861
14861
|
}
|
|
@@ -16110,12 +16110,12 @@ class EditorState {
|
|
|
16110
16110
|
Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that
|
|
16111
16111
|
replaces every selection range with the given content.
|
|
16112
16112
|
*/
|
|
16113
|
-
replaceSelection(
|
|
16114
|
-
if (typeof
|
|
16115
|
-
|
|
16113
|
+
replaceSelection(text) {
|
|
16114
|
+
if (typeof text == "string")
|
|
16115
|
+
text = this.toText(text);
|
|
16116
16116
|
return this.changeByRange((range) => ({
|
|
16117
|
-
changes: { from: range.from, to: range.to, insert:
|
|
16118
|
-
range: EditorSelection.cursor(range.from +
|
|
16117
|
+
changes: { from: range.from, to: range.to, insert: text },
|
|
16118
|
+
range: EditorSelection.cursor(range.from + text.length)
|
|
16119
16119
|
}));
|
|
16120
16120
|
}
|
|
16121
16121
|
/**
|
|
@@ -16334,18 +16334,18 @@ class EditorState {
|
|
|
16334
16334
|
this returns null.
|
|
16335
16335
|
*/
|
|
16336
16336
|
wordAt(pos) {
|
|
16337
|
-
let { text
|
|
16337
|
+
let { text, from, length } = this.doc.lineAt(pos);
|
|
16338
16338
|
let cat = this.charCategorizer(pos);
|
|
16339
16339
|
let start = pos - from, end = pos - from;
|
|
16340
16340
|
while (start > 0) {
|
|
16341
|
-
let prev = findClusterBreak(
|
|
16342
|
-
if (cat(
|
|
16341
|
+
let prev = findClusterBreak(text, start, false);
|
|
16342
|
+
if (cat(text.slice(prev, start)) != CharCategory.Word)
|
|
16343
16343
|
break;
|
|
16344
16344
|
start = prev;
|
|
16345
16345
|
}
|
|
16346
16346
|
while (end < length) {
|
|
16347
|
-
let next = findClusterBreak(
|
|
16348
|
-
if (cat(
|
|
16347
|
+
let next = findClusterBreak(text, end);
|
|
16348
|
+
if (cat(text.slice(end, next)) != CharCategory.Word)
|
|
16349
16349
|
break;
|
|
16350
16350
|
end = next;
|
|
16351
16351
|
}
|
|
@@ -17300,10 +17300,10 @@ class StyleSet {
|
|
|
17300
17300
|
if (root.adoptedStyleSheets.indexOf(this.sheet) < 0)
|
|
17301
17301
|
root.adoptedStyleSheets = [this.sheet, ...root.adoptedStyleSheets];
|
|
17302
17302
|
} else {
|
|
17303
|
-
let
|
|
17303
|
+
let text = "";
|
|
17304
17304
|
for (let i = 0; i < this.modules.length; i++)
|
|
17305
|
-
|
|
17306
|
-
this.styleTag.textContent =
|
|
17305
|
+
text += this.modules[i].getRules() + "\n";
|
|
17306
|
+
this.styleTag.textContent = text;
|
|
17307
17307
|
let target = root.head || root;
|
|
17308
17308
|
if (this.styleTag.parentNode != target)
|
|
17309
17309
|
target.insertBefore(this.styleTag, target.firstChild);
|
|
@@ -18529,9 +18529,9 @@ function moveVisually(line, order, dir, start, forward) {
|
|
|
18529
18529
|
return EditorSelection.cursor(nextSpan.side(!forward, dir) + line.from, nextSpan.forward(forward, dir) ? 1 : -1, nextSpan.level);
|
|
18530
18530
|
return EditorSelection.cursor(nextIndex + line.from, span.forward(forward, dir) ? -1 : 1, span.level);
|
|
18531
18531
|
}
|
|
18532
|
-
function autoDirection(
|
|
18532
|
+
function autoDirection(text, from, to) {
|
|
18533
18533
|
for (let i = from; i < to; i++) {
|
|
18534
|
-
let type2 = charType(
|
|
18534
|
+
let type2 = charType(text.charCodeAt(i));
|
|
18535
18535
|
if (type2 == 1)
|
|
18536
18536
|
return LTR;
|
|
18537
18537
|
if (type2 == 2 || type2 == 4)
|
|
@@ -19234,9 +19234,9 @@ class MarkTile extends CompositeTile {
|
|
|
19234
19234
|
}
|
|
19235
19235
|
}
|
|
19236
19236
|
class TextTile extends Tile {
|
|
19237
|
-
constructor(dom,
|
|
19238
|
-
super(dom,
|
|
19239
|
-
this.text =
|
|
19237
|
+
constructor(dom, text) {
|
|
19238
|
+
super(dom, text.length);
|
|
19239
|
+
this.text = text;
|
|
19240
19240
|
}
|
|
19241
19241
|
sync(track) {
|
|
19242
19242
|
if (this.flags & 2)
|
|
@@ -19283,8 +19283,8 @@ class TextTile extends Tile {
|
|
|
19283
19283
|
rect = Array.prototype.find.call(rects, (r) => r.width) || rect;
|
|
19284
19284
|
return flatten2 ? flattenRect(rect, flatten2 < 0) : rect || null;
|
|
19285
19285
|
}
|
|
19286
|
-
static of(
|
|
19287
|
-
let tile = new TextTile(dom || document.createTextNode(
|
|
19286
|
+
static of(text, dom) {
|
|
19287
|
+
let tile = new TextTile(dom || document.createTextNode(text), text);
|
|
19288
19288
|
if (!dom)
|
|
19289
19289
|
tile.flags |= 2;
|
|
19290
19290
|
return tile;
|
|
@@ -19454,23 +19454,23 @@ class TileBuilder {
|
|
|
19454
19454
|
this.wrappers = [];
|
|
19455
19455
|
this.wrapperPos = 0;
|
|
19456
19456
|
}
|
|
19457
|
-
addText(
|
|
19457
|
+
addText(text, marks, openStart, tile) {
|
|
19458
19458
|
var _a2;
|
|
19459
19459
|
this.flushBuffer();
|
|
19460
19460
|
let parent = this.ensureMarks(marks, openStart);
|
|
19461
19461
|
let prev = parent.lastChild;
|
|
19462
|
-
if (prev && prev.isText() && !(prev.flags & 8) && prev.length +
|
|
19462
|
+
if (prev && prev.isText() && !(prev.flags & 8) && prev.length + text.length < 512) {
|
|
19463
19463
|
this.cache.reused.set(
|
|
19464
19464
|
prev,
|
|
19465
19465
|
2
|
|
19466
19466
|
/* Reused.DOM */
|
|
19467
19467
|
);
|
|
19468
|
-
let tile2 = parent.children[parent.children.length - 1] = new TextTile(prev.dom, prev.text +
|
|
19468
|
+
let tile2 = parent.children[parent.children.length - 1] = new TextTile(prev.dom, prev.text + text);
|
|
19469
19469
|
tile2.parent = parent;
|
|
19470
19470
|
} else {
|
|
19471
|
-
parent.append(tile || TextTile.of(
|
|
19471
|
+
parent.append(tile || TextTile.of(text, (_a2 = this.cache.find(TextTile)) === null || _a2 === void 0 ? void 0 : _a2.dom));
|
|
19472
19472
|
}
|
|
19473
|
-
this.pos +=
|
|
19473
|
+
this.pos += text.length;
|
|
19474
19474
|
this.afterWidget = null;
|
|
19475
19475
|
}
|
|
19476
19476
|
addComposition(composition, context) {
|
|
@@ -19514,10 +19514,10 @@ class TileBuilder {
|
|
|
19514
19514
|
2
|
|
19515
19515
|
/* Reused.DOM */
|
|
19516
19516
|
);
|
|
19517
|
-
let
|
|
19518
|
-
|
|
19517
|
+
let text = new TextTile(composition.text, composition.text.nodeValue);
|
|
19518
|
+
text.flags |= 8;
|
|
19519
19519
|
this.pos = composition.range.toB;
|
|
19520
|
-
head.append(
|
|
19520
|
+
head.append(text);
|
|
19521
19521
|
}
|
|
19522
19522
|
addInlineWidget(widget, marks, openStart) {
|
|
19523
19523
|
let noSpace = this.afterWidget && widget.flags & 48 && (this.afterWidget.flags & 48) == (widget.flags & 48);
|
|
@@ -19989,9 +19989,9 @@ class TileUpdate {
|
|
|
19989
19989
|
this.old.advance(5, side, this.reuseWalker);
|
|
19990
19990
|
}
|
|
19991
19991
|
}
|
|
19992
|
-
getCompositionContext(
|
|
19992
|
+
getCompositionContext(text) {
|
|
19993
19993
|
let marks = [], line = null;
|
|
19994
|
-
for (let parent =
|
|
19994
|
+
for (let parent = text.parentNode; ; parent = parent.parentNode) {
|
|
19995
19995
|
let tile = Tile.get(parent);
|
|
19996
19996
|
if (parent == this.view.contentDOM)
|
|
19997
19997
|
break;
|
|
@@ -20230,9 +20230,9 @@ class DocView {
|
|
|
20230
20230
|
if (browser.gecko) {
|
|
20231
20231
|
let nextTo = nextToUneditable(anchor.node, anchor.offset);
|
|
20232
20232
|
if (nextTo && nextTo != (1 | 2)) {
|
|
20233
|
-
let
|
|
20234
|
-
if (
|
|
20235
|
-
anchor = new DOMPos(
|
|
20233
|
+
let text = (nextTo == 1 ? textNodeBefore : textNodeAfter)(anchor.node, anchor.offset);
|
|
20234
|
+
if (text)
|
|
20235
|
+
anchor = new DOMPos(text.node, text.offset);
|
|
20236
20236
|
}
|
|
20237
20237
|
}
|
|
20238
20238
|
rawSel.collapse(anchor.node, anchor.offset);
|
|
@@ -20646,10 +20646,10 @@ function findCompositionRange(view, changes, headPos) {
|
|
|
20646
20646
|
let found = findCompositionNode(view, headPos);
|
|
20647
20647
|
if (!found)
|
|
20648
20648
|
return null;
|
|
20649
|
-
let { node: textNode, from, to } = found,
|
|
20650
|
-
if (/[\n\r]/.test(
|
|
20649
|
+
let { node: textNode, from, to } = found, text = textNode.nodeValue;
|
|
20650
|
+
if (/[\n\r]/.test(text))
|
|
20651
20651
|
return null;
|
|
20652
|
-
if (view.state.doc.sliceString(found.from, found.to) !=
|
|
20652
|
+
if (view.state.doc.sliceString(found.from, found.to) != text)
|
|
20653
20653
|
return null;
|
|
20654
20654
|
let inv = changes.invertedDesc;
|
|
20655
20655
|
return { range: new ChangedRange(inv.mapPos(from), inv.mapPos(to), from, to), text: textNode };
|
|
@@ -21119,8 +21119,8 @@ class DOMReader {
|
|
|
21119
21119
|
this.text = "";
|
|
21120
21120
|
this.lineSeparator = view.state.facet(EditorState.lineSeparator);
|
|
21121
21121
|
}
|
|
21122
|
-
append(
|
|
21123
|
-
this.text +=
|
|
21122
|
+
append(text) {
|
|
21123
|
+
this.text += text;
|
|
21124
21124
|
}
|
|
21125
21125
|
lineBreak() {
|
|
21126
21126
|
this.text += LineBreakPlaceholder;
|
|
@@ -21148,20 +21148,20 @@ class DOMReader {
|
|
|
21148
21148
|
return this;
|
|
21149
21149
|
}
|
|
21150
21150
|
readTextNode(node) {
|
|
21151
|
-
let
|
|
21151
|
+
let text = node.nodeValue;
|
|
21152
21152
|
for (let point of this.points)
|
|
21153
21153
|
if (point.node == node)
|
|
21154
|
-
point.pos = this.text.length + Math.min(point.offset,
|
|
21154
|
+
point.pos = this.text.length + Math.min(point.offset, text.length);
|
|
21155
21155
|
for (let off = 0, re = this.lineSeparator ? null : /\r\n?|\n/g; ; ) {
|
|
21156
21156
|
let nextBreak = -1, breakSize = 1, m;
|
|
21157
21157
|
if (this.lineSeparator) {
|
|
21158
|
-
nextBreak =
|
|
21158
|
+
nextBreak = text.indexOf(this.lineSeparator, off);
|
|
21159
21159
|
breakSize = this.lineSeparator.length;
|
|
21160
|
-
} else if (m = re.exec(
|
|
21160
|
+
} else if (m = re.exec(text)) {
|
|
21161
21161
|
nextBreak = m.index;
|
|
21162
21162
|
breakSize = m[0].length;
|
|
21163
21163
|
}
|
|
21164
|
-
this.append(
|
|
21164
|
+
this.append(text.slice(off, nextBreak < 0 ? text.length : nextBreak));
|
|
21165
21165
|
if (nextBreak < 0)
|
|
21166
21166
|
break;
|
|
21167
21167
|
this.lineBreak();
|
|
@@ -21384,12 +21384,12 @@ function applyDOMChangeInner(view, change, newSel, lastKey = -1) {
|
|
|
21384
21384
|
// after a completion when you press enter
|
|
21385
21385
|
(change.from == sel.from || change.from == sel.from - 1 && view.state.sliceDoc(change.from, sel.from) == " ") && change.insert.length == 1 && change.insert.lines == 2 && dispatchKey(view.contentDOM, "Enter", 13) || (change.from == sel.from - 1 && change.to == sel.to && change.insert.length == 0 || lastKey == 8 && change.insert.length < change.to - change.from && change.to > sel.head) && dispatchKey(view.contentDOM, "Backspace", 8) || change.from == sel.from && change.to == sel.to + 1 && change.insert.length == 0 && dispatchKey(view.contentDOM, "Delete", 46)))
|
|
21386
21386
|
return true;
|
|
21387
|
-
let
|
|
21387
|
+
let text = change.insert.toString();
|
|
21388
21388
|
if (view.inputState.composing >= 0)
|
|
21389
21389
|
view.inputState.composing++;
|
|
21390
21390
|
let defaultTr;
|
|
21391
21391
|
let defaultInsert = () => defaultTr || (defaultTr = applyDefaultInsert(view, change, newSel));
|
|
21392
|
-
if (!view.state.facet(inputHandler).some((h) => h(view, change.from, change.to,
|
|
21392
|
+
if (!view.state.facet(inputHandler).some((h) => h(view, change.from, change.to, text, defaultInsert)))
|
|
21393
21393
|
view.dispatch(defaultInsert());
|
|
21394
21394
|
return true;
|
|
21395
21395
|
}
|
|
@@ -21848,16 +21848,16 @@ function capturePaste(view) {
|
|
|
21848
21848
|
doPaste(view, target.value);
|
|
21849
21849
|
}, 50);
|
|
21850
21850
|
}
|
|
21851
|
-
function textFilter(state, facet,
|
|
21851
|
+
function textFilter(state, facet, text) {
|
|
21852
21852
|
for (let filter of state.facet(facet))
|
|
21853
|
-
|
|
21854
|
-
return
|
|
21853
|
+
text = filter(text, state);
|
|
21854
|
+
return text;
|
|
21855
21855
|
}
|
|
21856
21856
|
function doPaste(view, input) {
|
|
21857
21857
|
input = textFilter(view.state, clipboardInputFilter, input);
|
|
21858
|
-
let { state } = view, changes, i = 1,
|
|
21859
|
-
let byLine =
|
|
21860
|
-
let linewise = lastLinewiseCopy != null && state.selection.ranges.every((r) => r.empty) && lastLinewiseCopy ==
|
|
21858
|
+
let { state } = view, changes, i = 1, text = state.toText(input);
|
|
21859
|
+
let byLine = text.lines == state.selection.ranges.length;
|
|
21860
|
+
let linewise = lastLinewiseCopy != null && state.selection.ranges.every((r) => r.empty) && lastLinewiseCopy == text.toString();
|
|
21861
21861
|
if (linewise) {
|
|
21862
21862
|
let lastLine = -1;
|
|
21863
21863
|
changes = state.changeByRange((range) => {
|
|
@@ -21865,7 +21865,7 @@ function doPaste(view, input) {
|
|
|
21865
21865
|
if (line.from == lastLine)
|
|
21866
21866
|
return { range };
|
|
21867
21867
|
lastLine = line.from;
|
|
21868
|
-
let insert2 = state.toText((byLine ?
|
|
21868
|
+
let insert2 = state.toText((byLine ? text.line(i++).text : input) + state.lineBreak);
|
|
21869
21869
|
return {
|
|
21870
21870
|
changes: { from: line.from, insert: insert2 },
|
|
21871
21871
|
range: EditorSelection.cursor(range.from + insert2.length)
|
|
@@ -21873,14 +21873,14 @@ function doPaste(view, input) {
|
|
|
21873
21873
|
});
|
|
21874
21874
|
} else if (byLine) {
|
|
21875
21875
|
changes = state.changeByRange((range) => {
|
|
21876
|
-
let line =
|
|
21876
|
+
let line = text.line(i++);
|
|
21877
21877
|
return {
|
|
21878
21878
|
changes: { from: range.from, to: range.to, insert: line.text },
|
|
21879
21879
|
range: EditorSelection.cursor(range.from + line.length)
|
|
21880
21880
|
};
|
|
21881
21881
|
});
|
|
21882
21882
|
} else {
|
|
21883
|
-
changes = state.replaceSelection(
|
|
21883
|
+
changes = state.replaceSelection(text);
|
|
21884
21884
|
}
|
|
21885
21885
|
view.dispatch(changes, {
|
|
21886
21886
|
userEvent: "input.paste",
|
|
@@ -22028,14 +22028,14 @@ handlers.dragend = (view) => {
|
|
|
22028
22028
|
view.inputState.draggedContent = null;
|
|
22029
22029
|
return false;
|
|
22030
22030
|
};
|
|
22031
|
-
function dropText(view, event,
|
|
22032
|
-
|
|
22033
|
-
if (!
|
|
22031
|
+
function dropText(view, event, text, direct) {
|
|
22032
|
+
text = textFilter(view.state, clipboardInputFilter, text);
|
|
22033
|
+
if (!text)
|
|
22034
22034
|
return;
|
|
22035
22035
|
let dropPos = view.posAtCoords({ x: event.clientX, y: event.clientY }, false);
|
|
22036
22036
|
let { draggedContent } = view.inputState;
|
|
22037
22037
|
let del = direct && draggedContent && dragMovesSelection(view, event) ? { from: draggedContent.from, to: draggedContent.to } : null;
|
|
22038
|
-
let ins = { from: dropPos, insert:
|
|
22038
|
+
let ins = { from: dropPos, insert: text };
|
|
22039
22039
|
let changes = view.state.changes(del ? [del, ins] : ins);
|
|
22040
22040
|
view.focus();
|
|
22041
22041
|
view.dispatch({
|
|
@@ -22052,26 +22052,26 @@ handlers.drop = (view, event) => {
|
|
|
22052
22052
|
return true;
|
|
22053
22053
|
let files = event.dataTransfer.files;
|
|
22054
22054
|
if (files && files.length) {
|
|
22055
|
-
let
|
|
22055
|
+
let text = Array(files.length), read = 0;
|
|
22056
22056
|
let finishFile = () => {
|
|
22057
22057
|
if (++read == files.length)
|
|
22058
|
-
dropText(view, event,
|
|
22058
|
+
dropText(view, event, text.filter((s) => s != null).join(view.state.lineBreak), false);
|
|
22059
22059
|
};
|
|
22060
22060
|
for (let i = 0; i < files.length; i++) {
|
|
22061
22061
|
let reader = new FileReader();
|
|
22062
22062
|
reader.onerror = finishFile;
|
|
22063
22063
|
reader.onload = () => {
|
|
22064
22064
|
if (!/[\x00-\x08\x0e-\x1f]{2}/.test(reader.result))
|
|
22065
|
-
|
|
22065
|
+
text[i] = reader.result;
|
|
22066
22066
|
finishFile();
|
|
22067
22067
|
};
|
|
22068
22068
|
reader.readAsText(files[i]);
|
|
22069
22069
|
}
|
|
22070
22070
|
return true;
|
|
22071
22071
|
} else {
|
|
22072
|
-
let
|
|
22073
|
-
if (
|
|
22074
|
-
dropText(view, event,
|
|
22072
|
+
let text = event.dataTransfer.getData("Text");
|
|
22073
|
+
if (text) {
|
|
22074
|
+
dropText(view, event, text, true);
|
|
22075
22075
|
return true;
|
|
22076
22076
|
}
|
|
22077
22077
|
}
|
|
@@ -22090,15 +22090,15 @@ handlers.paste = (view, event) => {
|
|
|
22090
22090
|
return false;
|
|
22091
22091
|
}
|
|
22092
22092
|
};
|
|
22093
|
-
function captureCopy(view,
|
|
22093
|
+
function captureCopy(view, text) {
|
|
22094
22094
|
let parent = view.dom.parentNode;
|
|
22095
22095
|
if (!parent)
|
|
22096
22096
|
return;
|
|
22097
22097
|
let target = parent.appendChild(document.createElement("textarea"));
|
|
22098
22098
|
target.style.cssText = "position: fixed; left: -10000px; top: 10px";
|
|
22099
|
-
target.value =
|
|
22099
|
+
target.value = text;
|
|
22100
22100
|
target.focus();
|
|
22101
|
-
target.selectionEnd =
|
|
22101
|
+
target.selectionEnd = text.length;
|
|
22102
22102
|
target.selectionStart = 0;
|
|
22103
22103
|
setTimeout(() => {
|
|
22104
22104
|
target.remove();
|
|
@@ -22130,10 +22130,10 @@ let lastLinewiseCopy = null;
|
|
|
22130
22130
|
handlers.copy = handlers.cut = (view, event) => {
|
|
22131
22131
|
if (!hasSelection(view.contentDOM, view.observer.selectionRange))
|
|
22132
22132
|
return false;
|
|
22133
|
-
let { text
|
|
22134
|
-
if (!
|
|
22133
|
+
let { text, ranges, linewise } = copiedRange(view.state);
|
|
22134
|
+
if (!text && !linewise)
|
|
22135
22135
|
return false;
|
|
22136
|
-
lastLinewiseCopy = linewise ?
|
|
22136
|
+
lastLinewiseCopy = linewise ? text : null;
|
|
22137
22137
|
if (event.type == "cut" && !view.state.readOnly)
|
|
22138
22138
|
view.dispatch({
|
|
22139
22139
|
changes: ranges,
|
|
@@ -22143,10 +22143,10 @@ handlers.copy = handlers.cut = (view, event) => {
|
|
|
22143
22143
|
let data = brokenClipboardAPI ? null : event.clipboardData;
|
|
22144
22144
|
if (data) {
|
|
22145
22145
|
data.clearData();
|
|
22146
|
-
data.setData("text/plain",
|
|
22146
|
+
data.setData("text/plain", text);
|
|
22147
22147
|
return true;
|
|
22148
22148
|
} else {
|
|
22149
|
-
captureCopy(view,
|
|
22149
|
+
captureCopy(view, text);
|
|
22150
22150
|
return false;
|
|
22151
22151
|
}
|
|
22152
22152
|
};
|
|
@@ -22222,11 +22222,11 @@ handlers.beforeinput = (view, event) => {
|
|
|
22222
22222
|
view.inputState.insertingTextAt = Date.now();
|
|
22223
22223
|
}
|
|
22224
22224
|
if (event.inputType == "insertReplacementText" && view.observer.editContext) {
|
|
22225
|
-
let
|
|
22226
|
-
if (
|
|
22225
|
+
let text = (_a2 = event.dataTransfer) === null || _a2 === void 0 ? void 0 : _a2.getData("text/plain"), ranges = event.getTargetRanges();
|
|
22226
|
+
if (text && ranges.length) {
|
|
22227
22227
|
let r = ranges[0];
|
|
22228
22228
|
let from = view.posAtDOM(r.startContainer, r.startOffset), to = view.posAtDOM(r.endContainer, r.endOffset);
|
|
22229
|
-
applyDOMChangeInner(view, { from, to, insert: view.state.toText(
|
|
22229
|
+
applyDOMChangeInner(view, { from, to, insert: view.state.toText(text) }, null);
|
|
22230
22230
|
return true;
|
|
22231
22231
|
}
|
|
22232
22232
|
}
|
|
@@ -30840,18 +30840,18 @@ class IndentContext {
|
|
|
30840
30840
|
textAfterPos(pos, bias = 1) {
|
|
30841
30841
|
if (this.options.simulateDoubleBreak && pos == this.options.simulateBreak)
|
|
30842
30842
|
return "";
|
|
30843
|
-
let { text
|
|
30844
|
-
return
|
|
30843
|
+
let { text, from } = this.lineAt(pos, bias);
|
|
30844
|
+
return text.slice(pos - from, Math.min(text.length, pos + 100 - from));
|
|
30845
30845
|
}
|
|
30846
30846
|
/**
|
|
30847
30847
|
Find the column for the given position.
|
|
30848
30848
|
*/
|
|
30849
30849
|
column(pos, bias = 1) {
|
|
30850
|
-
let { text
|
|
30851
|
-
let result = this.countColumn(
|
|
30850
|
+
let { text, from } = this.lineAt(pos, bias);
|
|
30851
|
+
let result = this.countColumn(text, pos - from);
|
|
30852
30852
|
let override = this.options.overrideIndentation ? this.options.overrideIndentation(from) : -1;
|
|
30853
30853
|
if (override > -1)
|
|
30854
|
-
result += override - this.countColumn(
|
|
30854
|
+
result += override - this.countColumn(text, text.search(/\S|$/));
|
|
30855
30855
|
return result;
|
|
30856
30856
|
}
|
|
30857
30857
|
/**
|
|
@@ -30865,14 +30865,14 @@ class IndentContext {
|
|
|
30865
30865
|
Find the indentation column of the line at the given point.
|
|
30866
30866
|
*/
|
|
30867
30867
|
lineIndent(pos, bias = 1) {
|
|
30868
|
-
let { text
|
|
30868
|
+
let { text, from } = this.lineAt(pos, bias);
|
|
30869
30869
|
let override = this.options.overrideIndentation;
|
|
30870
30870
|
if (override) {
|
|
30871
30871
|
let overriden = override(from);
|
|
30872
30872
|
if (overriden > -1)
|
|
30873
30873
|
return overriden;
|
|
30874
30874
|
}
|
|
30875
|
-
return this.countColumn(
|
|
30875
|
+
return this.countColumn(text, text.search(/\S|$/));
|
|
30876
30876
|
}
|
|
30877
30877
|
/**
|
|
30878
30878
|
Returns the [simulated line
|
|
@@ -31369,12 +31369,12 @@ function matchPlainBrackets(state, pos, dir, tree, tokenType, maxScanDistance, b
|
|
|
31369
31369
|
let startToken = { from: dir < 0 ? pos - 1 : pos, to: dir > 0 ? pos + 1 : pos };
|
|
31370
31370
|
let iter = state.doc.iterRange(pos, dir > 0 ? state.doc.length : 0), depth = 0;
|
|
31371
31371
|
for (let distance = 0; !iter.next().done && distance <= maxScanDistance; ) {
|
|
31372
|
-
let
|
|
31372
|
+
let text = iter.value;
|
|
31373
31373
|
if (dir < 0)
|
|
31374
|
-
distance +=
|
|
31374
|
+
distance += text.length;
|
|
31375
31375
|
let basePos = pos + distance * dir;
|
|
31376
|
-
for (let pos2 = dir > 0 ? 0 :
|
|
31377
|
-
let found = brackets.indexOf(
|
|
31376
|
+
for (let pos2 = dir > 0 ? 0 : text.length - 1, end = dir > 0 ? text.length : -1; pos2 != end; pos2 += dir) {
|
|
31377
|
+
let found = brackets.indexOf(text[pos2]);
|
|
31378
31378
|
if (found < 0 || tree.resolveInner(basePos + pos2, 1).type != tokenType)
|
|
31379
31379
|
continue;
|
|
31380
31380
|
if (found % 2 == 0 == dir > 0) {
|
|
@@ -31386,7 +31386,7 @@ function matchPlainBrackets(state, pos, dir, tree, tokenType, maxScanDistance, b
|
|
|
31386
31386
|
}
|
|
31387
31387
|
}
|
|
31388
31388
|
if (dir > 0)
|
|
31389
|
-
distance +=
|
|
31389
|
+
distance += text.length;
|
|
31390
31390
|
}
|
|
31391
31391
|
return iter.done ? { start: startToken, matched: false } : null;
|
|
31392
31392
|
}
|
|
@@ -32550,14 +32550,14 @@ class SearchCursor {
|
|
|
32550
32550
|
[`.normalize("NFKD")`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize)
|
|
32551
32551
|
(when supported).
|
|
32552
32552
|
*/
|
|
32553
|
-
constructor(
|
|
32553
|
+
constructor(text, query, from = 0, to = text.length, normalize, test) {
|
|
32554
32554
|
this.test = test;
|
|
32555
32555
|
this.value = { from: 0, to: 0, precise: false };
|
|
32556
32556
|
this.done = false;
|
|
32557
32557
|
this.matches = [];
|
|
32558
32558
|
this.buffer = "";
|
|
32559
32559
|
this.bufferPos = 0;
|
|
32560
|
-
this.iter =
|
|
32560
|
+
this.iter = text.iterRange(from, to);
|
|
32561
32561
|
this.bufferStart = from;
|
|
32562
32562
|
this.normalize = normalize ? (x) => normalize(basicNormalize(x)) : basicNormalize;
|
|
32563
32563
|
this.query = this.normalize(query);
|
|
@@ -32656,20 +32656,20 @@ class RegExpCursor {
|
|
|
32656
32656
|
document. `query` should be the raw pattern (as you'd pass it to
|
|
32657
32657
|
`new RegExp`).
|
|
32658
32658
|
*/
|
|
32659
|
-
constructor(
|
|
32660
|
-
this.text =
|
|
32659
|
+
constructor(text, query, options, from = 0, to = text.length) {
|
|
32660
|
+
this.text = text;
|
|
32661
32661
|
this.to = to;
|
|
32662
32662
|
this.curLine = "";
|
|
32663
32663
|
this.done = false;
|
|
32664
32664
|
this.value = empty;
|
|
32665
32665
|
if (/\\[sWDnr]|\n|\r|\[\^/.test(query))
|
|
32666
|
-
return new MultilineRegExpCursor(
|
|
32666
|
+
return new MultilineRegExpCursor(text, query, options, from, to);
|
|
32667
32667
|
this.re = new RegExp(query, baseFlags + ((options === null || options === void 0 ? void 0 : options.ignoreCase) ? "i" : ""));
|
|
32668
32668
|
this.test = options === null || options === void 0 ? void 0 : options.test;
|
|
32669
|
-
this.iter =
|
|
32670
|
-
let startLine =
|
|
32669
|
+
this.iter = text.iter();
|
|
32670
|
+
let startLine = text.lineAt(from);
|
|
32671
32671
|
this.curLineStart = startLine.from;
|
|
32672
|
-
this.matchPos = toCharEnd(
|
|
32672
|
+
this.matchPos = toCharEnd(text, from);
|
|
32673
32673
|
this.getLine(this.curLineStart);
|
|
32674
32674
|
}
|
|
32675
32675
|
getLine(skip) {
|
|
@@ -32719,9 +32719,9 @@ class RegExpCursor {
|
|
|
32719
32719
|
}
|
|
32720
32720
|
const flattened = /* @__PURE__ */ new WeakMap();
|
|
32721
32721
|
class FlattenedDoc {
|
|
32722
|
-
constructor(from,
|
|
32722
|
+
constructor(from, text) {
|
|
32723
32723
|
this.from = from;
|
|
32724
|
-
this.text =
|
|
32724
|
+
this.text = text;
|
|
32725
32725
|
}
|
|
32726
32726
|
get to() {
|
|
32727
32727
|
return this.from + this.text.length;
|
|
@@ -32735,27 +32735,27 @@ class FlattenedDoc {
|
|
|
32735
32735
|
}
|
|
32736
32736
|
if (cached2.from == from && cached2.to == to)
|
|
32737
32737
|
return cached2;
|
|
32738
|
-
let { text
|
|
32738
|
+
let { text, from: cachedFrom } = cached2;
|
|
32739
32739
|
if (cachedFrom > from) {
|
|
32740
|
-
|
|
32740
|
+
text = doc2.sliceString(from, cachedFrom) + text;
|
|
32741
32741
|
cachedFrom = from;
|
|
32742
32742
|
}
|
|
32743
32743
|
if (cached2.to < to)
|
|
32744
|
-
|
|
32745
|
-
flattened.set(doc2, new FlattenedDoc(cachedFrom,
|
|
32746
|
-
return new FlattenedDoc(from,
|
|
32744
|
+
text += doc2.sliceString(cached2.to, to);
|
|
32745
|
+
flattened.set(doc2, new FlattenedDoc(cachedFrom, text));
|
|
32746
|
+
return new FlattenedDoc(from, text.slice(from - cachedFrom, to - cachedFrom));
|
|
32747
32747
|
}
|
|
32748
32748
|
}
|
|
32749
32749
|
class MultilineRegExpCursor {
|
|
32750
|
-
constructor(
|
|
32751
|
-
this.text =
|
|
32750
|
+
constructor(text, query, options, from, to) {
|
|
32751
|
+
this.text = text;
|
|
32752
32752
|
this.to = to;
|
|
32753
32753
|
this.done = false;
|
|
32754
32754
|
this.value = empty;
|
|
32755
|
-
this.matchPos = toCharEnd(
|
|
32755
|
+
this.matchPos = toCharEnd(text, from);
|
|
32756
32756
|
this.re = new RegExp(query, baseFlags + ((options === null || options === void 0 ? void 0 : options.ignoreCase) ? "i" : ""));
|
|
32757
32757
|
this.test = options === null || options === void 0 ? void 0 : options.test;
|
|
32758
|
-
this.flat = FlattenedDoc.get(
|
|
32758
|
+
this.flat = FlattenedDoc.get(text, from, this.chunkEnd(
|
|
32759
32759
|
from + 5e3
|
|
32760
32760
|
/* Chunk.Base */
|
|
32761
32761
|
));
|
|
@@ -32800,10 +32800,10 @@ function validRegExp(source) {
|
|
|
32800
32800
|
return false;
|
|
32801
32801
|
}
|
|
32802
32802
|
}
|
|
32803
|
-
function toCharEnd(
|
|
32804
|
-
if (pos >=
|
|
32803
|
+
function toCharEnd(text, pos) {
|
|
32804
|
+
if (pos >= text.length)
|
|
32805
32805
|
return pos;
|
|
32806
|
-
let line =
|
|
32806
|
+
let line = text.lineAt(pos), next;
|
|
32807
32807
|
while (pos < line.to && (next = line.text.charCodeAt(pos - line.from)) >= 56320 && next < 57344)
|
|
32808
32808
|
pos++;
|
|
32809
32809
|
return pos;
|
|
@@ -33009,8 +33009,8 @@ class SearchQuery {
|
|
|
33009
33009
|
/**
|
|
33010
33010
|
@internal
|
|
33011
33011
|
*/
|
|
33012
|
-
unquote(
|
|
33013
|
-
return this.literal ?
|
|
33012
|
+
unquote(text) {
|
|
33013
|
+
return this.literal ? text : text.replace(/\\([nrt\\])/g, (_, ch) => ch == "n" ? "\n" : ch == "r" ? "\r" : ch == "t" ? " " : "\\");
|
|
33014
33014
|
}
|
|
33015
33015
|
/**
|
|
33016
33016
|
Compare this query to another query.
|
|
@@ -33559,22 +33559,22 @@ const Break = /[\s\.,:;?!]/;
|
|
|
33559
33559
|
function announceMatch(view, { from, to }) {
|
|
33560
33560
|
let line = view.state.doc.lineAt(from), lineEnd = view.state.doc.lineAt(to).to;
|
|
33561
33561
|
let start = Math.max(line.from, from - AnnounceMargin), end = Math.min(lineEnd, to + AnnounceMargin);
|
|
33562
|
-
let
|
|
33562
|
+
let text = view.state.sliceDoc(start, end);
|
|
33563
33563
|
if (start != line.from) {
|
|
33564
33564
|
for (let i = 0; i < AnnounceMargin; i++)
|
|
33565
|
-
if (!Break.test(
|
|
33566
|
-
|
|
33565
|
+
if (!Break.test(text[i + 1]) && Break.test(text[i])) {
|
|
33566
|
+
text = text.slice(i);
|
|
33567
33567
|
break;
|
|
33568
33568
|
}
|
|
33569
33569
|
}
|
|
33570
33570
|
if (end != lineEnd) {
|
|
33571
|
-
for (let i =
|
|
33572
|
-
if (!Break.test(
|
|
33573
|
-
|
|
33571
|
+
for (let i = text.length - 1; i > text.length - AnnounceMargin; i--)
|
|
33572
|
+
if (!Break.test(text[i - 1]) && Break.test(text[i])) {
|
|
33573
|
+
text = text.slice(0, i);
|
|
33574
33574
|
break;
|
|
33575
33575
|
}
|
|
33576
33576
|
}
|
|
33577
|
-
return EditorView.announce.of(`${view.state.phrase("current match")}. ${
|
|
33577
|
+
return EditorView.announce.of(`${view.state.phrase("current match")}. ${text} ${view.state.phrase("on line")} ${line.number}.`);
|
|
33578
33578
|
}
|
|
33579
33579
|
const baseTheme$2 = /* @__PURE__ */ EditorView.baseTheme({
|
|
33580
33580
|
".cm-panel.cm-search": {
|
|
@@ -35684,13 +35684,13 @@ function ensureAnchor(expr, start) {
|
|
|
35684
35684
|
return new RegExp(`${addStart ? "^" : ""}(?:${source})${addEnd ? "$" : ""}`, (_a2 = expr.flags) !== null && _a2 !== void 0 ? _a2 : expr.ignoreCase ? "i" : "");
|
|
35685
35685
|
}
|
|
35686
35686
|
const pickedCompletion = /* @__PURE__ */ Annotation.define();
|
|
35687
|
-
function insertCompletionText(state,
|
|
35687
|
+
function insertCompletionText(state, text, from, to) {
|
|
35688
35688
|
let { main } = state.selection, fromOff = from - main.from, toOff = to - main.from;
|
|
35689
35689
|
return {
|
|
35690
35690
|
...state.changeByRange((range) => {
|
|
35691
35691
|
if (range != main && from != to && state.sliceDoc(range.from + fromOff, range.from + toOff) != state.sliceDoc(from, to))
|
|
35692
35692
|
return { range };
|
|
35693
|
-
let lines = state.toText(
|
|
35693
|
+
let lines = state.toText(text);
|
|
35694
35694
|
return {
|
|
35695
35695
|
changes: { from: range.from + fromOff, to: to == main.from ? range.to : range.from + toOff, insert: lines },
|
|
35696
35696
|
range: EditorSelection.cursor(range.from + fromOff + lines.length)
|
|
@@ -36530,8 +36530,8 @@ class ActiveResult extends ActiveSource {
|
|
|
36530
36530
|
function checkValid(validFor, state, from, to) {
|
|
36531
36531
|
if (!validFor)
|
|
36532
36532
|
return false;
|
|
36533
|
-
let
|
|
36534
|
-
return typeof validFor == "function" ? validFor(
|
|
36533
|
+
let text = state.sliceDoc(from, to);
|
|
36534
|
+
return typeof validFor == "function" ? validFor(text, from, to, state) : ensureAnchor(validFor, true).test(text);
|
|
36535
36535
|
}
|
|
36536
36536
|
const setActiveEffect = /* @__PURE__ */ StateEffect.define({
|
|
36537
36537
|
map(sources, mapping) {
|
|
@@ -36930,21 +36930,21 @@ class Snippet {
|
|
|
36930
36930
|
this.fieldPositions = fieldPositions;
|
|
36931
36931
|
}
|
|
36932
36932
|
instantiate(state, pos) {
|
|
36933
|
-
let
|
|
36933
|
+
let text = [], lineStart = [pos];
|
|
36934
36934
|
let lineObj = state.doc.lineAt(pos), baseIndent = /^\s*/.exec(lineObj.text)[0];
|
|
36935
36935
|
for (let line of this.lines) {
|
|
36936
|
-
if (
|
|
36936
|
+
if (text.length) {
|
|
36937
36937
|
let indent = baseIndent, tabs = /^\t*/.exec(line)[0].length;
|
|
36938
36938
|
for (let i = 0; i < tabs; i++)
|
|
36939
36939
|
indent += state.facet(indentUnit);
|
|
36940
36940
|
lineStart.push(pos + indent.length - tabs);
|
|
36941
36941
|
line = indent + line.slice(tabs);
|
|
36942
36942
|
}
|
|
36943
|
-
|
|
36943
|
+
text.push(line);
|
|
36944
36944
|
pos += line.length + 1;
|
|
36945
36945
|
}
|
|
36946
36946
|
let ranges = this.fieldPositions.map((pos2) => new FieldRange(pos2.field, lineStart[pos2.line] + pos2.from, lineStart[pos2.line] + pos2.to));
|
|
36947
|
-
return { text
|
|
36947
|
+
return { text, ranges };
|
|
36948
36948
|
}
|
|
36949
36949
|
static parse(template) {
|
|
36950
36950
|
let fields = [];
|
|
@@ -37051,10 +37051,10 @@ function fieldSelection(ranges, field) {
|
|
|
37051
37051
|
function snippet(template) {
|
|
37052
37052
|
let snippet2 = Snippet.parse(template);
|
|
37053
37053
|
return (editor, completion, from, to) => {
|
|
37054
|
-
let { text
|
|
37054
|
+
let { text, ranges } = snippet2.instantiate(editor.state, from);
|
|
37055
37055
|
let { main } = editor.state.selection;
|
|
37056
37056
|
let spec = {
|
|
37057
|
-
changes: { from, to: to == main.from ? main.to : to, insert: Text.of(
|
|
37057
|
+
changes: { from, to: to == main.from ? main.to : to, insert: Text.of(text) },
|
|
37058
37058
|
scrollIntoView: true,
|
|
37059
37059
|
annotations: completion ? [pickedCompletion.of(completion), Transaction.userEvent.of("input.complete")] : void 0
|
|
37060
37060
|
};
|
|
@@ -37424,8 +37424,8 @@ function elementName(doc2, tree, max = doc2.length) {
|
|
|
37424
37424
|
return "";
|
|
37425
37425
|
}
|
|
37426
37426
|
const android = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(navigator.userAgent);
|
|
37427
|
-
const autoCloseTags = /* @__PURE__ */ EditorView.inputHandler.of((view, from, to,
|
|
37428
|
-
if ((android ? view.composing : view.compositionStarted) || view.state.readOnly || from != to ||
|
|
37427
|
+
const autoCloseTags = /* @__PURE__ */ EditorView.inputHandler.of((view, from, to, text, defaultInsert) => {
|
|
37428
|
+
if ((android ? view.composing : view.compositionStarted) || view.state.readOnly || from != to || text != ">" && text != "/" || !javascriptLanguage.isActiveAt(view.state, from, -1))
|
|
37429
37429
|
return false;
|
|
37430
37430
|
let base2 = defaultInsert(), { state } = base2;
|
|
37431
37431
|
let closeTags = state.changeByRange((range) => {
|
|
@@ -37433,16 +37433,16 @@ const autoCloseTags = /* @__PURE__ */ EditorView.inputHandler.of((view, from, to
|
|
|
37433
37433
|
let { head } = range, around = syntaxTree(state).resolveInner(head - 1, -1), name2;
|
|
37434
37434
|
if (around.name == "JSXStartTag")
|
|
37435
37435
|
around = around.parent;
|
|
37436
|
-
if (state.doc.sliceString(head - 1, head) !=
|
|
37437
|
-
else if (
|
|
37436
|
+
if (state.doc.sliceString(head - 1, head) != text || around.name == "JSXAttributeValue" && around.to > head) ;
|
|
37437
|
+
else if (text == ">" && around.name == "JSXFragmentTag") {
|
|
37438
37438
|
return { range, changes: { from: head, insert: `</>` } };
|
|
37439
|
-
} else if (
|
|
37439
|
+
} else if (text == "/" && around.name == "JSXStartCloseTag") {
|
|
37440
37440
|
let empty2 = around.parent, base3 = empty2.parent;
|
|
37441
37441
|
if (base3 && empty2.from == head - 2 && ((name2 = elementName(state.doc, base3.firstChild, head)) || ((_a2 = base3.firstChild) === null || _a2 === void 0 ? void 0 : _a2.name) == "JSXFragmentTag")) {
|
|
37442
37442
|
let insert2 = `${name2}>`;
|
|
37443
37443
|
return { range: EditorSelection.cursor(head + insert2.length, -1), changes: { from: head, insert: insert2 } };
|
|
37444
37444
|
}
|
|
37445
|
-
} else if (
|
|
37445
|
+
} else if (text == ">") {
|
|
37446
37446
|
let openTag = findOpenTag(around);
|
|
37447
37447
|
if (openTag && openTag.name == "JSXOpenTag" && !/^\/?>|^<\//.test(state.doc.sliceString(head, head + 2)) && (name2 = elementName(state.doc, openTag, head)))
|
|
37448
37448
|
return { range, changes: { from: head, insert: `</${name2}>` } };
|
|
@@ -38082,8 +38082,8 @@ function requireDiffMatchPatch() {
|
|
|
38082
38082
|
var DIFF_DELETE = -1;
|
|
38083
38083
|
var DIFF_INSERT = 1;
|
|
38084
38084
|
var DIFF_EQUAL = 0;
|
|
38085
|
-
diff_match_patch.Diff = function(op,
|
|
38086
|
-
return [op,
|
|
38085
|
+
diff_match_patch.Diff = function(op, text) {
|
|
38086
|
+
return [op, text];
|
|
38087
38087
|
};
|
|
38088
38088
|
diff_match_patch.prototype.diff_main = function(text1, text2, opt_checklines, opt_deadline) {
|
|
38089
38089
|
if (typeof opt_deadline == "undefined") {
|
|
@@ -38324,23 +38324,23 @@ function requireDiffMatchPatch() {
|
|
|
38324
38324
|
var lineArray = [];
|
|
38325
38325
|
var lineHash = {};
|
|
38326
38326
|
lineArray[0] = "";
|
|
38327
|
-
function diff_linesToCharsMunge_(
|
|
38327
|
+
function diff_linesToCharsMunge_(text) {
|
|
38328
38328
|
var chars = "";
|
|
38329
38329
|
var lineStart = 0;
|
|
38330
38330
|
var lineEnd = -1;
|
|
38331
38331
|
var lineArrayLength = lineArray.length;
|
|
38332
|
-
while (lineEnd <
|
|
38333
|
-
lineEnd =
|
|
38332
|
+
while (lineEnd < text.length - 1) {
|
|
38333
|
+
lineEnd = text.indexOf("\n", lineStart);
|
|
38334
38334
|
if (lineEnd == -1) {
|
|
38335
|
-
lineEnd =
|
|
38335
|
+
lineEnd = text.length - 1;
|
|
38336
38336
|
}
|
|
38337
|
-
var line =
|
|
38337
|
+
var line = text.substring(lineStart, lineEnd + 1);
|
|
38338
38338
|
if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) : lineHash[line] !== void 0) {
|
|
38339
38339
|
chars += String.fromCharCode(lineHash[line]);
|
|
38340
38340
|
} else {
|
|
38341
38341
|
if (lineArrayLength == maxLines) {
|
|
38342
|
-
line =
|
|
38343
|
-
lineEnd =
|
|
38342
|
+
line = text.substring(lineStart);
|
|
38343
|
+
lineEnd = text.length;
|
|
38344
38344
|
}
|
|
38345
38345
|
chars += String.fromCharCode(lineArrayLength);
|
|
38346
38346
|
lineHash[line] = lineArrayLength;
|
|
@@ -38359,11 +38359,11 @@ function requireDiffMatchPatch() {
|
|
|
38359
38359
|
diff_match_patch.prototype.diff_charsToLines_ = function(diffs, lineArray) {
|
|
38360
38360
|
for (var i = 0; i < diffs.length; i++) {
|
|
38361
38361
|
var chars = diffs[i][1];
|
|
38362
|
-
var
|
|
38362
|
+
var text = [];
|
|
38363
38363
|
for (var j = 0; j < chars.length; j++) {
|
|
38364
|
-
|
|
38364
|
+
text[j] = lineArray[chars.charCodeAt(j)];
|
|
38365
38365
|
}
|
|
38366
|
-
diffs[i][1] =
|
|
38366
|
+
diffs[i][1] = text.join("");
|
|
38367
38367
|
}
|
|
38368
38368
|
};
|
|
38369
38369
|
diff_match_patch.prototype.diff_commonPrefix = function(text1, text2) {
|
|
@@ -38868,38 +38868,38 @@ function requireDiffMatchPatch() {
|
|
|
38868
38868
|
for (var x = 0; x < diffs.length; x++) {
|
|
38869
38869
|
var op = diffs[x][0];
|
|
38870
38870
|
var data = diffs[x][1];
|
|
38871
|
-
var
|
|
38871
|
+
var text = data.replace(pattern_amp, "&").replace(pattern_lt, "<").replace(pattern_gt, ">").replace(pattern_para, "¶<br>");
|
|
38872
38872
|
switch (op) {
|
|
38873
38873
|
case DIFF_INSERT:
|
|
38874
|
-
html[x] = '<ins style="background:#e6ffe6;">' +
|
|
38874
|
+
html[x] = '<ins style="background:#e6ffe6;">' + text + "</ins>";
|
|
38875
38875
|
break;
|
|
38876
38876
|
case DIFF_DELETE:
|
|
38877
|
-
html[x] = '<del style="background:#ffe6e6;">' +
|
|
38877
|
+
html[x] = '<del style="background:#ffe6e6;">' + text + "</del>";
|
|
38878
38878
|
break;
|
|
38879
38879
|
case DIFF_EQUAL:
|
|
38880
|
-
html[x] = "<span>" +
|
|
38880
|
+
html[x] = "<span>" + text + "</span>";
|
|
38881
38881
|
break;
|
|
38882
38882
|
}
|
|
38883
38883
|
}
|
|
38884
38884
|
return html.join("");
|
|
38885
38885
|
};
|
|
38886
38886
|
diff_match_patch.prototype.diff_text1 = function(diffs) {
|
|
38887
|
-
var
|
|
38887
|
+
var text = [];
|
|
38888
38888
|
for (var x = 0; x < diffs.length; x++) {
|
|
38889
38889
|
if (diffs[x][0] !== DIFF_INSERT) {
|
|
38890
|
-
|
|
38890
|
+
text[x] = diffs[x][1];
|
|
38891
38891
|
}
|
|
38892
38892
|
}
|
|
38893
|
-
return
|
|
38893
|
+
return text.join("");
|
|
38894
38894
|
};
|
|
38895
38895
|
diff_match_patch.prototype.diff_text2 = function(diffs) {
|
|
38896
|
-
var
|
|
38896
|
+
var text = [];
|
|
38897
38897
|
for (var x = 0; x < diffs.length; x++) {
|
|
38898
38898
|
if (diffs[x][0] !== DIFF_DELETE) {
|
|
38899
|
-
|
|
38899
|
+
text[x] = diffs[x][1];
|
|
38900
38900
|
}
|
|
38901
38901
|
}
|
|
38902
|
-
return
|
|
38902
|
+
return text.join("");
|
|
38903
38903
|
};
|
|
38904
38904
|
diff_match_patch.prototype.diff_levenshtein = function(diffs) {
|
|
38905
38905
|
var levenshtein = 0;
|
|
@@ -38926,21 +38926,21 @@ function requireDiffMatchPatch() {
|
|
|
38926
38926
|
return levenshtein;
|
|
38927
38927
|
};
|
|
38928
38928
|
diff_match_patch.prototype.diff_toDelta = function(diffs) {
|
|
38929
|
-
var
|
|
38929
|
+
var text = [];
|
|
38930
38930
|
for (var x = 0; x < diffs.length; x++) {
|
|
38931
38931
|
switch (diffs[x][0]) {
|
|
38932
38932
|
case DIFF_INSERT:
|
|
38933
|
-
|
|
38933
|
+
text[x] = "+" + encodeURI(diffs[x][1]);
|
|
38934
38934
|
break;
|
|
38935
38935
|
case DIFF_DELETE:
|
|
38936
|
-
|
|
38936
|
+
text[x] = "-" + diffs[x][1].length;
|
|
38937
38937
|
break;
|
|
38938
38938
|
case DIFF_EQUAL:
|
|
38939
|
-
|
|
38939
|
+
text[x] = "=" + diffs[x][1].length;
|
|
38940
38940
|
break;
|
|
38941
38941
|
}
|
|
38942
38942
|
}
|
|
38943
|
-
return
|
|
38943
|
+
return text.join(" ").replace(/%20/g, " ");
|
|
38944
38944
|
};
|
|
38945
38945
|
diff_match_patch.prototype.diff_fromDelta = function(text1, delta) {
|
|
38946
38946
|
var diffs = [];
|
|
@@ -38964,11 +38964,11 @@ function requireDiffMatchPatch() {
|
|
|
38964
38964
|
if (isNaN(n) || n < 0) {
|
|
38965
38965
|
throw new Error("Invalid number in diff_fromDelta: " + param);
|
|
38966
38966
|
}
|
|
38967
|
-
var
|
|
38967
|
+
var text = text1.substring(pointer, pointer += n);
|
|
38968
38968
|
if (tokens[x].charAt(0) == "=") {
|
|
38969
|
-
diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_EQUAL,
|
|
38969
|
+
diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_EQUAL, text);
|
|
38970
38970
|
} else {
|
|
38971
|
-
diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_DELETE,
|
|
38971
|
+
diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_DELETE, text);
|
|
38972
38972
|
}
|
|
38973
38973
|
break;
|
|
38974
38974
|
default:
|
|
@@ -38982,22 +38982,22 @@ function requireDiffMatchPatch() {
|
|
|
38982
38982
|
}
|
|
38983
38983
|
return diffs;
|
|
38984
38984
|
};
|
|
38985
|
-
diff_match_patch.prototype.match_main = function(
|
|
38986
|
-
if (
|
|
38985
|
+
diff_match_patch.prototype.match_main = function(text, pattern2, loc) {
|
|
38986
|
+
if (text == null || pattern2 == null || loc == null) {
|
|
38987
38987
|
throw new Error("Null input. (match_main)");
|
|
38988
38988
|
}
|
|
38989
|
-
loc = Math.max(0, Math.min(loc,
|
|
38990
|
-
if (
|
|
38989
|
+
loc = Math.max(0, Math.min(loc, text.length));
|
|
38990
|
+
if (text == pattern2) {
|
|
38991
38991
|
return 0;
|
|
38992
|
-
} else if (!
|
|
38992
|
+
} else if (!text.length) {
|
|
38993
38993
|
return -1;
|
|
38994
|
-
} else if (
|
|
38994
|
+
} else if (text.substring(loc, loc + pattern2.length) == pattern2) {
|
|
38995
38995
|
return loc;
|
|
38996
38996
|
} else {
|
|
38997
|
-
return this.match_bitap_(
|
|
38997
|
+
return this.match_bitap_(text, pattern2, loc);
|
|
38998
38998
|
}
|
|
38999
38999
|
};
|
|
39000
|
-
diff_match_patch.prototype.match_bitap_ = function(
|
|
39000
|
+
diff_match_patch.prototype.match_bitap_ = function(text, pattern2, loc) {
|
|
39001
39001
|
if (pattern2.length > this.Match_MaxBits) {
|
|
39002
39002
|
throw new Error("Pattern too long for this browser.");
|
|
39003
39003
|
}
|
|
@@ -39012,10 +39012,10 @@ function requireDiffMatchPatch() {
|
|
|
39012
39012
|
return accuracy + proximity / dmp.Match_Distance;
|
|
39013
39013
|
}
|
|
39014
39014
|
var score_threshold = this.Match_Threshold;
|
|
39015
|
-
var best_loc =
|
|
39015
|
+
var best_loc = text.indexOf(pattern2, loc);
|
|
39016
39016
|
if (best_loc != -1) {
|
|
39017
39017
|
score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);
|
|
39018
|
-
best_loc =
|
|
39018
|
+
best_loc = text.lastIndexOf(pattern2, loc + pattern2.length);
|
|
39019
39019
|
if (best_loc != -1) {
|
|
39020
39020
|
score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);
|
|
39021
39021
|
}
|
|
@@ -39023,7 +39023,7 @@ function requireDiffMatchPatch() {
|
|
|
39023
39023
|
var matchmask = 1 << pattern2.length - 1;
|
|
39024
39024
|
best_loc = -1;
|
|
39025
39025
|
var bin_min, bin_mid;
|
|
39026
|
-
var bin_max = pattern2.length +
|
|
39026
|
+
var bin_max = pattern2.length + text.length;
|
|
39027
39027
|
var last_rd;
|
|
39028
39028
|
for (var d = 0; d < pattern2.length; d++) {
|
|
39029
39029
|
bin_min = 0;
|
|
@@ -39038,11 +39038,11 @@ function requireDiffMatchPatch() {
|
|
|
39038
39038
|
}
|
|
39039
39039
|
bin_max = bin_mid;
|
|
39040
39040
|
var start = Math.max(1, loc - bin_mid + 1);
|
|
39041
|
-
var finish = Math.min(loc + bin_mid,
|
|
39041
|
+
var finish = Math.min(loc + bin_mid, text.length) + pattern2.length;
|
|
39042
39042
|
var rd = Array(finish + 2);
|
|
39043
39043
|
rd[finish + 1] = (1 << d) - 1;
|
|
39044
39044
|
for (var j = finish; j >= start; j--) {
|
|
39045
|
-
var charMatch = s[
|
|
39045
|
+
var charMatch = s[text.charAt(j - 1)];
|
|
39046
39046
|
if (d === 0) {
|
|
39047
39047
|
rd[j] = (rd[j + 1] << 1 | 1) & charMatch;
|
|
39048
39048
|
} else {
|
|
@@ -39078,28 +39078,28 @@ function requireDiffMatchPatch() {
|
|
|
39078
39078
|
}
|
|
39079
39079
|
return s;
|
|
39080
39080
|
};
|
|
39081
|
-
diff_match_patch.prototype.patch_addContext_ = function(patch,
|
|
39082
|
-
if (
|
|
39081
|
+
diff_match_patch.prototype.patch_addContext_ = function(patch, text) {
|
|
39082
|
+
if (text.length == 0) {
|
|
39083
39083
|
return;
|
|
39084
39084
|
}
|
|
39085
39085
|
if (patch.start2 === null) {
|
|
39086
39086
|
throw Error("patch not initialized");
|
|
39087
39087
|
}
|
|
39088
|
-
var pattern2 =
|
|
39088
|
+
var pattern2 = text.substring(patch.start2, patch.start2 + patch.length1);
|
|
39089
39089
|
var padding = 0;
|
|
39090
|
-
while (
|
|
39090
|
+
while (text.indexOf(pattern2) != text.lastIndexOf(pattern2) && pattern2.length < this.Match_MaxBits - this.Patch_Margin - this.Patch_Margin) {
|
|
39091
39091
|
padding += this.Patch_Margin;
|
|
39092
|
-
pattern2 =
|
|
39092
|
+
pattern2 = text.substring(
|
|
39093
39093
|
patch.start2 - padding,
|
|
39094
39094
|
patch.start2 + patch.length1 + padding
|
|
39095
39095
|
);
|
|
39096
39096
|
}
|
|
39097
39097
|
padding += this.Patch_Margin;
|
|
39098
|
-
var prefix =
|
|
39098
|
+
var prefix = text.substring(patch.start2 - padding, patch.start2);
|
|
39099
39099
|
if (prefix) {
|
|
39100
39100
|
patch.diffs.unshift(new diff_match_patch.Diff(DIFF_EQUAL, prefix));
|
|
39101
39101
|
}
|
|
39102
|
-
var suffix =
|
|
39102
|
+
var suffix = text.substring(
|
|
39103
39103
|
patch.start2 + patch.length1,
|
|
39104
39104
|
patch.start2 + patch.length1 + padding
|
|
39105
39105
|
);
|
|
@@ -39218,13 +39218,13 @@ function requireDiffMatchPatch() {
|
|
|
39218
39218
|
}
|
|
39219
39219
|
return patchesCopy;
|
|
39220
39220
|
};
|
|
39221
|
-
diff_match_patch.prototype.patch_apply = function(patches,
|
|
39221
|
+
diff_match_patch.prototype.patch_apply = function(patches, text) {
|
|
39222
39222
|
if (patches.length == 0) {
|
|
39223
|
-
return [
|
|
39223
|
+
return [text, []];
|
|
39224
39224
|
}
|
|
39225
39225
|
patches = this.patch_deepCopy(patches);
|
|
39226
39226
|
var nullPadding = this.patch_addPadding(patches);
|
|
39227
|
-
|
|
39227
|
+
text = nullPadding + text + nullPadding;
|
|
39228
39228
|
this.patch_splitMax(patches);
|
|
39229
39229
|
var delta = 0;
|
|
39230
39230
|
var results = [];
|
|
@@ -39235,13 +39235,13 @@ function requireDiffMatchPatch() {
|
|
|
39235
39235
|
var end_loc = -1;
|
|
39236
39236
|
if (text1.length > this.Match_MaxBits) {
|
|
39237
39237
|
start_loc = this.match_main(
|
|
39238
|
-
|
|
39238
|
+
text,
|
|
39239
39239
|
text1.substring(0, this.Match_MaxBits),
|
|
39240
39240
|
expected_loc
|
|
39241
39241
|
);
|
|
39242
39242
|
if (start_loc != -1) {
|
|
39243
39243
|
end_loc = this.match_main(
|
|
39244
|
-
|
|
39244
|
+
text,
|
|
39245
39245
|
text1.substring(text1.length - this.Match_MaxBits),
|
|
39246
39246
|
expected_loc + text1.length - this.Match_MaxBits
|
|
39247
39247
|
);
|
|
@@ -39250,7 +39250,7 @@ function requireDiffMatchPatch() {
|
|
|
39250
39250
|
}
|
|
39251
39251
|
}
|
|
39252
39252
|
} else {
|
|
39253
|
-
start_loc = this.match_main(
|
|
39253
|
+
start_loc = this.match_main(text, text1, expected_loc);
|
|
39254
39254
|
}
|
|
39255
39255
|
if (start_loc == -1) {
|
|
39256
39256
|
results[x] = false;
|
|
@@ -39258,16 +39258,16 @@ function requireDiffMatchPatch() {
|
|
|
39258
39258
|
} else {
|
|
39259
39259
|
results[x] = true;
|
|
39260
39260
|
delta = start_loc - expected_loc;
|
|
39261
|
-
var
|
|
39261
|
+
var text2;
|
|
39262
39262
|
if (end_loc == -1) {
|
|
39263
|
-
|
|
39263
|
+
text2 = text.substring(start_loc, start_loc + text1.length);
|
|
39264
39264
|
} else {
|
|
39265
|
-
|
|
39265
|
+
text2 = text.substring(start_loc, end_loc + this.Match_MaxBits);
|
|
39266
39266
|
}
|
|
39267
|
-
if (text1 ==
|
|
39268
|
-
|
|
39267
|
+
if (text1 == text2) {
|
|
39268
|
+
text = text.substring(0, start_loc) + this.diff_text2(patches[x].diffs) + text.substring(start_loc + text1.length);
|
|
39269
39269
|
} else {
|
|
39270
|
-
var diffs = this.diff_main(text1,
|
|
39270
|
+
var diffs = this.diff_main(text1, text2, false);
|
|
39271
39271
|
if (text1.length > this.Match_MaxBits && this.diff_levenshtein(diffs) / text1.length > this.Patch_DeleteThreshold) {
|
|
39272
39272
|
results[x] = false;
|
|
39273
39273
|
} else {
|
|
@@ -39280,9 +39280,9 @@ function requireDiffMatchPatch() {
|
|
|
39280
39280
|
index2 = this.diff_xIndex(diffs, index1);
|
|
39281
39281
|
}
|
|
39282
39282
|
if (mod[0] === DIFF_INSERT) {
|
|
39283
|
-
|
|
39283
|
+
text = text.substring(0, start_loc + index2) + mod[1] + text.substring(start_loc + index2);
|
|
39284
39284
|
} else if (mod[0] === DIFF_DELETE) {
|
|
39285
|
-
|
|
39285
|
+
text = text.substring(0, start_loc + index2) + text.substring(start_loc + this.diff_xIndex(
|
|
39286
39286
|
diffs,
|
|
39287
39287
|
index1 + mod[1].length
|
|
39288
39288
|
));
|
|
@@ -39295,8 +39295,8 @@ function requireDiffMatchPatch() {
|
|
|
39295
39295
|
}
|
|
39296
39296
|
}
|
|
39297
39297
|
}
|
|
39298
|
-
|
|
39299
|
-
return [
|
|
39298
|
+
text = text.substring(nullPadding.length, text.length - nullPadding.length);
|
|
39299
|
+
return [text, results];
|
|
39300
39300
|
};
|
|
39301
39301
|
diff_match_patch.prototype.patch_addPadding = function(patches) {
|
|
39302
39302
|
var paddingLength = this.Patch_Margin;
|
|
@@ -39412,24 +39412,24 @@ function requireDiffMatchPatch() {
|
|
|
39412
39412
|
}
|
|
39413
39413
|
};
|
|
39414
39414
|
diff_match_patch.prototype.patch_toText = function(patches) {
|
|
39415
|
-
var
|
|
39415
|
+
var text = [];
|
|
39416
39416
|
for (var x = 0; x < patches.length; x++) {
|
|
39417
|
-
|
|
39417
|
+
text[x] = patches[x];
|
|
39418
39418
|
}
|
|
39419
|
-
return
|
|
39419
|
+
return text.join("");
|
|
39420
39420
|
};
|
|
39421
39421
|
diff_match_patch.prototype.patch_fromText = function(textline) {
|
|
39422
39422
|
var patches = [];
|
|
39423
39423
|
if (!textline) {
|
|
39424
39424
|
return patches;
|
|
39425
39425
|
}
|
|
39426
|
-
var
|
|
39426
|
+
var text = textline.split("\n");
|
|
39427
39427
|
var textPointer = 0;
|
|
39428
39428
|
var patchHeader = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;
|
|
39429
|
-
while (textPointer <
|
|
39430
|
-
var m =
|
|
39429
|
+
while (textPointer < text.length) {
|
|
39430
|
+
var m = text[textPointer].match(patchHeader);
|
|
39431
39431
|
if (!m) {
|
|
39432
|
-
throw new Error("Invalid patch string: " +
|
|
39432
|
+
throw new Error("Invalid patch string: " + text[textPointer]);
|
|
39433
39433
|
}
|
|
39434
39434
|
var patch = new diff_match_patch.patch_obj();
|
|
39435
39435
|
patches.push(patch);
|
|
@@ -39454,10 +39454,10 @@ function requireDiffMatchPatch() {
|
|
|
39454
39454
|
patch.length2 = parseInt(m[4], 10);
|
|
39455
39455
|
}
|
|
39456
39456
|
textPointer++;
|
|
39457
|
-
while (textPointer <
|
|
39458
|
-
var sign =
|
|
39457
|
+
while (textPointer < text.length) {
|
|
39458
|
+
var sign = text[textPointer].charAt(0);
|
|
39459
39459
|
try {
|
|
39460
|
-
var line = decodeURI(
|
|
39460
|
+
var line = decodeURI(text[textPointer].substring(1));
|
|
39461
39461
|
} catch (ex) {
|
|
39462
39462
|
throw new Error("Illegal escape in patch_fromText: " + line);
|
|
39463
39463
|
}
|
|
@@ -39501,7 +39501,7 @@ function requireDiffMatchPatch() {
|
|
|
39501
39501
|
} else {
|
|
39502
39502
|
coords2 = this.start2 + 1 + "," + this.length2;
|
|
39503
39503
|
}
|
|
39504
|
-
var
|
|
39504
|
+
var text = ["@@ -" + coords1 + " +" + coords2 + " @@\n"];
|
|
39505
39505
|
var op;
|
|
39506
39506
|
for (var x = 0; x < this.diffs.length; x++) {
|
|
39507
39507
|
switch (this.diffs[x][0]) {
|
|
@@ -39515,9 +39515,9 @@ function requireDiffMatchPatch() {
|
|
|
39515
39515
|
op = " ";
|
|
39516
39516
|
break;
|
|
39517
39517
|
}
|
|
39518
|
-
|
|
39518
|
+
text[x + 1] = op + encodeURI(this.diffs[x][1]) + "\n";
|
|
39519
39519
|
}
|
|
39520
|
-
return
|
|
39520
|
+
return text.join("").replace(/%20/g, " ");
|
|
39521
39521
|
};
|
|
39522
39522
|
module.exports = diff_match_patch;
|
|
39523
39523
|
module.exports["diff_match_patch"] = diff_match_patch;
|
|
@@ -39625,7 +39625,7 @@ class MergeButtonWidget extends WidgetType {
|
|
|
39625
39625
|
return container;
|
|
39626
39626
|
}
|
|
39627
39627
|
// 실제 변경 적용 로직
|
|
39628
|
-
applyChanges(
|
|
39628
|
+
applyChanges(text, editorView, range) {
|
|
39629
39629
|
if (!editorView || !range) {
|
|
39630
39630
|
trace.error("Target editor view or range is undefined.", editorView, range);
|
|
39631
39631
|
return;
|
|
@@ -39634,7 +39634,7 @@ class MergeButtonWidget extends WidgetType {
|
|
|
39634
39634
|
changes: {
|
|
39635
39635
|
from: range.from,
|
|
39636
39636
|
to: range.to,
|
|
39637
|
-
insert:
|
|
39637
|
+
insert: text
|
|
39638
39638
|
}
|
|
39639
39639
|
});
|
|
39640
39640
|
requestAnimationFrame(() => {
|
|
@@ -39788,16 +39788,16 @@ class NineDiff extends HTMLElement {
|
|
|
39788
39788
|
const insertedLineDeco = Decoration.line({ class: "cm-inserted-line-bg" });
|
|
39789
39789
|
const deletedLineDeco = Decoration.line({ class: "cm-deleted-line-bg" });
|
|
39790
39790
|
const currentInstance = this;
|
|
39791
|
-
for (const [op,
|
|
39792
|
-
const len =
|
|
39791
|
+
for (const [op, text] of diffs) {
|
|
39792
|
+
const len = text.length;
|
|
39793
39793
|
const asisRangeStart = asisCursor;
|
|
39794
39794
|
const tobeRangeStart = tobeCursor;
|
|
39795
39795
|
switch (op) {
|
|
39796
39796
|
case diffMatchPatchExports.diff_match_patch.DIFF_INSERT:
|
|
39797
|
-
trace.log("DIFF_INSERT (TOBE added):", JSON.stringify(
|
|
39798
|
-
const tobeLines =
|
|
39797
|
+
trace.log("DIFF_INSERT (TOBE added):", JSON.stringify(text));
|
|
39798
|
+
const tobeLines = text.split("\n");
|
|
39799
39799
|
for (let i = 0; i < tobeLines.length; i++) {
|
|
39800
|
-
if (!(i === tobeLines.length - 1 && tobeLines[i] === "" &&
|
|
39800
|
+
if (!(i === tobeLines.length - 1 && tobeLines[i] === "" && text.endsWith("\n"))) {
|
|
39801
39801
|
tobeLineBuilder.add(tobeCursor, tobeCursor, insertedLineDeco);
|
|
39802
39802
|
}
|
|
39803
39803
|
tobeCursor += tobeLines[i].length + (i < tobeLines.length - 1 ? 1 : 0);
|
|
@@ -39809,7 +39809,7 @@ class NineDiff extends HTMLElement {
|
|
|
39809
39809
|
widget: new MergeButtonWidget(
|
|
39810
39810
|
false,
|
|
39811
39811
|
// 이 버튼은 TOBE 에디터에 붙는 버튼
|
|
39812
|
-
|
|
39812
|
+
text,
|
|
39813
39813
|
// AI가 추가한 내용을 ASIS에 '삽입'
|
|
39814
39814
|
__privateGet(currentInstance, _asisEditorView),
|
|
39815
39815
|
// 대상 에디터는 ASIS (현재 소스)
|
|
@@ -39822,10 +39822,10 @@ class NineDiff extends HTMLElement {
|
|
|
39822
39822
|
);
|
|
39823
39823
|
break;
|
|
39824
39824
|
case diffMatchPatchExports.diff_match_patch.DIFF_DELETE:
|
|
39825
|
-
trace.log("DIFF_DELETE (ASIS deleted):", JSON.stringify(
|
|
39826
|
-
const asisLines =
|
|
39825
|
+
trace.log("DIFF_DELETE (ASIS deleted):", JSON.stringify(text));
|
|
39826
|
+
const asisLines = text.split("\n");
|
|
39827
39827
|
for (let i = 0; i < asisLines.length; i++) {
|
|
39828
|
-
if (!(i === asisLines.length - 1 && asisLines[i] === "" &&
|
|
39828
|
+
if (!(i === asisLines.length - 1 && asisLines[i] === "" && text.endsWith("\n"))) {
|
|
39829
39829
|
asisLineBuilder.add(asisCursor, asisCursor, deletedLineDeco);
|
|
39830
39830
|
}
|
|
39831
39831
|
asisCursor += asisLines[i].length + (i < asisLines.length - 1 ? 1 : 0);
|
|
@@ -39841,7 +39841,7 @@ class NineDiff extends HTMLElement {
|
|
|
39841
39841
|
// ASIS에서 해당 내용을 '제거'하므로 삽입할 텍스트는 없음
|
|
39842
39842
|
__privateGet(currentInstance, _asisEditorView),
|
|
39843
39843
|
// 대상 에디터는 ASIS (현재 소스)
|
|
39844
|
-
{ from: asisRangeStart, to: asisRangeStart +
|
|
39844
|
+
{ from: asisRangeStart, to: asisRangeStart + text.length },
|
|
39845
39845
|
// ASIS에서 '삭제될' 범위
|
|
39846
39846
|
currentInstance
|
|
39847
39847
|
),
|
|
@@ -39937,7 +39937,7 @@ class NineDiff extends HTMLElement {
|
|
|
39937
39937
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
39938
39938
|
this.shadowRoot.innerHTML = `
|
|
39939
39939
|
<style>
|
|
39940
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
39940
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.133"}/dist/css/nine-mu.css";
|
|
39941
39941
|
${customImport}
|
|
39942
39942
|
</style>
|
|
39943
39943
|
|
|
@@ -40047,7 +40047,7 @@ render_fn2 = function() {
|
|
|
40047
40047
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
40048
40048
|
this.shadowRoot.innerHTML = `
|
|
40049
40049
|
<style>
|
|
40050
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
40050
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.133"}/dist/css/nine-mu.css";
|
|
40051
40051
|
${customImport}
|
|
40052
40052
|
</style>
|
|
40053
40053
|
|
|
@@ -40086,7 +40086,7 @@ handleCancel_fn = function() {
|
|
|
40086
40086
|
};
|
|
40087
40087
|
customElements.define("nine-diff-popup", NineDiffPopup);
|
|
40088
40088
|
const NineMu = {
|
|
40089
|
-
version: "0.1.
|
|
40089
|
+
version: "0.1.133",
|
|
40090
40090
|
init: (config2) => {
|
|
40091
40091
|
trace$1.log("🛠️ Nine-Mu Engine initialized", config2);
|
|
40092
40092
|
}
|