- golem15-journal-blogeditor (BlogEditorElement): light-DOM element with a TipTap WYSIWYG tab and a Source tab that edits the exact HTML string - The value is the exact served string until a user edit; external values go in with emitUpdate false; summer-change fires on user edits only and an echo set is a no-op - StarterKit without the trailing node, links without target, rel or class; injectCSS false with the ProseMirror base rules in blogeditor.css under the element tag, colours from --c-* only - Committed bundle embedded through admin.go; vitest smoke on an imported post fixture (footer, style block, spans, figure, table, entities)
58 lines
2.1 KiB
Go
58 lines
2.1 KiB
Go
package journal
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
|
|
"git.golem15.com/golem15/sm-journal-plugin/controllers"
|
|
"git.golem15.com/golem15/sm-journal-plugin/models"
|
|
"git.golem15.com/golem15/summercms/modules/backpack"
|
|
"git.golem15.com/golem15/summercms/modules/pact"
|
|
)
|
|
|
|
// adminFS holds the admin YAML, the nav SVG and the committed Blog Editor
|
|
// bundle file by file: the controllers directory also holds Go sources that
|
|
// are not admin assets, and assets/src is the bundle's source.
|
|
//
|
|
//go:embed controllers/posts/config_list.yaml controllers/posts/config_form.yaml controllers/posts/config_filter.yaml models/post/fields.yaml models/post/columns.yaml
|
|
//go:embed controllers/categories/config_list.yaml controllers/categories/config_form.yaml models/category/fields.yaml models/category/columns.yaml
|
|
//go:embed controllers/tags/config_list.yaml controllers/tags/config_form.yaml models/tag/fields.yaml models/tag/columns.yaml
|
|
//go:embed models/settings/fields.yaml
|
|
//go:embed assets/images/journal-icon.svg
|
|
//go:embed assets/dist/blogeditor.js assets/dist/blogeditor.css
|
|
var adminFS embed.FS
|
|
|
|
func (p *Plugin) AdminFS() fs.FS { return adminFS }
|
|
|
|
// AdminControllers hands the controllers a lazy accessor of the booted app,
|
|
// so they read the database handle at request time.
|
|
func (p *Plugin) AdminControllers() []pact.AdminController {
|
|
return controllers.AdminControllers(func() *backpack.App {
|
|
if p == nil {
|
|
return nil
|
|
}
|
|
return p.app
|
|
})
|
|
}
|
|
|
|
func (p *Plugin) Settings() []pact.SettingsItem {
|
|
return []pact.SettingsItem{{
|
|
Code: "journal",
|
|
Label: "golem15.journal::lang.journal.menu_label",
|
|
Description: "golem15.journal::lang.journal.settings_description",
|
|
Category: "golem15.journal::lang.journal.menu_label",
|
|
Icon: "icon-pencil",
|
|
Permissions: []string{"golem15.journal.manage_settings"},
|
|
Form: "models/settings/fields.yaml",
|
|
NewModel: func() any { return &models.Settings{} },
|
|
}}
|
|
}
|
|
|
|
var (
|
|
_ pact.AdminAssets = (*Plugin)(nil)
|
|
_ pact.HasAdminControllers = (*Plugin)(nil)
|
|
_ pact.HasPermissions = (*Plugin)(nil)
|
|
_ pact.HasNavigation = (*Plugin)(nil)
|
|
_ pact.HasSettings = (*Plugin)(nil)
|
|
)
|