Skip to content

Commit 9c19c75

Browse files
committed
format
1 parent 4c5598d commit 9c19c75

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/sync-plugin.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { configLoroTextStyle } from "./text-style";
3333
import { loroUndoPluginKey } from "./undo-plugin";
3434

3535
export const loroSyncPluginKey = new PluginKey<LoroSyncPluginState>(
36-
"loro-sync"
36+
"loro-sync",
3737
);
3838

3939
type PluginTransactionType =
@@ -85,7 +85,7 @@ export const LoroSyncPlugin = (props: LoroSyncPluginProps): Plugin => {
8585
},
8686
apply: (tr, state, oldEditorState, newEditorState) => {
8787
const meta = tr.getMeta(
88-
loroSyncPluginKey
88+
loroSyncPluginKey,
8989
) as PluginTransactionType | null;
9090
const undoState = loroUndoPluginKey.getState(oldEditorState);
9191

@@ -101,7 +101,7 @@ export const LoroSyncPlugin = (props: LoroSyncPluginProps): Plugin => {
101101
state.doc as LoroDocType,
102102
state.mapping,
103103
newEditorState,
104-
props.containerId
104+
props.containerId,
105105
);
106106
}
107107
break;
@@ -154,13 +154,13 @@ function init(view: EditorView) {
154154
});
155155
} else {
156156
docSubscription = state.doc.subscribe((event) =>
157-
updateNodeOnLoroEvent(view, event)
157+
updateNodeOnLoroEvent(view, event),
158158
);
159159
}
160160

161161
const innerDoc = state.containerId
162162
? (state.doc.getContainerById(
163-
state.containerId
163+
state.containerId,
164164
) as LoroMap<LoroNodeContainerType>)
165165
: (state.doc as LoroDocType).getMap(ROOT_DOC_KEY);
166166

@@ -179,12 +179,12 @@ function init(view: EditorView) {
179179
const node = createNodeFromLoroObj(
180180
schema,
181181
innerDoc as LoroMap<LoroNodeContainerType>,
182-
mapping
182+
mapping,
183183
);
184184
const tr = view.state.tr.replace(
185185
0,
186186
view.state.doc.content.size,
187-
new Slice(Fragment.from(node), 0, 0)
187+
new Slice(Fragment.from(node), 0, 0),
188188
);
189189
tr.setMeta(loroSyncPluginKey, {
190190
type: "update-state",
@@ -207,21 +207,21 @@ function updateNodeOnLoroEvent(view: EditorView, event: LoroEventBatch) {
207207
view.state.schema,
208208
state.containerId
209209
? (state.doc.getContainerById(
210-
state.containerId
210+
state.containerId,
211211
) as LoroMap<LoroNodeContainerType>)
212212
: (state.doc as LoroDocType).getMap(ROOT_DOC_KEY),
213-
mapping
213+
mapping,
214214
);
215215
const { anchor, focus } = convertPmSelectionToCursors(
216216
view.state.doc,
217217
view.state.selection,
218-
state
218+
state,
219219
);
220220

221221
let tr = view.state.tr.replace(
222222
0,
223223
view.state.doc.content.size,
224-
new Slice(Fragment.from(node), 0, 0)
224+
new Slice(Fragment.from(node), 0, 0),
225225
);
226226

227227
tr.setMeta(loroSyncPluginKey, {
@@ -243,7 +243,7 @@ function updateNodeOnLoroEvent(view: EditorView, event: LoroEventBatch) {
243243
export function syncCursorsToPmSelection(
244244
view: EditorView,
245245
anchor: Cursor,
246-
focus?: Cursor
246+
focus?: Cursor,
247247
) {
248248
const state = loroSyncPluginKey.getState(view.state);
249249
if (!state) {

src/undo-plugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface LoroUndoPluginProps {
1818
}
1919

2020
export const loroUndoPluginKey = new PluginKey<LoroUndoPluginState>(
21-
"loro-undo"
21+
"loro-undo",
2222
);
2323

2424
interface LoroUndoPluginState {
@@ -61,7 +61,7 @@ export const LoroUndoPlugin = (props: LoroUndoPluginProps): Plugin => {
6161
const { anchor, focus } = convertPmSelectionToCursors(
6262
oldEditorState.doc,
6363
oldEditorState.selection,
64-
loroState
64+
loroState,
6565
);
6666
lastSelection = {
6767
anchor: anchor ?? null,
@@ -94,7 +94,7 @@ export const LoroUndoPlugin = (props: LoroUndoPluginProps): Plugin => {
9494
const { anchor, focus } = convertPmSelectionToCursors(
9595
view.state.doc,
9696
view.state.selection,
97-
loroState
97+
loroState,
9898
);
9999
selection.anchor = anchor || null;
100100
selection.focus = focus || null;

0 commit comments

Comments
 (0)