MCPcopy
hub / github.com/ajaxorg/ace / setValue

Method setValue

src/editor.js:385–396  ·  view source on GitHub ↗

* Sets the current document to `val`. * @param {String} val The new value to set for the document * @param {Number} [cursorPos] Where to set the new value. `undefined` or 0 is selectAll, -1 is at the document start, and 1 is at the end * * @returns {String} The current document v

(val, cursorPos)

Source from the content-addressed store, hash-verified

383 * @related Document.setValue
384 **/
385 setValue(val, cursorPos) {
386 this.session.doc.setValue(val);
387
388 if (!cursorPos)
389 this.selectAll();
390 else if (cursorPos == 1)
391 this.navigateFileEnd();
392 else if (cursorPos == -1)
393 this.navigateFileStart();
394
395 return val;
396 }
397
398 /**
399 * Returns the current session's content.

Callers 15

$setupModelMethod · 0.95
css_worker_test.jsFile · 0.45
mirror.jsFile · 0.45
editor.jsFile · 0.45
snippets_test.jsFile · 0.45
scrollbar_test.jsFile · 0.45
document_test.jsFile · 0.45
tooltip_test.jsFile · 0.45

Calls 3

selectAllMethod · 0.95
navigateFileEndMethod · 0.95
navigateFileStartMethod · 0.95

Tested by

no test coverage detected