diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-11-20 22:37:10 -0500 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-11-20 22:37:10 -0500 |
commit | 2a850757ee5f9c1a2119c562cf6caba3eda7ceba (patch) | |
tree | aff444a2fe18249485f84e71c8bf7ea31bc7dda6 /app/Controller/App.php | |
parent | 11b6381cc0f0583a11287202463d20a0ac1ebf00 (diff) |
Add Markdown preview for textarea, see #407
Diffstat (limited to 'app/Controller/App.php')
-rw-r--r-- | app/Controller/App.php | 19 |
1 files changed, 19 insertions, 0 deletions
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('<p>'.t('Nothing to preview...').'</p>'); + } + else { + $this->response->html(Helper\markdown($payload['text'])); + } + } + } |