MCPcopy Index your code
hub / github.com/ajaxorg/ace / constructor

Method constructor

src/document.js:25–38  ·  view source on GitHub ↗

* * Creates a new `Document`. If `text` is included, the `Document` contains those strings; otherwise, it's empty. * @param {String | String[]} textOrLines text The starting text

(textOrLines)

Source from the content-addressed store, hash-verified

23 * @param {String | String[]} textOrLines text The starting text
24 **/
25 constructor(textOrLines) {
26 /**@type {string[]}*/
27 this.$lines = [""];
28
29 // There has to be one line at least in the document. If you pass an empty
30 // string to the insert function, nothing will happen. Workaround.
31 if (textOrLines.length === 0) {
32 this.$lines = [""];
33 } else if (Array.isArray(textOrLines)) {
34 this.insertMergedLines({row: 0, column: 0}, textOrLines);
35 } else {
36 this.insert({row: 0, column:0}, textOrLines);
37 }
38 }
39
40 /**
41 * Replaces all the lines in the current `Document` with the value of `text`.

Callers

nothing calls this directly

Calls 2

insertMergedLinesMethod · 0.95
insertMethod · 0.95

Tested by

no test coverage detected