Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Uncaught TypeError: Cannot read property '0' of undefined (v2.3.3) #136

Closed
macmedia opened this issue May 5, 2016 · 10 comments
Closed

Uncaught TypeError: Cannot read property '0' of undefined (v2.3.3) #136

macmedia opened this issue May 5, 2016 · 10 comments
Labels

Comments

@macmedia
Copy link

macmedia commented May 5, 2016

Just clicking on the insert image from the menu

Atom Version: 1.7.3
System: Mac OS X 10.11.4
Thrown From: markdown-writer package, v2.3.3

Stack Trace

Uncaught TypeError: Cannot read property '0' of undefined

At /Users/name/.atom/packages/markdown-writer/lib/helpers/template-helper.coffee:55

TypeError: Cannot read property '0' of undefined
    at Object.getEditor (/Users/name/.atom/packages/markdown-writer/lib/helpers/template-helper.coffee:55:84)
    at InsertImageView.module.exports.InsertImageView.display (/Users/name/.atom/packages/markdown-writer/lib/views/insert-image-view.coffee:68:35)
    at atom-text-editor.<anonymous> (/Users/name/.atom/packages/markdown-writer/lib/markdown-writer.coffee:83:24)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:260:29)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61)
    at CommandRegistry.module.exports.CommandRegistry.dispatch (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:160:19)
    at AtomEnvironment.module.exports.AtomEnvironment.dispatchApplicationMenuCommand (/Applications/Atom.app/Contents/Resources/app.asar/src/atom-environment.js:1100:28)
    at EventEmitter.outerCallback (/Applications/Atom.app/Contents/Resources/app.asar/src/application-delegate.js:314:25)
    at emitTwo (events.js:87:13)
    at EventEmitter.emit (events.js:172:7)

Commands

     -2:03.1.0 core:save (atom-text-editor.editor.is-focused)
     -2:00.9.0 command-palette:toggle (atom-text-editor.editor.is-focused)
     -1:52.3.0 editor:consolidate-selections (atom-text-editor.editor.mini.is-focused)
     -1:52.3.0 core:cancel (atom-text-editor.editor.mini.is-focused)
     -1:50.7.0 git-plus:add (atom-text-editor.editor.is-focused)
     -1:50.7.0 command-palette:toggle (atom-text-editor.editor.is-focused)
     -1:47.9.0 editor:consolidate-selections (atom-text-editor.editor.mini.is-focused)
     -1:47.9.0 core:cancel (atom-text-editor.editor.mini.is-focused)
     -1:44.2.0 git-plus:add (atom-text-editor.editor.is-focused)
     -1:44.2.0 command-palette:toggle (atom-text-editor.editor.is-focused)
  2x -1:36.9.0 core:backspace (atom-text-editor.editor.mini.is-focused)
     -1:27.4.0 git-plus:add-all-commit-and-push (atom-text-editor.editor)
     -1:19.3.0 core:backspace (atom-text-editor.editor.is-focused)
     -1:15.1.0 core:save (atom-text-editor.editor.is-focused)
     -0:34.1.0 core:paste (atom-text-editor.editor.is-focused)
  2x -0:11.1.0 markdown-writer:insert-image (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "wrap-guide",
      "close-after-last-tab",
      "emmet",
      "autocomplete-plus",
      "SFTP-deployment",
      "grunt-runner",
      "coffee-eval",
      "coffee-lint",
      "language-coffee-script",
      "livereload",
      "dev-live-reload",
      "mobile-preview",
      "atom-lint",
      "fancy-new-file",
      "fancy-new-file"
    ],
    "themes": [
      "unity-ui",
      "atom-light-syntax"
    ]
  }
}

Installed Packages

# User
Remote-FTP, v0.8.3
angularjs, v0.3.4
atom-beautify, v0.29.7
autocomplete-php, v0.3.7
color-picker, v2.1.1
file-icons, v1.7.9
git-plus, v5.13.4
language-blade, v0.25.2
language-groovy, v0.6.0
language-groovy-cloned-from-java, v0.3.0
laravel, v0.7.0
linter, v1.11.4
markdown-writer, v2.3.3
pretty-json, v1.0.3
unity-ui, v2.1.4
wordpress-api, v1.2.2

# Dev
No dev packages
@zhuochun zhuochun added the bug label May 6, 2016
zhuochun added a commit that referenced this issue May 30, 2016
- Option to skip blank config value
- Fix #136
@Sihui
Copy link

Sihui commented Oct 7, 2016

It happens to me, too.

@datalater
Copy link

Me too.

@zhuochun zhuochun changed the title Uncaught TypeError: Cannot read property '0' of undefined Uncaught TypeError: Cannot read property '0' of undefined (v1.7.3) Apr 30, 2017
@zhuochun
Copy link
Owner

@datalater can you reproduce the same issue and submit a new issue?

The error message could be same but caused by different scenario.

@zhuochun zhuochun changed the title Uncaught TypeError: Cannot read property '0' of undefined (v1.7.3) Uncaught TypeError: Cannot read property '0' of undefined (v2.3.3) Apr 30, 2017
@datalater
Copy link

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.20.0 x64
Electron: 1.6.9
OS: Unknown Windows version
Thrown From: markdown-writer package 2.6.5

Stack Trace

Uncaught TypeError: Cannot read property '0' of undefined

At C:\Users\User\.atom\packages\markdown-writer\lib\helpers\template-helper.coffee:55

TypeError: Cannot read property '0' of undefined
    at Object.getEditor (/packages/markdown-writer/lib/helpers/template-helper.coffee:55:104)
    at InsertImageView.module.exports.InsertImageView.display (/packages/markdown-writer/lib/views/insert-image-view.coffee:80:35)
    at /packages/markdown-writer/lib/markdown-writer.coffee:83:24)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (~/AppData/Local/atom/app-1.20.0/resources/app/src/command-registry.js:265:35)
    at ~/AppData/Local/atom/app-1.20.0/resources/app/src/command-registry.js:3:65
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (~/AppData/Local/atom/app-1.20.0/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (~/AppData/Local/atom/app-1.20.0/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (~/AppData/Local/atom/app-1.20.0/resources/app/src/window-event-handler.js:100:42)
    at HTMLDocument.<anonymous> (~/AppData/Local/atom/app-1.20.0/resources/app/src/window-event-handler.js:3:65)

Commands

     -2:00.1.0 core:move-right (input.hidden-input)
     -1:58.3.0 core:paste (input.hidden-input)
     -1:56.1.0 core:move-right (input.hidden-input)
     -1:55.5.0 editor:move-to-first-character-of-line (input.hidden-input)
 25x -1:53.5.0 core:move-right (input.hidden-input)
     -1:39.8.0 core:move-left (input.hidden-input)
     -1:39.4.0 core:backspace (input.hidden-input)
     -1:38.5.0 core:move-right (input.hidden-input)
     -1:38.2.0 core:backspace (input.hidden-input)
     -1:36.7.0 core:save (input.hidden-input)
     -1:22.9.0 core:backspace (input.hidden-input)
     -1:20.1.0 markdown-writer:insert-image (input.hidden-input)
     -1:08.2.0 core:undo (input.hidden-input)
     -1:03.8.0 markdown-preview-enhanced:open-in-browser (p.)
     -0:33.9.0 core:move-up (input.hidden-input)
     -0:33.4.0 markdown-writer:insert-image (input.hidden-input)

Non-Core Packages

markdown-preview-enhanced 0.13.0 
markdown-writer 2.6.5 

@rnnall
Copy link

rnnall commented Jul 15, 2018

Error: When clicking Menu or using shortcut command Ctrl+Shift+P Markdown Writer: Insert Image below error occurs. Disabled a few of the packages with the same error. Tired to role back to an older version and same thing.

Atom: 1.28.2 x64
Electron: 2.0.5
OS: Microsoft Windows 10 Enterprise
Thrown From: markdown-writer package 2.7.4

Stack Trace

Uncaught TypeError: Cannot read property '0' of undefined

At C:\Users\rnall\.atom\packages\markdown-writer\lib\helpers\template-helper.coffee:55

TypeError: Cannot read property '0' of undefined
    at Object.getEditor (/packages/markdown-writer/lib/helpers/template-helper.coffee:55:104)
    at InsertImageClipboardView.module.exports.InsertImageClipboardView.display (/packages/markdown-writer/lib/views/insert-image-clipboard-view.coffee:88:35)
    at /packages/markdown-writer/lib/markdown-writer.coffee:81:24)
    at CommandRegistry.handleCommandEvent (~/AppData/Local/atom/app-1.28.2/resources/app/src/command-registry.js:384:49)
    at Object.didConfirmSelection (~/AppData/Local/atom/app-1.28.2/resources/app/node_modules/command-palette/lib/command-palette-view.js:152:35)
    at SelectListView.confirmSelection (~/AppData/Local/atom/app-1.28.2/resources/app/node_modules/atom-select-list/src/select-list-view.js:401:26)
    at HTMLDivElement.core:confirm (~/AppData/Local/atom/app-1.28.2/resources/app/node_modules/atom-select-list/src/select-list-view.js:106:20)
    at CommandRegistry.handleCommandEvent (~/AppData/Local/atom/app-1.28.2/resources/app/src/command-registry.js:384:49)
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (~/AppData/Local/atom/app-1.28.2/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (~/AppData/Local/atom/app-1.28.2/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
    at WindowEventHandler.handleDocumentKeyEvent (~/AppData/Local/atom/app-1.28.2/resources/app/src/window-event-handler.js:110:40)

Commands

  3x -2:43.3.0 core:backspace (input.hidden-input)
     -2:33 core:confirm (input.hidden-input)
     -1:21.2.0 command-palette:toggle (input.hidden-input)
     -1:17.3.0 core:confirm (input.hidden-input)
     -1:17.3.0 markdown-writer:insert-image-clipboard (input.hidden-input)

Non-Core Packages

ascii-art 1.2.0 
atom-html-preview 0.2.5 
atom-material-ui 2.1.3 
atom-runner 2.7.1 
atom-smart-template 0.3.2 
autocomplete-clang 0.11.5 
autocomplete-python 1.10.5 
build 0.70.0 
busy-signal 1.4.3 
date 2.1.0 
docblockr 0.13.7 
evernote-markdown-editor 0.0.0 
file-icons 2.1.22 
file-templates 0.2.0 
git-plus 8.0.0 
highlight-selected 0.14.0 
intentions 1.1.5 
language-ini 1.20.0 
language-markdown 0.26.0 
linter 2.2.0 
linter-gcc 0.7.1 
linter-ui-default 1.7.1 
markdown-image-paste 2.5.2 
markdown-preview-enhanced 0.15.6 
markdown-preview-plus 3.3.3 
markdown-toc 0.4.2 
markdown-writer 2.7.4 
minimap 4.29.8 
minimap-titles 1.15.0 
pandoc 0.2.2 
pandoc-convert 1.1.1 
platformio-ide 2.1.7 
platformio-ide-debugger 1.2.6 
platformio-ide-terminal 2.8.3 
pubster-syntax 3.0.2 
sync-settings 0.8.6 
todo-show 2.3.0 
tool-bar 1.1.7 

@zhuochun
Copy link
Owner

Do you mind share your front matter content (the content enclosed in ---) of your markdown file?

@zhuochun zhuochun reopened this Jul 15, 2018
@rnnall
Copy link

rnnall commented Jul 15, 2018 via email

@zhuochun
Copy link
Owner

Hi @rnnall , I think GitHub issues won't pick up attachments send in email. Would you possible to upload the files in this issue directly? Also attaching your config file if any.

I tried using partial --- front matter, and nothing broke for me so far.

@rnnall
Copy link

rnnall commented Jul 22, 2018

Sorry I have been out on vacation. I needed to convert the MD file to TXT for upload. I am getting an error from placing on my line 3, 11, & 24 the --- if I remove 11 & 24 then save error goes away.

Working file:
photo_editing.txt

Config File:

"*":
  "atom-minimap-titles":
    font: "ANSI Shadow"
  "autocomplete-python":
    useKite: false
  autosave:
    enabled: true
  core:
    disabledPackages: [
      "language-gfm"
      "markdown-preview"
      "markdown-preview-plus"
      "evernote-markdown-editor"
      "evernote-markdown-editor"
      "evernote-markdown-editor"
      "markdown-image-paste"
    ]
    ignoredNames: [
      ".git"
      ".hg"
      ".svn"
      ".DS_Store"
      "._*"
      "Thumbs.db"
      "desktop.ini"
      ".pioenvs"
      ".piolibdeps"
      ".clang_complete"
      ".gcc-flags.json"
    ]
    packagesWithKeymapsDisabled: [
      "markdown-image-paste"
    ]
    telemetryConsent: "no"
    themes: [
      "atom-dark-ui"
      "pubster-syntax"
    ]
    uriHandlerRegistration: "never"
  editor:
    fontSize: 17
    showIndentGuide: true
    softWrap: true
    softWrapAtPreferredLineLength: true
    tabLength: 4
  "exception-reporting":
    userId: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  "file-icons":
    coloured: false
  "linter-ui-default":
    useBusySignal: false
  "markdown-preview":
    useGitHubStyle: true
  "markdown-preview-enhanced":
    codeBlockTheme: "default.css"
  "markdown-preview-plus":
    syncConfig:
      syncEditorOnPreviewScroll: true
      syncPreviewOnChange: true
      syncPreviewOnEditorScroll: true
    useGitHubStyle: true
  minimap:
    displayMinimapOnLeft: true
  "one-o-eight-syntax":
    backgroundVariant: "Dark"
    foregroundVariant: "Original"
  "spell-check":
    grammars: [
      "source.asciidoc"
      "source.gfm"
      "text.git-commit"
      "text.plain"
      "text.plain.null-grammar"
      "text.html.basic"
      "source.css.scss"
      "text.html.php"
      "source.css"
      "source.js"
      "source.json"
      "text.tex.latex"
      "text.md"
      "heading.markup.md"
    ]
  "sync-settings":
    _lastBackupHash: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    gistId: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    personalAccessToken: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  "tool-bar":
    position: "Left"
    visible: false
  "tree-view":
    hideIgnoredNames: true
  welcome:
    showOnStartup: false

zhuochun added a commit that referenced this issue Jul 23, 2018
zhuochun added a commit that referenced this issue Jul 23, 2018
@zhuochun
Copy link
Owner

@rnnall Thanks for the file. I uploaded a fix and tested ok on local.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants