diff --git a/public/src/components/Editor/Editor.ts b/public/src/components/Editor/Editor.ts index 7a2ce951..1d4cf31f 100644 --- a/public/src/components/Editor/Editor.ts +++ b/public/src/components/Editor/Editor.ts @@ -82,7 +82,7 @@ export class Editor { } const scanTree = (node: HTMLElement) => { - if (`cursor${AppUserStore.state.username}` in node.dataset) { + if (`cursor${AppUserStore.state.username}-${AppNotesStore.socket_id.toString()}` in node.dataset) { delete node.dataset[`cursor${AppUserStore.state.username}-${AppNotesStore.socket_id.toString()}`]; } diff --git a/public/src/components/Editor/Plugin.ts b/public/src/components/Editor/Plugin.ts index 4ac86458..1c2b607a 100644 --- a/public/src/components/Editor/Plugin.ts +++ b/public/src/components/Editor/Plugin.ts @@ -846,12 +846,12 @@ export const fromJson = (props: PluginProps) => { } } - if (`cursor${AppUserStore.state.username}` in props) { + if (`cursor${AppUserStore.state.username}-${AppNotesStore.socket_id.toString()}` in props) { // const regex = /([a-zA]+)-([\d]+)/; // const matches = regex.exec(props.cursor as string); - if (props[`cursor${AppUserStore.state.username}`] === '0') { + if (props[`cursor${AppUserStore.state.username}-${AppNotesStore.socket_id.toString()}`] === '0') { setTimeout(() => { setCursorAtNodePosition(node, 0); // (node as HTMLElement).click(); @@ -860,7 +860,7 @@ export const fromJson = (props: PluginProps) => { } else { setTimeout(() => { - setCursorAtNodePosition(node, Number(props[`cursor${AppUserStore.state.username}`])); + setCursorAtNodePosition(node, Number(props[`cursor${AppUserStore.state.username}-${AppNotesStore.socket_id.toString()}`])); // (node as HTMLElement).click(); // document.getSelection().setPosition(node.firstChild, Number(props[`cursor${AppUserStore.state.username}`])); })