mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-24 06:20:20 -05:00
refac
This commit is contained in:
1 parent
d49bdc5257
commit
097ecdb69b
2 files changed
+32
-4
No files matched your search
@@ -30,11 +30,22 @@ export const lineAlignment = StateField.define<DecorationSet>({
|
||||
create: () => Decoration.none,
|
||||
update: (value, transaction) => {
|
||||
for (const effect of transaction.effects) if (effect.is(setSpacers)) return effect.value;
|
||||
return value.map(transaction.changes);
|
||||
return transaction.docChanged ? Decoration.none : value;
|
||||
},
|
||||
provide: (field) => EditorView.decorations.from(field)
|
||||
});
|
||||
|
||||
export function clearLineAlignment(a: EditorView, b: EditorView) {
|
||||
let changed = false;
|
||||
for (const view of [a, b]) {
|
||||
if (view.state.field(lineAlignment).size) {
|
||||
view.dispatch({ effects: setSpacers.of(Decoration.none) });
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
// Only remeasure paired rows present in both virtualized viewports. Recomputing
|
||||
// offscreen spacers from estimated heights would move already aligned content.
|
||||
export function alignChangedLines(a: EditorView, b: EditorView, chunks: readonly Chunk[]) {
|
||||
|
||||
Reference in new issue
Block a user