/** * Pass JSON into an InlineEditorText object and return combined JSON (HTML + sentence representation) * @param $json string * @return string */ public function preview($json) { // decode the JSON $request = FormatJson::decode($json, true); // load the JSON to a text object and perform the edit $text = InlineEditorText::restoreObject($request, $this->article); $text->doEdit($request['lastEdit']['id'], $request['lastEdit']['text']); // get the next state $subseq = InlineEditorText::subsequentState($text); // send back the JSON return FormatJson::encode($subseq); }