diff --git a/README.md b/README.md index f14c07a..65e1fc9 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,35 @@ pnpm cms-log pnpm cms-stop ``` +Install extensions: + +- https://github.com/licitdev/directus-extension-sanitize-html + +General WYSIWYG field settings: + +- Custom Formats: + +```json +[ + { + "title": "等寬字", + "inline": "span", + "classes": "font-mono" + } +] +``` + +- Options Overrides + +```json +{ + "force_p_newlines": false, + "fix_list_elements": true, + "invalid_elements": "img,h1,h2,h3,h4,h5,h6", + "content_style": "p { padding-block: 0.25rem; } .font-mono { font-family: monospace; }" +} +``` + Schema export: http://localhost:8044/schema/snapshot?export=yaml Key can be generated by `openssl rand -base64 36` diff --git a/directus/docker-compose.yml b/directus/docker-compose.yml index b477470..3a6c8f6 100644 --- a/directus/docker-compose.yml +++ b/directus/docker-compose.yml @@ -18,6 +18,8 @@ services: # CORS_ENABLED: true # CORS_ORIGIN: true # PUBLIC_URL: /feeders-cms + EXT_SANITIZE_HTML_EVENT_SCOPES: "Facts.items.create,Facts.items.update" + EXT_SANITIZE_HTML_ALLOWED_TAGS: "p,a,b,i,em,strong,blockquote,div,span,hr,ol,ul,li,br,code,kbd" secrets: - secret diff --git a/src/app/facts/Timeline.tsx b/src/app/facts/Timeline.tsx index d3682a0..9718595 100644 --- a/src/app/facts/Timeline.tsx +++ b/src/app/facts/Timeline.tsx @@ -35,8 +35,8 @@ function Fact({ fact }: { return (