MCPcopy
hub / github.com/yjs/yjs / insert

Method insert

src/ytype.js:1181–1183  ·  view source on GitHub ↗

* Inserts new content at an index. * * Important: This function expects an array of content. Not just a content * object. The reason for this "weirdness" is that inserting several elements * is very efficient when it is done as a single operation. * * @example * // Insert chara

(index, content, format)

Source from the content-addressed store, hash-verified

1179 * @param {delta.FormattingAttributes} [format]
1180 */
1181 insert (index, content, format) {
1182 this.applyDelta(delta.create().retain(index).insert(/** @type {any} */ (content), format))
1183 }
1184
1185 /**
1186 * Inserts new content at an index.

Callers 15

pushMethod · 0.95
unshiftMethod · 0.95
toDeltaMethod · 0.80
testBasicUpdateFunction · 0.80
testSliceFunction · 0.80
testArrayFromFunction · 0.80
testLengthIssueFunction · 0.80
testLengthIssue2Function · 0.80
testDeleteInsertFunction · 0.80

Calls 1

applyDeltaMethod · 0.95

Tested by

no test coverage detected