cocoakekeyu / markdown-img-paste

一个可以快速粘贴剪贴板里的照片到markdown的插件,并且可以设置使用七牛存储照片。
MIT License
179 stars 28 forks source link

Uncaught TypeError: img.toPng is not a function #23

Closed vikasksrivastava closed 5 years ago

vikasksrivastava commented 6 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.28.0-beta1 x64 Electron: 2.0.1 OS: Mac OS X 10.13.4 Thrown From: markdown-img-paste package 0.3.10

Stack Trace

Uncaught TypeError: img.toPng is not a function

At /Users/vikassri/.atom/packages/markdown-img-paste/lib/markdown-img-paste.coffee:55

TypeError: img.toPng is not a function
    at Object.paste (/packages/markdown-img-paste/lib/markdown-img-paste.coffee:55:40)
    at /packages/markdown-img-paste/lib/markdown-img-paste.coffee:13:46)
    at CommandRegistry.handleCommandEvent (/Applications/Atom Beta.app/Contents/Resources/app/src/command-registry.js:384:49)
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
    at WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom Beta.app/Contents/Resources/app/src/window-event-handler.js:110:40)

Commands

  2x -0:18.4.0 editor:paste-without-reformatting (input.hidden-input)
     -0:14.5.0 auto-indent:apply (input.hidden-input)
     -0:12.5.0 core:undo (input.hidden-input)
     -0:10.8.0 markdown-writer:insert-new-line (input.hidden-input)
     -0:10.7.0 editor:newline (input.hidden-input)
     -0:09.4.0 markdown-img-paste:paste (input.hidden-input)

Non-Core Packages

atom-beautify 0.32.5 
atom-ide-ui 0.12.0 
auto-detect-indentation 1.3.0 
auto-indent 0.5.0 
autocomplete-python 1.10.5 
busy-signal 1.4.3 
city-lights-ui 1.3.3 
docker 0.8.0 
file-icons 2.1.21 
fold-functions 0.5.0 
fold-lines 0.2.2 
foldingtext-for-atom 0.9.2 
ftp-remote-edit 0.12.12 
git-time-machine 2.1.0 
ide-python 1.0.0 
ide-yang 0.1.0 
intentions 1.1.5 
language-cisco 1.4.0 
language-docker 1.1.8 
language-markdown 0.26.0 
language-yang 0.2.0 
linter 2.2.0 
linter-markdown 5.2.2 
linter-python-pep8 0.2.0 
linter-ui-default 1.7.1 
linter-xmllint 1.4.4 
markdown-image-paste 2.5.2 
markdown-img-paste 0.3.10 
markdown-preview-enhanced 0.15.6 
markdown-scroll-sync 2.1.2 
markdown-table-editor 1.1.1 
markdown-toc 0.4.2 
markdown-toc-auto 0.9.0 
markdown-writer 2.7.3 
platformio-ide-terminal 2.8.2 
python-autopep8 0.1.3 
python-indent 1.1.5 
recursive-folding 0.2.2 
remember-folds 0.3.0 
remote-ftp 2.2.0 
set-syntax 0.4.0 
split-diff 1.5.2 
Sublime-Style-Column-Selection 1.7.4 
tidy-markdown 3.0.1 
windows-carriage-return-remover 0.1.3 
xml-formatter 0.11.0 
jinningli commented 6 years ago

The problem is img.toPng should be changed toimg.toPNG.

So I clone this repository, change img.toPng to img.toPNG in markdown-img-paste-master/lib/markdown-img-paste.coffee

Then run apm install and apm link in markdown-img-paste-master. This solve the problem.

LukaHuang commented 6 years ago

hi @jinningli Could you send a PR for this issue? If you want to send PR, I' ll delete my PR immediately.

Best regards, Steven

cocoakekeyu commented 6 years ago

Since the Electron update, the name of the toPng method of the nativeImage class has been changed.

So, just change it.