Merge branch 'master' of https://github.com/y-js/yjs
This commit is contained in:
commit
9e816806fc
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yjs",
|
"name": "yjs",
|
||||||
"version": "13.0.0-63",
|
"version": "13.0.0-66",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yjs",
|
"name": "yjs",
|
||||||
"version": "13.0.0-63",
|
"version": "13.0.0-66",
|
||||||
"description": "A framework for real-time p2p shared editing on any data",
|
"description": "A framework for real-time p2p shared editing on any data",
|
||||||
"main": "./y.node.js",
|
"main": "./y.node.js",
|
||||||
"browser": "./y.js",
|
"browser": "./y.js",
|
||||||
|
@ -140,7 +140,6 @@ export default class DomBinding extends Binding {
|
|||||||
restoreSelection (selection) {
|
restoreSelection (selection) {
|
||||||
if (selection !== null) {
|
if (selection !== null) {
|
||||||
const { to, from } = selection
|
const { to, from } = selection
|
||||||
let shouldUpdate = false
|
|
||||||
/**
|
/**
|
||||||
* There is little information on the difference between anchor/focus and base/extent.
|
* There is little information on the difference between anchor/focus and base/extent.
|
||||||
* MDN doesn't even mention base/extent anymore.. though you still have to call
|
* MDN doesn't even mention base/extent anymore.. though you still have to call
|
||||||
@ -159,7 +158,6 @@ export default class DomBinding extends Binding {
|
|||||||
if (node !== baseNode || offset !== baseOffset) {
|
if (node !== baseNode || offset !== baseOffset) {
|
||||||
baseNode = node
|
baseNode = node
|
||||||
baseOffset = offset
|
baseOffset = offset
|
||||||
shouldUpdate = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,18 +169,15 @@ export default class DomBinding extends Binding {
|
|||||||
if (node !== extentNode || offset !== extentOffset) {
|
if (node !== extentNode || offset !== extentOffset) {
|
||||||
extentNode = node
|
extentNode = node
|
||||||
extentOffset = offset
|
extentOffset = offset
|
||||||
shouldUpdate = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (shouldUpdate) {
|
browserSelection.setBaseAndExtent(
|
||||||
browserSelection.setBaseAndExtent(
|
baseNode,
|
||||||
baseNode,
|
baseOffset,
|
||||||
baseOffset,
|
extentNode,
|
||||||
extentNode,
|
extentOffset
|
||||||
extentOffset
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,17 +19,17 @@ function _getCurrentRelativeSelection (domBinding) {
|
|||||||
|
|
||||||
export const getCurrentRelativeSelection = typeof getSelection !== 'undefined' ? _getCurrentRelativeSelection : () => null
|
export const getCurrentRelativeSelection = typeof getSelection !== 'undefined' ? _getCurrentRelativeSelection : () => null
|
||||||
|
|
||||||
export function beforeTransactionSelectionFixer (domBinding, remote) {
|
export function beforeTransactionSelectionFixer (domBinding) {
|
||||||
if (remote) {
|
relativeSelection = getCurrentRelativeSelection(domBinding)
|
||||||
relativeSelection = getCurrentRelativeSelection(domBinding)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Reset the browser range after every transaction.
|
||||||
|
* This prevents any collapsing issues with the local selection.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
export function afterTransactionSelectionFixer (domBinding, remote) {
|
export function afterTransactionSelectionFixer (domBinding) {
|
||||||
if (relativeSelection !== null && remote) {
|
if (relativeSelection !== null) {
|
||||||
domBinding.restoreSelection(relativeSelection)
|
domBinding.restoreSelection(relativeSelection)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user