13 lines
289 B
TypeScript
13 lines
289 B
TypeScript
import { StateEffect } from "@codemirror/state";
|
|
export type Cursor = {
|
|
pos: number;
|
|
userId: string;
|
|
color: string;
|
|
};
|
|
|
|
export const cursorEffect = StateEffect.define<Cursor>({
|
|
map({ pos, userId, color }, changes) {
|
|
return { pos: changes.mapPos(pos), userId, color };
|
|
},
|
|
});
|