{{/* post_form.html — 发帖页 + 编辑帖页(共用模板) 定义两个入口,均调用内部 post-form-inner: post-new-page → PagePostNew handler post-edit-page → PagePostEdit handler 数据:utils.PostFormData .IsEdit bool — true=编辑模式 .PID uint64 — 编辑时帖子 ID .HID uint64 — 当前选中版块 .Title string — 编辑时预填标题 .Content string — 编辑时预填内容(Markdown 原文) .Helps []HelpPageItem — 版块选择列表 EasyMDE: 通过 editor.html 公共组件引入(editor-css / editor-js / editor-init-func) 表单提交方式: 使用 JS fetch(非 HTMX),因为需要从 EasyMDE 读取内容 POST JSON 到 /api/post/new 或 /api/post/edit credentials: 'include' 携带 hp_session Cookie(无需 localStorage token) */}} {{define "post-new-page"}}{{template "post-form-inner" .}}{{end}} {{define "post-edit-page"}}{{template "post-form-inner" .}}{{end}} {{define "post-form-inner"}} {{template "editor-css"}} {{template "hp-head" .}}
{{template "hp-nav" .}}
{{/* 面包屑 */}}

{{if .IsEdit}}{{t "edit_post.title"}}{{else}}{{t "new_post.title"}}{{end}}

{{if not .IsEdit}} {{end}}
{{/* 版块选择 */}}
{{/* 标题 */}}
{{len .Title}}/200
{{/* 投票选项(投票模式时显示)*/}} {{/* Markdown 编辑器 */}}
{{/* textarea 初始值由 Go 模板填充(HTML 转义安全)。 EasyMDE 初始化时读取此值作为初始内容。 */}}
{{/* 错误提示 */}}
{{/* 操作按钮 */}}
{{template "hp-footer" .}}
{{template "editor-js"}} {{template "editor-init-func"}} {{end}}