@lvce-editor/editor-worker 19.41.2 → 19.42.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/editorWorkerMain.js +27 -3
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -14293,9 +14293,19 @@ const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences, lineN
|
|
|
14293
14293
|
const getEditorScrollBarDiagnosticsVirtualDom = scrollBarDiagnostics => {
|
|
14294
14294
|
return [{
|
|
14295
14295
|
childCount: scrollBarDiagnostics.length,
|
|
14296
|
-
className: '
|
|
14296
|
+
className: 'ScrollBarDiagnostics',
|
|
14297
14297
|
type: Div
|
|
14298
|
-
}, ...
|
|
14298
|
+
}, ...scrollBarDiagnostics.map(({
|
|
14299
|
+
height,
|
|
14300
|
+
top,
|
|
14301
|
+
type
|
|
14302
|
+
}) => ({
|
|
14303
|
+
childCount: 0,
|
|
14304
|
+
className: type === 'warning' ? 'ScrollBarDiagnostic ScrollBarDiagnosticWarning' : 'ScrollBarDiagnostic ScrollBarDiagnosticError',
|
|
14305
|
+
height,
|
|
14306
|
+
top,
|
|
14307
|
+
type: Div
|
|
14308
|
+
}))];
|
|
14299
14309
|
};
|
|
14300
14310
|
|
|
14301
14311
|
const verticalScrollBarNode = {
|
|
@@ -14505,6 +14515,18 @@ const getEditorVirtualDom = ({
|
|
|
14505
14515
|
}), ...minimapDom];
|
|
14506
14516
|
};
|
|
14507
14517
|
|
|
14518
|
+
const getScrollBarDiagnostics = (editor, diagnostics) => {
|
|
14519
|
+
const height = editor.height || 0;
|
|
14520
|
+
const lineCount = Math.max(editor.lines?.length || 0, 1);
|
|
14521
|
+
const markerHeight = 3;
|
|
14522
|
+
const scrollBarDecorations = Array.from(diagnostics, diagnostic => ({
|
|
14523
|
+
height: markerHeight,
|
|
14524
|
+
top: Math.min(Math.round(diagnostic.rowIndex / lineCount * height), Math.max(height - markerHeight, 0)),
|
|
14525
|
+
type: diagnostic.type
|
|
14526
|
+
}));
|
|
14527
|
+
return scrollBarDecorations;
|
|
14528
|
+
};
|
|
14529
|
+
|
|
14508
14530
|
const renderedDoms = new Map();
|
|
14509
14531
|
const get = uid => {
|
|
14510
14532
|
return renderedDoms.get(uid);
|
|
@@ -14515,6 +14537,7 @@ const set = (uid, dom) => {
|
|
|
14515
14537
|
|
|
14516
14538
|
const getDom = state => {
|
|
14517
14539
|
const {
|
|
14540
|
+
diagnostics = [],
|
|
14518
14541
|
initial,
|
|
14519
14542
|
textInfos,
|
|
14520
14543
|
visualDecorations = []
|
|
@@ -14524,7 +14547,8 @@ const getDom = state => {
|
|
|
14524
14547
|
}
|
|
14525
14548
|
return getEditorVirtualDom({
|
|
14526
14549
|
...state,
|
|
14527
|
-
diagnostics: visualDecorations
|
|
14550
|
+
diagnostics: visualDecorations,
|
|
14551
|
+
scrollBarDiagnostics: getScrollBarDiagnostics(state, diagnostics)
|
|
14528
14552
|
});
|
|
14529
14553
|
};
|
|
14530
14554
|
const renderIncremental = (oldState, newState) => {
|