invot
invot

Reputation: 535

Ace Editor: How do I get the value of an editor without line breaks?

Using ace editor has been a challenge to say the least. Though I'm able to get the value of the editor, I can't seem to do it without either encountering a bug or having the escape characters included.

Is there a method that will provide me with the full text of the editor, minus the escape characters?

getAllLines() returns a console error stating that it's not a function

getTextRange() also returns an error stating it's not a function

removeNewLine() returns a cryptic error that I can't seem to trace

So is there a standard, working method to do this?

Upvotes: 0

Views: 921

Answers (1)

CDelaney
CDelaney

Reputation: 1248

There isn't a built-in function for doing that, but you could get the value and remove the line-breaks yourself.

var multiLineVal = editor.getValue();
var singleLineVal = multiLineVal.replace(/\n/g, ' ');

Upvotes: 1

Related Questions