splitting an item must always happen inside a transaction, because we always need to check if we can merge it back
This commit is contained in:
@@ -381,7 +381,7 @@ export const typeArrayInsertGenerics = (transaction, parent, index, content) =>
|
||||
if (index <= n.length) {
|
||||
if (index < n.length) {
|
||||
// insert in-between
|
||||
getItemCleanStart(transaction.y.store, createID(n.id.client, n.id.clock + index))
|
||||
getItemCleanStart(transaction, transaction.y.store, createID(n.id.client, n.id.clock + index))
|
||||
}
|
||||
break
|
||||
}
|
||||
@@ -405,7 +405,7 @@ export const typeArrayDelete = (transaction, parent, index, length) => {
|
||||
if (!n.deleted && n.countable) {
|
||||
if (index <= n.length) {
|
||||
if (index < n.length && index > 0) {
|
||||
n = getItemCleanStart(transaction.y.store, createID(n.id.client, n.id.clock + index))
|
||||
n = getItemCleanStart(transaction, transaction.y.store, createID(n.id.client, n.id.clock + index))
|
||||
}
|
||||
break
|
||||
}
|
||||
@@ -416,7 +416,7 @@ export const typeArrayDelete = (transaction, parent, index, length) => {
|
||||
while (length > 0 && n !== null) {
|
||||
if (!n.deleted) {
|
||||
if (length < n.length) {
|
||||
getItemCleanStart(transaction.y.store, createID(n.id.client, n.id.clock + length))
|
||||
getItemCleanStart(transaction, transaction.y.store, createID(n.id.client, n.id.clock + length))
|
||||
}
|
||||
n.delete(transaction)
|
||||
length -= n.length
|
||||
|
||||
@@ -39,7 +39,7 @@ const findNextPosition = (transaction, store, currentAttributes, left, right, co
|
||||
if (!right.deleted) {
|
||||
if (count < right.length) {
|
||||
// split right
|
||||
getItemCleanStart(store, createID(right.id.client, right.id.clock + count))
|
||||
getItemCleanStart(transaction, store, createID(right.id.client, right.id.clock + count))
|
||||
}
|
||||
count -= right.length
|
||||
}
|
||||
@@ -251,7 +251,7 @@ const formatText = (transaction, parent, left, right, currentAttributes, length,
|
||||
case ItemEmbed:
|
||||
case ItemString:
|
||||
if (length < right.length) {
|
||||
getItemCleanStart(transaction.y.store, createID(right.id.client, right.id.clock + length))
|
||||
getItemCleanStart(transaction, transaction.y.store, createID(right.id.client, right.id.clock + length))
|
||||
}
|
||||
length -= right.length
|
||||
break
|
||||
@@ -284,7 +284,7 @@ const deleteText = (transaction, parent, left, right, currentAttributes, length)
|
||||
case ItemEmbed:
|
||||
case ItemString:
|
||||
if (length < right.length) {
|
||||
getItemCleanStart(transaction.y.store, createID(right.id.client, right.id.clock + length))
|
||||
getItemCleanStart(transaction, transaction.y.store, createID(right.id.client, right.id.clock + length))
|
||||
}
|
||||
length -= right.length
|
||||
right.delete(transaction)
|
||||
|
||||
Reference in New Issue
Block a user