Compare commits

..

3 Commits

Author SHA1 Message Date
Kevin Jahns
e648409ca0 v13.0.0-34 -- distribution files 2017-11-26 23:24:52 -08:00
Kevin Jahns
b7dbcf69d3 13.0.0-34 2017-11-26 23:24:41 -08:00
Kevin Jahns
377df18788 prevent updating cursor position if not necessary 2017-11-26 23:23:29 -08:00
6 changed files with 36 additions and 20 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "yjs", "name": "yjs",
"version": "13.0.0-33", "version": "13.0.0-34",
"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",

View File

@@ -46,19 +46,27 @@ export function afterTransactionSelectionFixer (y, transaction, remote) {
if (from !== null) { if (from !== null) {
let sel = fromRelativePosition(fromY, from) let sel = fromRelativePosition(fromY, from)
if (sel !== null) { if (sel !== null) {
let node = sel.type.getDom()
let offset = sel.offset
if (node !== anchorNode || offset !== anchorOffset) {
anchorNode = node
anchorOffset = offset
shouldUpdate = true shouldUpdate = true
anchorNode = sel.type.getDom() }
anchorOffset = sel.offset
} }
} }
if (to !== null) { if (to !== null) {
let sel = fromRelativePosition(toY, to) let sel = fromRelativePosition(toY, to)
if (sel !== null) { if (sel !== null) {
focusNode = sel.type.getDom() let node = sel.type.getDom()
focusOffset = sel.offset let offset = sel.offset
if (node !== focusNode || offset !== focusOffset) {
focusNode = node
focusOffset = offset
shouldUpdate = true shouldUpdate = true
} }
} }
}
if (shouldUpdate) { if (shouldUpdate) {
browserSelection.setBaseAndExtent( browserSelection.setBaseAndExtent(
anchorNode, anchorNode,

8
y.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
/** /**
* yjs - A framework for real-time p2p shared editing on any data * yjs - A framework for real-time p2p shared editing on any data
* @version v13.0.0-33 * @version v13.0.0-34
* @license MIT * @license MIT
*/ */
@@ -2995,19 +2995,27 @@ function afterTransactionSelectionFixer (y, transaction, remote) {
if (from !== null) { if (from !== null) {
let sel = fromRelativePosition(fromY, from); let sel = fromRelativePosition(fromY, from);
if (sel !== null) { if (sel !== null) {
let node = sel.type.getDom();
let offset = sel.offset;
if (node !== anchorNode || offset !== anchorOffset) {
anchorNode = node;
anchorOffset = offset;
shouldUpdate = true; shouldUpdate = true;
anchorNode = sel.type.getDom(); }
anchorOffset = sel.offset;
} }
} }
if (to !== null) { if (to !== null) {
let sel = fromRelativePosition(toY, to); let sel = fromRelativePosition(toY, to);
if (sel !== null) { if (sel !== null) {
focusNode = sel.type.getDom(); let node = sel.type.getDom();
focusOffset = sel.offset; let offset = sel.offset;
if (node !== focusNode || offset !== focusOffset) {
focusNode = node;
focusOffset = offset;
shouldUpdate = true; shouldUpdate = true;
} }
} }
}
if (shouldUpdate) { if (shouldUpdate) {
browserSelection.setBaseAndExtent( browserSelection.setBaseAndExtent(
anchorNode, anchorNode,

File diff suppressed because one or more lines are too long