remove insertAfter

This commit is contained in:
Kevin Jahns
2026-01-10 13:36:49 +01:00
parent bbaec17bf3
commit ffabdff3d5
2 changed files with 0 additions and 50 deletions

View File

@@ -1204,28 +1204,6 @@ export class YType {
this.applyDelta(delta.create().retain(index).retain(length, formats))
}
/**
* Inserts new content after another element.
*
* @example
* // Insert character 'a' at position 0
* xml.insert(0, [new Y.XmlText('text')])
*
* @param {null|Item|YType} ref The index to insert content at
* @param {Array<delta.DeltaConfGetChildren<DConf>>} content The array of content
*/
insertAfter (ref, content) {
if (this.doc !== null) {
transact(this.doc, transaction => {
const refItem = ref && ref instanceof YType ? ref._item : ref
typeListInsertGenericsAfter(transaction, this, refItem, content)
})
} else {
// only possible once this item has been integrated
error.unexpectedCase()
}
}
/**
* Appends content to this YArray.
*

View File

@@ -85,34 +85,6 @@ export const testSiblings = _tc => {
t.assert(yxml.parent === null)
}
/**
* @param {t.TestCase} _tc
*/
export const testInsertafter = _tc => {
const ydoc = new Y.Doc()
const yxml = ydoc.get()
const first = new Y.Type()
const second = new Y.Type('p')
const third = new Y.Type('p')
const deepsecond1 = new Y.Type('span')
const deepsecond2 = new Y.Type()
yxml.insertAfter(null, [first, second])
yxml.insertAfter(second, [third])
second.insertAfter(null, [deepsecond1])
second.insertAfter(deepsecond1, [deepsecond2])
t.assert(yxml.length === 3)
t.assert(second.get(0) === deepsecond1)
t.assert(second.get(1) === deepsecond2)
t.compareArrays(yxml.toArray(), [first, second, third])
t.fails(() => {
const el = new Y.Type('p')
el.insertAfter(deepsecond1, [new Y.Type()])
})
}
/**
* @param {t.TestCase} _tc
*/