question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can not upload image inside code block

See original GitHub issue

Describe the bug When I try to upload an image inside Code Block. I received an error is:

Uncaught (in promise) TypeError: Cannot read property 'find' of undefined
    at mediaLibrary.js:299
    at index.js:8
    at redux.js:475
    at MediaLibrary.js:151
    at Object.Gg (react-dom.production.min.js:155)
    at Fg (react-dom.production.min.js:13)
    at Ig (react-dom.production.min.js:13)
    at be (react-dom.production.min.js:15)
    at Jg (react-dom.production.min.js:156)
    at Ic (react-dom.production.min.js:15)

To Reproduce

  1. Go to localhost:8000/admin
  2. Click on New Blog
  3. Click on new Image inside Code Block
  4. Try to upload an image
  5. See error at console

Expected behavior I want to can upload an image without any error

Screenshots

image

Applicable Versions:

  • Netlify CMS app version: [2.10.1]
  • Git provider: [GitHub]
  • OS: [Windows 10]
  • Browser version: [79.0.3945.88]
  • Node.JS version: [v10.16.0]

CMS configuration

backend:
  name: git-gateway
  branch: master

media_folder: static/img
public_folder: /img
publish_mode: editorial_workflow

collections:
  - name: "blog"
    label: "Blog"
    folder: "src/blog-posts"
    create: true
    slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
    editor:
     preview: true
    fields:
      - { label: "Title", name: "title", widget: "string" }
      - {
          label: 'Publish Date',
          name: 'date',
          widget: 'datetime',
          dateFormat: 'YYYY-MM-DD',
          timeFormat: 'HH:mm',
          format: 'YYYY-MM-DD HH:mm',
        }
      - { label: "Description", required: false, name: "description", widget: "string" }
      - { label: 'Body', name: 'body', widget: 'markdown', hint: 'Main content goes here.' }
      - { 
          label: "Tags", 
          name: "tags", 
          widget: "select", 
          options: ['ReactJs', 'JavaScript', 'Redux', 'NodeJs'],
          multiple: true 
        }

My repo: https://github.com/thaind97git/tech-blog

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
thaind97gitcommented, Jan 8, 2020

@erquhart , I resolved this issue by an update to 2.10.3. Thank for your support.

0reactions
erquhartcommented, Jan 7, 2020

Just released 2.10.3, can you update and see if it still happens?

Read more comments on GitHub >

github_iconTop Results From Across the Web

It's possible to create a code block with an image inside #9567
Click Insert code block. Result: A code block with image inside is created. Expected: Code block cannot contain images. Screencast:.
Read more >
How To Use <img> To Upload Photos Via The Code Block?
I am trying to add images to my site via html using the <img> tag. I cannot for the life of me get...
Read more >
Unable to upload image in a block. - Optimizely World
Hi,. I'm getting image upload failed message (Content type "ImageFile" is not allowed to be created under parent of content type "BannerBlock".
Read more >
Why should I not upload images of code/data/errors?
Code or sample data in images can't be copied and pasted into an editor and compiled in order to reproduce the problem. Images...
Read more >
Image Upload not always visible in MVC Content Block
When inspecting the view source, the "Upload image" is present in both cases - when it is visible and when not. In order...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found