Rename types
This commit is contained in:
parent
26cd95cfda
commit
49f2d69e59
6 changed files with 13 additions and 11 deletions
|
|
@ -9,10 +9,7 @@ import type {
|
||||||
ViewUpdate
|
ViewUpdate
|
||||||
} from "@codemirror/view";
|
} from "@codemirror/view";
|
||||||
import { RemoteCursorWidget } from "./remote-cursor-widget";
|
import { RemoteCursorWidget } from "./remote-cursor-widget";
|
||||||
import type {
|
import type { CursorSpan, MaybeOutdatedClientCursors } from "sync-client";
|
||||||
CursorSpan,
|
|
||||||
DocumentWithMaybeOutdatedClientCursors
|
|
||||||
} from "sync-client";
|
|
||||||
import type { App } from "obsidian";
|
import type { App } from "obsidian";
|
||||||
import { MarkdownView } from "obsidian";
|
import { MarkdownView } from "obsidian";
|
||||||
|
|
||||||
|
|
@ -120,7 +117,7 @@ export const remoteCursorsPlugin = ViewPlugin.fromClass(
|
||||||
);
|
);
|
||||||
|
|
||||||
export function setCursors(
|
export function setCursors(
|
||||||
clients: DocumentWithMaybeOutdatedClientCursors[],
|
clients: MaybeOutdatedClientCursors[],
|
||||||
app: App
|
app: App
|
||||||
): void {
|
): void {
|
||||||
cursors = [
|
cursors = [
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import type { Workspace } from "obsidian";
|
import type { Workspace } from "obsidian";
|
||||||
import { FileView, setIcon } from "obsidian";
|
import { FileView, setIcon } from "obsidian";
|
||||||
import type { SyncClient } from "sync-client";
|
import type { SyncClient } from "sync-client";
|
||||||
import { DocumentUpdateStatus } from "sync-client";
|
import { DocumentSyncStatus } from "sync-client";
|
||||||
import "./editor-sync-line.scss";
|
import "./editor-sync-line.scss";
|
||||||
|
|
||||||
export function updateEditorStatusDisplay(
|
export function updateEditorStatusDisplay(
|
||||||
|
|
@ -35,7 +35,7 @@ export function updateEditorStatusDisplay(
|
||||||
|
|
||||||
const isLoading =
|
const isLoading =
|
||||||
client.getDocumentSyncingStatus(filePath) ==
|
client.getDocumentSyncingStatus(filePath) ==
|
||||||
DocumentUpdateStatus.SYNCING;
|
DocumentSyncStatus.SYNCING;
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
element.classList.add("loading");
|
element.classList.add("loading");
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ export type { PersistenceProvider } from "./persistence/persistence";
|
||||||
export type { CursorSpan } from "./services/types/CursorSpan";
|
export type { CursorSpan } from "./services/types/CursorSpan";
|
||||||
export type { ClientCursors } from "./services/types/ClientCursors";
|
export type { ClientCursors } from "./services/types/ClientCursors";
|
||||||
export type { NetworkConnectionStatus } from "./types/network-connection-status";
|
export type { NetworkConnectionStatus } from "./types/network-connection-status";
|
||||||
export type { DocumentWithMaybeOutdatedClientCursors } from "./types/maybe-outdated-client-cursors";
|
export type { MaybeOutdatedClientCursors } from "./types/maybe-outdated-client-cursors";
|
||||||
export { DocumentUpdateStatus } from "./types/document-update-status";
|
export { DocumentSyncStatus } from "./types/document-sync-status";
|
||||||
export { SyncClient } from "./sync-client";
|
export { SyncClient } from "./sync-client";
|
||||||
|
|
||||||
import { Locks } from "./utils/locks";
|
import { Locks } from "./utils/locks";
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
export enum DocumentUpdateStatus {
|
export enum DocumentSyncStatus {
|
||||||
UP_TO_DATE = "UP_TO_DATE",
|
UP_TO_DATE = "UP_TO_DATE",
|
||||||
SYNCING = "SYNCING"
|
SYNCING = "SYNCING"
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
export enum DocumentUpToDateness {
|
||||||
|
UpToDate = "UpToDate", // easiest case, the client can just show the cursors as-is
|
||||||
|
Prior = "Prior", // The cursors are outdated, so the client has to guess the cursor positions based on local updates. This is only possible if this client's cursor has once been up-to-date in a given document.
|
||||||
|
Later = "Later" // The cursors are from a future version of a document, there's no way we can accuratly show them locally.
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import type { ClientCursors } from "../services/types/ClientCursors";
|
import type { ClientCursors } from "../services/types/ClientCursors";
|
||||||
|
|
||||||
export interface DocumentWithMaybeOutdatedClientCursors extends ClientCursors {
|
export interface MaybeOutdatedClientCursors extends ClientCursors {
|
||||||
isOutdated: boolean;
|
isOutdated: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue