Skip to content

Latest commit

 

History

History
131 lines (102 loc) · 3.14 KB

README.md

File metadata and controls

131 lines (102 loc) · 3.14 KB

Directus CMS

CMS app is run in docker container, and can be accessed locally:

http://localhost:8044/admin

Please note the content will be empty, we don't share production data currently.

Setup

Prepare secret files, you can copy secrets/sample/*.txt to secrets/ as starting.

After starting CMS with pnpm cms, apply latest schema snapshot with:

docker compose exec directus npx directus schema apply /directus/snapshots/$(ls snapshots | sort | tail -n 1)

Then restart (pnpm cms-restart) to finish applying.

Open admin page and login with default user (see ADMIN_EMAIL in docker-compose.yml).

You have to manage permission yourself. For example, in directus UI Settings -> Access Policies -> Public -> Permission, open Read or other permissions for certain collections.

For full functionalities, you have to build and install some in-house extensions, see READMEs in extensions-src folders.

Asset management

  • Make a public folder for user upload, instead of default behavior which uploads to file library root.
  • Turn off storage asset transform, let's use other online service instead (e.g., Cloudinary).
  • Expect storage is defined with Cloudflare R2 backend, see config in docker-compose.yml. Note the secret text files must not contain EOL character.

In-house extensions

We have custom extensions in extensions-src folders.

  • WYSIWYG HTML sanitize
  • WYSIWYG image file id extraction
  • WYSIWYG interface custom CSS

See READMEs in subfolders.

General WYSIWYG field settings:

  • Custom Formats:
[
  {
    "title": "等寬字",
    "inline": "span",
    "classes": "font-mono"
  },
  {
    "title": "冗長網址",
    "selector": "a[href]",
    "classes": "feeders-mce-lengthy"
  },
  {
    "title": "冗長清單",
    "selector": "ol,ul",
    "classes": "feeders-mce-lengthy"
  },
  {
    "title": "圖說",
    "block": "figure",
    "wrapper": true,
    "classes": "feeders-mce-figure"
  },
  {
    "title": "內嵌容器",
    "block": "p",
    "classes": "feeders-mce-iframe"
  },
  {
    "title": "數值表格",
    "block": "table",
    "selector": "table",
    "classes": "feeders-mce-digit"
  }
]
  • Options Overrides
{
  "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; }",
  "content_css": "http://localhost:8055/tinymce/article.css",
  "preview_styles": "color font-size font-family font-weight",
  "sandbox_iframes_exclusions": [
    "youtube.com",
    "youtu.be",
    "bootleq.github.io"
  ]
}

{
  "formats": {
    "bold": {
      "inline": "strong"
    },
    "underline": {
      "inline": "span",
      "classes": "underline",
      "exact": true
    },
    "italic": {
      "inline": "span",
      "classes": "italic"
    },
    "strikethrough": {
      "inline": "span",
      "classes": "line-through",
      "exact": true
    }
  },
  "content_css": "http://localhost:8055/tinymce/general.css",
  "preview_styles": "color font-size font-family font-weight"
}

Other memo

Random key can be generated by openssl rand -base64 36