@bangle.dev/collab-client
Advanced tools
Comparing version 0.17.1 to 0.17.2
@@ -8,3 +8,9 @@ import { | ||
import { Step } from 'prosemirror-transform'; | ||
import { EditorState, Plugin, PluginKey, Selection } from 'prosemirror-state'; | ||
import { | ||
EditorState, | ||
Plugin, | ||
PluginKey, | ||
Selection, | ||
TextSelection, | ||
} from 'prosemirror-state'; | ||
import { EditorView } from 'prosemirror-view'; | ||
@@ -478,6 +484,12 @@ import { replaceDocument } from './helpers'; | ||
const { doc, version, managerId } = getDocumentResponse; | ||
const prevSelection = | ||
view.state.selection instanceof TextSelection | ||
? view.state.selection | ||
: undefined; | ||
let tr = replaceDocument(view.state, doc, version); | ||
if (oldSelection) { | ||
let { from } = oldSelection; | ||
const selection = oldSelection || prevSelection; | ||
if (selection) { | ||
let { from } = selection; | ||
if (from >= tr.doc.content.size) { | ||
@@ -484,0 +496,0 @@ tr = tr.setSelection(Selection.atEnd(tr.doc)); |
import { collab, receiveTransaction, getVersion, sendableSteps, } from 'prosemirror-collab'; | ||
import { Step } from 'prosemirror-transform'; | ||
import { Plugin, PluginKey, Selection } from 'prosemirror-state'; | ||
import { Plugin, PluginKey, Selection, TextSelection, } from 'prosemirror-state'; | ||
import { replaceDocument } from './helpers'; | ||
@@ -312,5 +312,9 @@ import { CollabError, getIdleCallback, sleep, uuid, cancelablePromise, serialExecuteQueue, } from '@bangle.dev/collab-server'; | ||
const { doc, version, managerId } = getDocumentResponse; | ||
const prevSelection = view.state.selection instanceof TextSelection | ||
? view.state.selection | ||
: undefined; | ||
let tr = replaceDocument(view.state, doc, version); | ||
if (oldSelection) { | ||
let { from } = oldSelection; | ||
const selection = oldSelection || prevSelection; | ||
if (selection) { | ||
let { from } = selection; | ||
if (from >= tr.doc.content.size) { | ||
@@ -317,0 +321,0 @@ tr = tr.setSelection(Selection.atEnd(tr.doc)); |
{ | ||
"name": "@bangle.dev/collab-client", | ||
"version": "0.17.1", | ||
"version": "0.17.2", | ||
"homepage": "https://bangle.dev", | ||
@@ -38,5 +38,5 @@ "authors": [ | ||
"devDependencies": { | ||
"@bangle.dev/collab-server": "0.17.1", | ||
"@bangle.dev/core": "0.17.1", | ||
"@bangle.dev/disk": "0.17.1", | ||
"@bangle.dev/collab-server": "0.17.2", | ||
"@bangle.dev/core": "0.17.2", | ||
"@bangle.dev/disk": "0.17.2", | ||
"@types/jest": "^26.0.23", | ||
@@ -43,0 +43,0 @@ "@types/node": "^15.6.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
123418
2643