diff --git a/controllers/BlogController.go b/controllers/BlogController.go index c40ff0e1..4e7eea58 100644 --- a/controllers/BlogController.go +++ b/controllers/BlogController.go @@ -128,7 +128,7 @@ func (c *BlogController) ManageList() { pageIndex, _ := c.GetInt("page", 1) - blogList, totalCount, err := models.NewBlog().FindToPager(pageIndex, conf.PageSize, c.Member.MemberId, "") + blogList, totalCount, err := models.NewBlog().FindToPager(pageIndex, conf.PageSize, c.Member.MemberId, "all") if err != nil { c.ShowErrorPage(500, err.Error()) @@ -168,7 +168,7 @@ func (c *BlogController) ManageSetting() { if strings.Count(blogExcerpt, "") > 500 { c.JsonResult(6008, i18n.Tr(c.Lang, "message.blog_digest_tips")) } - if blogStatus != "public" && blogStatus != "password" && blogStatus != "draft" { + if blogStatus != "private" && blogStatus != "public" && blogStatus != "password" && blogStatus != "draft" { blogStatus = "public" } if blogStatus == "password" && blogPassword == "" { diff --git a/models/Blog.go b/models/Blog.go index 679d5694..26907141 100644 --- a/models/Blog.go +++ b/models/Blog.go @@ -15,7 +15,7 @@ import ( "github.com/mindoc-org/mindoc/utils" ) -//博文表 +// 博文表 type Blog struct { BlogId int `orm:"pk;auto;unique;column(blog_id)" json:"blog_id"` //文章标题 @@ -89,7 +89,7 @@ func NewBlog() *Blog { } } -//根据文章ID查询文章 +// 根据文章ID查询文章 func (b *Blog) Find(blogId int) (*Blog, error) { o := orm.NewOrm() @@ -102,7 +102,7 @@ func (b *Blog) Find(blogId int) (*Blog, error) { return b.Link() } -//从缓存中读取文章 +// 从缓存中读取文章 func (b *Blog) FindFromCache(blogId int) (blog *Blog, err error) { key := fmt.Sprintf("blog-id-%d", blogId) var temp Blog @@ -126,7 +126,7 @@ func (b *Blog) FindFromCache(blogId int) (blog *Blog, err error) { return } -//查找指定用户的指定文章 +// 查找指定用户的指定文章 func (b *Blog) FindByIdAndMemberId(blogId, memberId int) (*Blog, error) { o := orm.NewOrm() @@ -139,7 +139,7 @@ func (b *Blog) FindByIdAndMemberId(blogId, memberId int) (*Blog, error) { return b.Link() } -//根据文章标识查询文章 +// 根据文章标识查询文章 func (b *Blog) FindByIdentify(identify string) (*Blog, error) { o := orm.NewOrm() @@ -151,7 +151,7 @@ func (b *Blog) FindByIdentify(identify string) (*Blog, error) { return b, nil } -//获取指定文章的链接内容 +// 获取指定文章的链接内容 func (b *Blog) Link() (*Blog, error) { o := orm.NewOrm() //如果是链接文章,则需要从链接的项目中查找文章内容 @@ -211,14 +211,14 @@ func (b *Blog) Link() (*Blog, error) { return b, nil } -//判断指定的文章标识是否存在 +// 判断指定的文章标识是否存在 func (b *Blog) IsExist(identify string) bool { o := orm.NewOrm() return o.QueryTable(b.TableNameWithPrefix()).Filter("blog_identify", identify).Exist() } -//保存文章 +// 保存文章 func (b *Blog) Save(cols ...string) error { o := orm.NewOrm() @@ -239,7 +239,7 @@ func (b *Blog) Save(cols ...string) error { b.Modified = time.Now() _, err = o.Update(b, cols...) key := fmt.Sprintf("blog-id-%d", b.BlogId) - cache.Delete(key) + _ = cache.Delete(key) } else { @@ -250,7 +250,7 @@ func (b *Blog) Save(cols ...string) error { return err } -//过滤文章的危险标签,处理文章外链以及图片. +// 过滤文章的危险标签,处理文章外链以及图片. func (b *Blog) Processor() *Blog { b.BlogRelease = utils.SafetyProcessor(b.BlogRelease) @@ -285,7 +285,7 @@ func (b *Blog) Processor() *Blog { return b } -//分页查询文章列表 +// 分页查询文章列表 func (b *Blog) FindToPager(pageIndex, pageSize int, memberId int, status string) (blogList []*Blog, totalCount int, err error) { o := orm.NewOrm() @@ -297,10 +297,14 @@ func (b *Blog) FindToPager(pageIndex, pageSize int, memberId int, status string) if memberId > 0 { query = query.Filter("member_id", memberId) } - if status != "" { + if status != "" && status != "all" { query = query.Filter("blog_status", status) } + if status == "" { + query = query.Filter("blog_status__ne", "private") + } + _, err = query.OrderBy("-order_index", "-blog_id").Offset(offset).Limit(pageSize).All(&blogList) if err != nil { @@ -326,8 +330,11 @@ func (b *Blog) FindToPager(pageIndex, pageSize int, memberId int, status string) return } -//删除文章 +// 删除文章 func (b *Blog) Delete(blogId int) error { + // 删除文章缓存 + key := fmt.Sprintf("blog-id-%d", blogId) + _ = cache.Delete(key) o := orm.NewOrm() _, err := o.QueryTable(b.TableNameWithPrefix()).Filter("blog_id", blogId).Delete() @@ -337,7 +344,7 @@ func (b *Blog) Delete(blogId int) error { return err } -//查询下一篇文章 +// 查询下一篇文章 func (b *Blog) QueryNext(blogId int) (*Blog, error) { o := orm.NewOrm() blog := NewBlog() @@ -355,7 +362,7 @@ func (b *Blog) QueryNext(blogId int) (*Blog, error) { return blog, err } -//查询下一篇文章 +// 查询下一篇文章 func (b *Blog) QueryPrevious(blogId int) (*Blog, error) { o := orm.NewOrm() blog := NewBlog() @@ -373,7 +380,7 @@ func (b *Blog) QueryPrevious(blogId int) (*Blog, error) { return blog, err } -//关联文章附件 +// 关联文章附件 func (b *Blog) LinkAttach() (err error) { o := orm.NewOrm() diff --git a/static/cherry/cherry-markdown.css b/static/cherry/cherry-markdown.css index 54a9e0f3..7b83f655 100644 --- a/static/cherry/cherry-markdown.css +++ b/static/cherry/cherry-markdown.css @@ -6078,3 +6078,15 @@ span.change { border-radius: 10px !important; background-color: #b3d4fc !important; } + + +@media screen and (max-width: 1400px) { + .cherry-toolbar-button { + padding: 0; + } + + .cherry-toolbar .toolbar-left { + justify-content: space-between; + width: 95%; + } +} \ No newline at end of file diff --git a/static/editor.md/plugins/image-dialog/image-dialog.js b/static/editor.md/plugins/image-dialog/image-dialog.js index 8fa5b45f..2575e828 100644 --- a/static/editor.md/plugins/image-dialog/image-dialog.js +++ b/static/editor.md/plugins/image-dialog/image-dialog.js @@ -51,7 +51,7 @@ "" + "" + (function() { return (settings.imageUpload) ? "
" + - // 3xxx multiple=\"multiple\" + // 3xxx �������multiple=\"multiple\" "" + "" + "
" : ""; @@ -78,7 +78,7 @@ opacity: settings.dialogMaskOpacity, backgroundColor: settings.dialogMaskBgColor }, - // ォͼƬַĵ + // ���ォ��ͼƬ��ַ���������ĵ��� buttons: { enter: [lang.buttons.enter, function() { var url = this.find("[data-url]").val(); @@ -88,7 +88,7 @@ alert(imageLang.imageURLEmpty); return false; } - // ѭ + // ��������ѭ�� let arr = url.split(";"); var altAttr = (alt !== "") ? " \"" + alt + "\"" : ""; for (let i = 0; i < arr.length; i++) { @@ -121,19 +121,19 @@ fileInput.bind("change", function() { // 3xxx 20240602 // let formData = new FormData(); - // ȡıdom + // ��ȡ�ı���dom // var doc = document.getElementById('doc'); - // ȡϴؼdom + // ��ȡ�ϴ��ؼ�dom // var upload = document.getElementById('upload'); // let files = upload.files; - //ļϢappendformData洢 + //�����ļ���Ϣappend��formData�洢 // for (let i = 0; i < files.length; i++) { // let file = files[i] // formData.append('files', file) // } - // ȡļ + // ��ȡ�ļ��� // var fileName = upload.files[0].name; - // ȡļ· + // ��ȡ�ļ�·�� // var filePath = upload.value; // doc.value = fileName; // 3xxx @@ -161,17 +161,11 @@ var json = (body.innerText) ? body.innerText : ((body.textContent) ? body.textContent : null); json = (typeof JSON.parse !== "undefined") ? JSON.parse(json) : eval("(" + json + ")"); var url=""; - for (let i = 0; i < json.length; i++) { - if (json[i].success === 1) { - if (i==0){ - url=json[i].url; - }else{ - url=url+";"+json[i].url; - } + if (json.success === 1) { + url=json.url; } else { - alert(json[i].message); + alert(json.message); } - } dialog.find("[data-url]").val(url) return false; }; diff --git a/views/blog/manage_setting.tpl b/views/blog/manage_setting.tpl index 5f9e540d..ea8be8ba 100644 --- a/views/blog/manage_setting.tpl +++ b/views/blog/manage_setting.tpl @@ -79,9 +79,12 @@ + -