Compare commits

...

8 Commits

Author SHA1 Message Date
Kevin Jahns
f1f05eaa5a v13.0.0-66 -- distribution files 2018-07-17 18:50:15 +02:00
Kevin Jahns
9d5bf50676 13.0.0-66 2018-07-17 18:50:03 +02:00
Kevin Jahns
c0972f8158 reset selection also for local transactions 2018-07-17 18:49:28 +02:00
Kevin Jahns
548125a944 13.0.0-65 2018-07-16 18:38:09 +02:00
Kevin Jahns
a7b124ca6e 13.0.0-64 2018-07-16 18:19:36 +02:00
Kevin Jahns
4022374620 dombinding: always set browser range after change 2018-07-16 18:15:24 +02:00
Kevin Jahns
860e4d7af6 13.0.0-63 2018-06-23 00:30:45 +02:00
Kevin Jahns
6376d69b58 fix undo of map update 2018-06-23 00:29:44 +02:00
9 changed files with 7357 additions and 22 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "yjs",
"version": "13.0.0-62",
"version": "13.0.0-66",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "yjs",
"version": "13.0.0-62",
"version": "13.0.0-66",
"description": "A framework for real-time p2p shared editing on any data",
"main": "./y.node.js",
"browser": "./y.js",

View File

@@ -140,7 +140,6 @@ export default class DomBinding extends Binding {
restoreSelection (selection) {
if (selection !== null) {
const { to, from } = selection
let shouldUpdate = false
/**
* 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
@@ -159,7 +158,6 @@ export default class DomBinding extends Binding {
if (node !== baseNode || offset !== baseOffset) {
baseNode = node
baseOffset = offset
shouldUpdate = true
}
}
}
@@ -171,18 +169,15 @@ export default class DomBinding extends Binding {
if (node !== extentNode || offset !== extentOffset) {
extentNode = node
extentOffset = offset
shouldUpdate = true
}
}
}
if (shouldUpdate) {
browserSelection.setBaseAndExtent(
baseNode,
baseOffset,
extentNode,
extentOffset
)
}
browserSelection.setBaseAndExtent(
baseNode,
baseOffset,
extentNode,
extentOffset
)
}
}

View File

@@ -19,17 +19,17 @@ function _getCurrentRelativeSelection (domBinding) {
export const getCurrentRelativeSelection = typeof getSelection !== 'undefined' ? _getCurrentRelativeSelection : () => null
export function beforeTransactionSelectionFixer (domBinding, remote) {
if (remote) {
relativeSelection = getCurrentRelativeSelection(domBinding)
}
export function beforeTransactionSelectionFixer (domBinding) {
relativeSelection = getCurrentRelativeSelection(domBinding)
}
/**
* Reset the browser range after every transaction.
* This prevents any collapsing issues with the local selection.
* @private
*/
export function afterTransactionSelectionFixer (domBinding, remote) {
if (relativeSelection !== null && remote) {
export function afterTransactionSelectionFixer (domBinding) {
if (relativeSelection !== null) {
domBinding.restoreSelection(relativeSelection)
}
}

View File

@@ -87,7 +87,7 @@ export default class Item {
* If the parent refers to this item with some kind of key (e.g. YMap, the
* key is specified here. The key is then used to refer to the list in which
* to insert this item. If `parentSub = null` type._start is the list in
* which to insert to. Otherwise it is `parent._start`.
* which to insert to. Otherwise it is `parent._map`.
* @type {String}
*/
this._parentSub = null
@@ -125,8 +125,17 @@ export default class Item {
return this._redone
}
let struct = this._copy()
let left = this._left
let right = this
let left, right
if (this._parentSub === null) {
// Is an array item. Insert at the old position
left = this._left
right = this
} else {
// Is a map item. Insert at the start
left = null
right = this._parent._map.get(this._parentSub)
right._delete(y)
}
let parent = this._parent
// make sure that parent is redone
if (parent._deleted === true && parent._redone === null) {

9
y.js Normal file

File diff suppressed because one or more lines are too long

1
y.js.map Normal file

File diff suppressed because one or more lines are too long

7320
y.node.js Normal file

File diff suppressed because it is too large Load Diff

1
y.node.js.map Normal file

File diff suppressed because one or more lines are too long