Created
April 6, 2014 23:07
-
-
Save searler/10012356 to your computer and use it in GitHub Desktop.
Play Action that implements provides web service for editor.js that discards the 'a' character.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def text = Action(parse.json) { request => | |
val caret = (request.body \ "caret").as[Int] | |
val text = (request.body \ "text").as[String] | |
val trimmed = text.filterNot(_ == 'a') | |
Ok(Json.obj("caret" -> (caret-(text.length-trimmed.length)), "text" -> trimmed)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment