@lvce-editor/editor-worker 19.60.2 → 19.60.3
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/editorWorkerMain.js +68 -20
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -12231,25 +12231,6 @@ const getBlockCommentEdits = (editor, blockComment) => {
|
|
|
12231
12231
|
return changes;
|
|
12232
12232
|
};
|
|
12233
12233
|
|
|
12234
|
-
const toggleBlockComment = async editor => {
|
|
12235
|
-
const offset = getOffsetAtCursor$1(editor);
|
|
12236
|
-
const blockComment = await getBlockComment(editor, offset);
|
|
12237
|
-
if (!blockComment) {
|
|
12238
|
-
return editor;
|
|
12239
|
-
}
|
|
12240
|
-
const edits = getBlockCommentEdits(editor, blockComment);
|
|
12241
|
-
return scheduleDocument(editor, edits);
|
|
12242
|
-
};
|
|
12243
|
-
|
|
12244
|
-
const toggleBreakpoint = editor => {
|
|
12245
|
-
const [rowIndex] = editor.selections;
|
|
12246
|
-
const breakPoints = editor.breakPoints.includes(rowIndex) ? editor.breakPoints.filter(breakPoint => breakPoint !== rowIndex) : [...editor.breakPoints, rowIndex];
|
|
12247
|
-
return {
|
|
12248
|
-
...editor,
|
|
12249
|
-
breakPoints
|
|
12250
|
-
};
|
|
12251
|
-
};
|
|
12252
|
-
|
|
12253
12234
|
const getLineComment = async editor => {
|
|
12254
12235
|
const languageConfiguration = await getLanguageConfiguration(editor);
|
|
12255
12236
|
if (!languageConfiguration?.comments?.lineComment) {
|
|
@@ -12308,6 +12289,72 @@ const getLineCommentEdit = (rowIndex, line, lineComment) => {
|
|
|
12308
12289
|
};
|
|
12309
12290
|
};
|
|
12310
12291
|
|
|
12292
|
+
const getSelectedLineCommentEdits = (editor, lineComment) => {
|
|
12293
|
+
const {
|
|
12294
|
+
lines,
|
|
12295
|
+
selections
|
|
12296
|
+
} = editor;
|
|
12297
|
+
const selectedRows = new Set();
|
|
12298
|
+
for (let i = 0; i < selections.length; i += 4) {
|
|
12299
|
+
const startRow = Math.min(selections[i], selections[i + 2]);
|
|
12300
|
+
let endRow = Math.max(selections[i], selections[i + 2]);
|
|
12301
|
+
const endColumn = selections[i + (selections[i] > selections[i + 2] ? 1 : 3)];
|
|
12302
|
+
if (endRow > startRow && endColumn === 0) {
|
|
12303
|
+
endRow--;
|
|
12304
|
+
}
|
|
12305
|
+
for (let row = startRow; row <= endRow; row++) {
|
|
12306
|
+
if (lines[row].trim()) {
|
|
12307
|
+
selectedRows.add(row);
|
|
12308
|
+
}
|
|
12309
|
+
}
|
|
12310
|
+
}
|
|
12311
|
+
const rows = [...selectedRows].toSorted((a, b) => a - b);
|
|
12312
|
+
const remove = rows.every(row => lines[row].trimStart().startsWith(lineComment));
|
|
12313
|
+
return rows.map(rowIndex => {
|
|
12314
|
+
const line = lines[rowIndex];
|
|
12315
|
+
if (remove) {
|
|
12316
|
+
return getLineCommentEdit(rowIndex, line, lineComment);
|
|
12317
|
+
}
|
|
12318
|
+
const columnIndex = line.length - line.trimStart().length;
|
|
12319
|
+
return {
|
|
12320
|
+
deleted: [''],
|
|
12321
|
+
end: {
|
|
12322
|
+
columnIndex,
|
|
12323
|
+
rowIndex
|
|
12324
|
+
},
|
|
12325
|
+
inserted: [`${lineComment} `],
|
|
12326
|
+
origin: ToggleBlockComment$1,
|
|
12327
|
+
start: {
|
|
12328
|
+
columnIndex,
|
|
12329
|
+
rowIndex
|
|
12330
|
+
}
|
|
12331
|
+
};
|
|
12332
|
+
});
|
|
12333
|
+
};
|
|
12334
|
+
|
|
12335
|
+
const toggleBlockComment = async editor => {
|
|
12336
|
+
const offset = getOffsetAtCursor$1(editor);
|
|
12337
|
+
const blockComment = await getBlockComment(editor, offset);
|
|
12338
|
+
if (!blockComment) {
|
|
12339
|
+
const lineComment = await getLineComment(editor);
|
|
12340
|
+
if (!lineComment) {
|
|
12341
|
+
return editor;
|
|
12342
|
+
}
|
|
12343
|
+
return scheduleDocumentAndCursorsSelections(editor, getSelectedLineCommentEdits(editor, lineComment));
|
|
12344
|
+
}
|
|
12345
|
+
const edits = getBlockCommentEdits(editor, blockComment);
|
|
12346
|
+
return scheduleDocument(editor, edits);
|
|
12347
|
+
};
|
|
12348
|
+
|
|
12349
|
+
const toggleBreakpoint = editor => {
|
|
12350
|
+
const [rowIndex] = editor.selections;
|
|
12351
|
+
const breakPoints = editor.breakPoints.includes(rowIndex) ? editor.breakPoints.filter(breakPoint => breakPoint !== rowIndex) : [...editor.breakPoints, rowIndex];
|
|
12352
|
+
return {
|
|
12353
|
+
...editor,
|
|
12354
|
+
breakPoints
|
|
12355
|
+
};
|
|
12356
|
+
};
|
|
12357
|
+
|
|
12311
12358
|
const editorToggleLineComment = async editor => {
|
|
12312
12359
|
const lineComment = await getLineComment(editor);
|
|
12313
12360
|
if (!lineComment) {
|
|
@@ -14908,10 +14955,10 @@ ${editorSelector} .GutterRows {
|
|
|
14908
14955
|
}
|
|
14909
14956
|
${editorSelector} .EditorRow,
|
|
14910
14957
|
${editorSelector} .LineNumber {
|
|
14911
|
-
contain: size style;
|
|
14912
14958
|
flex: none;
|
|
14913
14959
|
}
|
|
14914
14960
|
${editorSelector} .EditorRow {
|
|
14961
|
+
contain: size style;
|
|
14915
14962
|
height: var(--EditorRowHeight);
|
|
14916
14963
|
line-height: var(--EditorRowHeight);
|
|
14917
14964
|
}
|
|
@@ -14956,6 +15003,7 @@ ${editorSelector} .EditorLineDecoration {
|
|
|
14956
15003
|
user-select: none;
|
|
14957
15004
|
}
|
|
14958
15005
|
${editorSelector} .LineNumber {
|
|
15006
|
+
contain: content;
|
|
14959
15007
|
position: relative;
|
|
14960
15008
|
}
|
|
14961
15009
|
${editorSelector} .EditorGutterDecoration {
|