decap-cms icon indicating copy to clipboard operation
decap-cms copied to clipboard

Unable to create custom formatter: TypeError: r.getIn is not a function

Open emmadesilva opened this issue 1 year ago • 0 comments

Describe the bug Following the documentation I'm trying to create a custom formatter to read and write the page source as plaintext.

To Reproduce

Add the following:

CMS.registerCustomFormat('blade', '.blade.php', {
  fromFile: text => text,
  toFile: value => value,
});

The admin panel breaks.

Expected behavior

The admin panel should work.

Screenshots

image

Applicable Versions:

  • Decap CMS version: [email protected]
  • Git provider: github
  • Browser version: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36

CMS configuration

backend:
  name: github
  repo: hyde-staging/decap-test
site_url: https://hyde-staging.github.io/decap-test
logo_url: /admin/assets/logo.svg
media_folder: _media
public_folder: media
commit_messages:
  create: Create {{collection}} "{{slug}}" from Decap
  update: Update {{collection}} "{{slug}}" from Decap
  delete: Delete {{collection}} "{{slug}}" from Decap
  uploadMedia: Upload "{{path}}" from Decap
  deleteMedia: Delete "{{path}}" from Decap
  openAuthoring: "{{message}}"
collections:
  - name: posts
    label: Blog Posts
    label_singular: Post
    description: The blog posts for the site
    folder: _posts
    create: true
    slug: "{{slug}}"
    preview_path: posts/{{slug}}
    fields:
      - label: Title
        name: title
        widget: string
      - label: Cover Image
        name: image
        widget: image
      - label: Description
        name: Description
        widget: string
      - label: Category
        name: category
        widget: string
      - label: Date
        name: date
        widget: datetime
      - label: Author
        name: author
        widget: string
      - label: Body
        name: body
        widget: markdown
    publish: true
    type: folder_based_collection
    sortable_fields:
      - commit_date
      - title
      - date
      - author
    view_filters: []
    view_groups: []
  - name: docs
    label: Documentation Pages
    label_singular: Documentation Page
    description: The documentation pages for the site
    folder: _docs
    create: true
    slug: "{{slug}}"
    preview_path: docs/{{slug}}
    fields:
      - label: Title
        name: title
        widget: string
      - label: Body
        name: body
        widget: markdown
    publish: true
    type: folder_based_collection
    sortable_fields:
      - commit_date
      - title
      - commit_author
    view_filters: []
    view_groups: []
  - name: markdown-pages
    label: Markdown Pages
    label_singular: Markdown Page
    description: The Markdown pages for the site
    folder: _pages
    create: true
    slug: "{{slug}}"
    preview_path: "{{slug}}"
    fields:
      - label: Title
        name: title
        widget: string
      - label: Body
        name: body
        widget: markdown
    publish: true
    type: folder_based_collection
    sortable_fields:
      - commit_date
      - title
      - commit_author
    view_filters: []
    view_groups: []
  - name: blade-pages
    label: Blade Pages
    label_singular: Blade Page
    description: The Blade pages for the site
    folder: _pages
    extension: .blade.php
    format: blade
    create: true
    slug: "{{slug}}"
    preview_path: "{{slug}}"
    fields:
      - label: Title
        name: title
        widget: string
      - label: Blade
        name: body
        widget: text
    editor:
      preview: false
    publish: true
    type: folder_based_collection
    sortable_fields:
      - commit_date
      - title
      - commit_author
    view_filters: []
    view_groups: []
publish_mode: simple
slug:
  encoding: unicode
  clean_accents: false
  sanitize_replacement: "-"
display_url: https://hyde-staging.github.io/decap-test
isFetching: false
error: null

Additional context

emmadesilva avatar Feb 16 '24 16:02 emmadesilva