Add Markdown preview for textarea, see #407

This commit is contained in:
Frédéric Guillot
2014-11-20 22:37:10 -05:00
parent 11b6381cc0
commit 2a850757ee
29 changed files with 393 additions and 28 deletions

View File

@@ -4,6 +4,7 @@ namespace Controller;
use Model\Project as ProjectModel;
use Model\SubTask;
use Helper;
/**
* Application controller
@@ -153,4 +154,22 @@ class App extends Base
)
);
}
/**
* Render Markdown Text and reply with the HTML Code
*
* @access public
*/
public function preview()
{
$payload = $this->request->getJson();
if (empty($payload['text'])) {
$this->response->html('<p>'.t('Nothing to preview...').'</p>');
}
else {
$this->response->html(Helper\markdown($payload['text']));
}
}
}