mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-09-20 10:48:00 +08:00
实现markdown编辑器
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/lifei6671/godoc/models"
|
||||
"github.com/astaxie/beego/logs"
|
||||
)
|
||||
|
||||
type DocumentController struct {
|
||||
BaseController
|
||||
}
|
||||
@@ -11,3 +16,22 @@ func (p *DocumentController) Index() {
|
||||
func (p *DocumentController) Read() {
|
||||
p.TplName = "document/kancloud.tpl"
|
||||
}
|
||||
|
||||
func (c *DocumentController) Edit() {
|
||||
c.Prepare()
|
||||
|
||||
identify := c.Ctx.Input.Param(":key")
|
||||
|
||||
book,err := models.NewBook().FindByFieldFirst("identify",identify)
|
||||
|
||||
if err != nil {
|
||||
logs.Error("DocumentController.Edit => ",err)
|
||||
c.Abort("500")
|
||||
}
|
||||
if book.Editor == "markdown" {
|
||||
c.TplName = "document/markdown_edit_template.tpl"
|
||||
}else{
|
||||
c.TplName = "document/html_edit_template.tpl"
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user