Compare commits
1 Commits
v13.0.0-39
...
v13.0.0-36
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b38a474aa |
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "yjs",
|
||||
"version": "13.0.0-39",
|
||||
"version": "13.0.0-32",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "yjs",
|
||||
"version": "13.0.0-39",
|
||||
"version": "13.0.0-36",
|
||||
"description": "A framework for real-time p2p shared editing on any data",
|
||||
"main": "./y.node.js",
|
||||
"browser": "./y.js",
|
||||
|
||||
@@ -29,17 +29,14 @@ export default class YText extends YArray {
|
||||
let right = this._start
|
||||
let count = 0
|
||||
while (right !== null) {
|
||||
const rightLen = right._deleted ? 0 : (right._length - 1)
|
||||
if (count <= pos && pos <= count + rightLen) {
|
||||
if (count <= pos && pos < count + right._length) {
|
||||
const splitDiff = pos - count
|
||||
right = right._splitAt(this._y, splitDiff)
|
||||
right = right._splitAt(this._y, pos - count)
|
||||
left = right._left
|
||||
count += splitDiff
|
||||
break
|
||||
}
|
||||
if (!right._deleted) {
|
||||
count += right._length
|
||||
}
|
||||
count += right._length
|
||||
left = right
|
||||
right = right._right
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ function domToYXml (parent, doms, _document) {
|
||||
}
|
||||
if (parent._domFilter(d.nodeName, new Map()) !== null) {
|
||||
let type
|
||||
const hookName = d._yjsHook || (d.dataset != null ? d.dataset.yjsHook : undefined)
|
||||
const hookName = d._yjsHook
|
||||
if (hookName !== undefined) {
|
||||
type = new YXmlHook(hookName, d)
|
||||
} else if (d.nodeType === d.TEXT_NODE) {
|
||||
@@ -254,9 +254,7 @@ export default class YXmlFragment extends YArray {
|
||||
})
|
||||
// Apply Y.Xml events to dom
|
||||
this.observeDeep(events => {
|
||||
this._mutualExclude(() => {
|
||||
reflectChangesOnDom.call(this, events, _document)
|
||||
})
|
||||
reflectChangesOnDom.call(this, events, _document)
|
||||
})
|
||||
// Apply Dom changes on Y.Xml
|
||||
if (typeof MutationObserver !== 'undefined') {
|
||||
|
||||
@@ -76,4 +76,7 @@ export function afterTransactionSelectionFixer (y, transaction, remote) {
|
||||
focusOffset
|
||||
)
|
||||
}
|
||||
// delete, so the objects can be gc'd
|
||||
relativeSelection = null
|
||||
browserSelection = null
|
||||
}
|
||||
|
||||
20
y.node.js
20
y.node.js
@@ -1,7 +1,7 @@
|
||||
|
||||
/**
|
||||
* yjs - A framework for real-time p2p shared editing on any data
|
||||
* @version v13.0.0-39
|
||||
* @version v13.0.0-36
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
@@ -2556,17 +2556,14 @@ class YText extends YArray {
|
||||
let right = this._start;
|
||||
let count = 0;
|
||||
while (right !== null) {
|
||||
const rightLen = right._deleted ? 0 : (right._length - 1);
|
||||
if (count <= pos && pos <= count + rightLen) {
|
||||
if (count <= pos && pos < count + right._length) {
|
||||
const splitDiff = pos - count;
|
||||
right = right._splitAt(this._y, splitDiff);
|
||||
right = right._splitAt(this._y, pos - count);
|
||||
left = right._left;
|
||||
count += splitDiff;
|
||||
break
|
||||
}
|
||||
if (!right._deleted) {
|
||||
count += right._length;
|
||||
}
|
||||
count += right._length;
|
||||
left = right;
|
||||
right = right._right;
|
||||
}
|
||||
@@ -2947,6 +2944,9 @@ function afterTransactionSelectionFixer (y, transaction, remote) {
|
||||
focusOffset
|
||||
);
|
||||
}
|
||||
// delete, so the objects can be gc'd
|
||||
relativeSelection = null;
|
||||
browserSelection = null;
|
||||
}
|
||||
|
||||
class YXmlEvent extends YEvent {
|
||||
@@ -3714,7 +3714,7 @@ function domToYXml (parent, doms, _document) {
|
||||
}
|
||||
if (parent._domFilter(d.nodeName, new Map()) !== null) {
|
||||
let type;
|
||||
const hookName = d._yjsHook || (d.dataset != null ? d.dataset.yjsHook : undefined);
|
||||
const hookName = d._yjsHook;
|
||||
if (hookName !== undefined) {
|
||||
type = new YXmlHook(hookName, d);
|
||||
} else if (d.nodeType === d.TEXT_NODE) {
|
||||
@@ -3951,9 +3951,7 @@ class YXmlFragment extends YArray {
|
||||
});
|
||||
// Apply Y.Xml events to dom
|
||||
this.observeDeep(events => {
|
||||
this._mutualExclude(() => {
|
||||
reflectChangesOnDom.call(this, events, _document);
|
||||
});
|
||||
reflectChangesOnDom.call(this, events, _document);
|
||||
});
|
||||
// Apply Dom changes on Y.Xml
|
||||
if (typeof MutationObserver !== 'undefined') {
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user