Skip to content

Commit

Permalink
Rename current cursor to local cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
boschDev authored May 19, 2020
1 parent 6145224 commit d504146
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plugins/sync-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export class ProsemirrorBinding {
this._domSelectionInView = null
}

_isCurrentCursorInView() {
_isLocalCursorInView() {
if (!this.prosemirrorView.hasFocus()) return false
if (environment.isBrowser && this._domSelectionInView === null) {
// Calculte the domSelectionInView and clear by next tick after all events are finished
Expand Down Expand Up @@ -362,7 +362,7 @@ export class ProsemirrorBinding {
let tr = this.prosemirrorView.state.tr.replace(0, this.prosemirrorView.state.doc.content.size, new PModel.Slice(new PModel.Fragment(fragmentContent), 0, 0))
restoreRelativeSelection(tr, this.beforeTransactionSelection, this)
tr = tr.setMeta(ySyncPluginKey, { isChangeOrigin: true })
if (this.beforeTransactionSelection !== null && this._isCurrentCursorInView()) {
if (this.beforeTransactionSelection !== null && this._isLocalCursorInView()) {
tr.scrollIntoView()
}
this.prosemirrorView.dispatch(tr)
Expand Down

0 comments on commit d504146

Please sign in to comment.