From 2a850757ee5f9c1a2119c562cf6caba3eda7ceba Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Thu, 20 Nov 2014 22:37:10 -0500 Subject: Add Markdown preview for textarea, see #407 --- app/Controller/App.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'app/Controller/App.php') diff --git a/app/Controller/App.php b/app/Controller/App.php index 86b06076..56124da2 100644 --- a/app/Controller/App.php +++ b/app/Controller/App.php @@ -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('

'.t('Nothing to preview...').'

'); + } + else { + $this->response->html(Helper\markdown($payload['text'])); + } + } + } -- cgit v1.2.3