fixed selection handler befor/after transactions

This commit is contained in:
Kevin Jahns
2017-10-28 23:02:48 +02:00
parent c619aa33d9
commit c545118637
13 changed files with 177 additions and 95 deletions

View File

@@ -1,5 +1,6 @@
import Item from './Item.js'
import EventHandler from '../Util/EventHandler.js'
import ID from '../Util/ID.js'
// restructure children as if they were inserted one after another
function integrateChildren (y, start) {
@@ -14,6 +15,21 @@ function integrateChildren (y, start) {
} while (right !== null)
}
export function getListItemIDByPosition (type, i) {
let pos = 0
let n = type._start
while (n !== null) {
if (!n._deleted) {
if (pos <= i && i < pos + n._length) {
const id = n._id
return new ID(id.user, id.clock + i - pos)
}
pos++
}
n = n._right
}
}
export default class Type extends Item {
constructor () {
super()