MCPcopy Create free account
hub / github.com/FormidableLabs/use-editable / update

Function update

src/useEditable.ts:203–212  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

201 const edit = useMemo<Edit>(
202 () => ({
203 update(content: string) {
204 const { current: element } = elementRef;
205 if (element) {
206 const position = getPosition(element);
207 const prevContent = toString(element);
208 position.position += content.length - prevContent.length;
209 state.position = position;
210 state.onChange(content, position);
211 }
212 },
213 insert(append: string, deleteOffset?: number) {
214 const { current: element } = elementRef;
215 if (element) {

Callers

nothing calls this directly

Calls 3

getPositionFunction · 0.85
toStringFunction · 0.85
onChangeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…