feat: 增强编辑器链接对话框并统一图片插入选择器

链接支持网址/文字与站内搜索,新标签由全站设置控制;文章与评论共用已上传图片选择器。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-01 21:22:03 +08:00
parent 2159280af5
commit d5aa36416c
10 changed files with 1195 additions and 128 deletions

View File

@@ -8,6 +8,27 @@ import (
"github.com/gin-gonic/gin"
)
// APIMyPostImages 当前用户已上传的帖子图片列表
func (h *Handlers) APIMyPostImages(c *gin.Context) {
if h.Store == nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "上传存储未初始化"})
return
}
uid := h.currentUserID(c)
if uid == 0 {
c.JSON(http.StatusUnauthorized, gin.H{"error": "请先登录"})
return
}
page, _ := strconv.Atoi(c.DefaultQuery("page", "1"))
size, _ := strconv.Atoi(c.DefaultQuery("size", "24"))
result, err := h.Store.ListUserPostImages(uid, page, size)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
c.JSON(http.StatusOK, result)
}
// APIAdminMedia 列出媒体资源
func (h *Handlers) APIAdminMedia(c *gin.Context) {
if h.Store == nil {