Markdown-preview-enhanced: Uncaught TypeError: this.webview.getWebContents is not a function

Created on 6 Apr 2021  ·  6Comments  ·  Source: shd101wyy/markdown-preview-enhanced

[Enter steps to reproduce:]

  • Open a markdown file by selecting it from the tree view
  • Markdown Preview panel opens and renders, but also throws the same exception twice

Basically everything seems to work except that it is throwing this exception which is popping up each time. It's the getWebContents method on webview, apparently it was deprecated way back and then removed entirely in Electron 8.0. Relevant info: https://github.com/electron/electron/blob/40d779a7f331291304d7f06312be0491c0429643/docs/breaking-changes.md#removed-webviewgetwebcontents

Unfortunately I have not tried this in safe mode myself.

Atom: 1.56.0-beta0 x64
Electron: 9.4.4
OS: Mac OS X 10.15.6
Thrown From: markdown-preview-enhanced package 0.18.10

Stack Trace

Uncaught TypeError: this.webview.getWebContents is not a function

At /Users/nyancat/.atom/packages/markdown-preview-enhanced/out/src/preview-content-provider.js:81

TypeError: this.webview.getWebContents is not a function
    at /packages/markdown-preview-enhanced/out/src/preview-content-provider.js:81:26)
    at WebViewImpl.dispatchEvent (electron/js2c/renderer_init.js:155:2221)
    at dispatchEvent (electron/js2c/renderer_init.js:143:1883)
    at electron/js2c/renderer_init.js:143:3008
    at EventEmitter.<anonymous> (electron/js2c/renderer_init.js:127:872)
    at EventEmitter.emit (events.js:223:5)
    at Object.onMessage (electron/js2c/renderer_init.js:115:818)

Commands

     -5:34.2.0 typescript:activate (atom-workspace.workspace.scrollbars-visible-when-scrolling)

Non-Core Packages

active-item-status 0.0.0 
align-by 0.1.0 
aligner 1.3.0 
aligner-css 1.2.1 
aligner-javascript 1.3.0 
aligner-scss 1.3.1 
aligner-typescript 1.0.0 
atom-beautify 0.33.4 
atom-browser 1.10.0 
atom-clock 0.1.18 
atom-cursor-indent 0.3.3 
atom-ide-base 2.6.0 
atom-ide-datatip 0.24.1 
atom-ide-definitions 0.4.1 
atom-ide-hyperclick 1.0.9 
atom-ide-javascript 1.5.0 
atom-ide-markdown-service 2.1.0 
atom-ide-outline 2.3.3 
atom-ide-signature-help 0.15.3 
atom-ide-ui 0.13.0 
atom-jest-snippets-standard 1.1.0 
atom-mocha-snippets 0.8.0 
atom-notes 1.23.0 
atom-typescript 14.2.1 
auto-close-html2 0.7.0 
autoclose-html 0.23.0 
autoclose-tags 0.2.4 
autocomplete-haskell 1.0.1 
autocomplete-html-entities 0.2.0 
autocomplete-paths 2.13.0 
better-git-blame 0.5.0 
bracket-padder 0.4.2 
browser-plus 0.0.98 
build 0.70.0 
build-sass 0.12.0 
busy-signal 2.0.1 
change-case 0.6.5 
color-picker 2.3.0 
dash 1.7.1 
docblockr 0.13.7 
file-icons 2.1.47 
hey-pane 1.2.0 
highlight-selected 0.17.0 
hyperclick 0.1.5 
ide-css 0.3.5 
ide-html 0.6.2 
ide-json 0.2.1 
ide-purescript 0.25.0 
ide-yaml 0.7.1 
intentions 1.1.5 
isotope-ui 2.8.5 
javascript-drag-import 0.1.13 
js-hyperclick 1.19.0 
language-atom-notes 0.4.1 
language-babel 2.85.0 
language-bnf 1.1.0 
language-common-lisp 0.9.5 
language-cshtml 0.4.2 
language-ebnf 0.1.0 
language-ejs 0.4.0 
language-fish-shell 1.1.0 
language-gherkin 1.0.4 
language-haskell 1.22.0 
language-json5 1.1.1 
language-markdown 0.37.0 
language-ocaml 1.9.5 
language-postcss 1.3.1 
language-purescript 0.9.5 
language-reason 0.0.7 
language-typescript-grammars-only 1.6.0 
linter 3.3.1 
linter-eslint 8.6.5 
linter-ui-default 3.3.1 
markdown-preview-enhanced 0.18.10 
markdown-preview-plus 4.9.1 
merge-conflicts 1.4.5 
newline-after 0.0.1 
nyancat-scroll 1.1.0 
pigments 0.40.6 
pure-syntax 2.0.0 
rainbow-selection 0.3.2 
reason-refmt 0.3.3 
regex-railroad-diagram 0.19.4 
sass-autocompile 0.13.5 
scroll-marker 0.3.5 
single-click-open 0.2.2 
split-diff 1.6.1 
styri-syntax 1.0.0 
sync-settings 5.2.8 
sync-settings-folder-location 1.0.18 
tab-foldername-index 3.3.2 
teletype 0.13.4 
test 0.1.2 
tester 1.4.0 
tester-jest 1.2.4 
touchbar 0.16.0 
tree-view-git-status 1.5.3 
tsx-tags-autocomplete 0.1.0 
zentabs 0.8.9 

Most helpful comment

I'm having the same issue.

All 6 comments

I'm having the same issue.

Same here.

Yep this seems to be caused by the update of electron in atom which deprecated the getWebContents function.

I haven't found any solution that can help me track the keyboard event of the webview. Does anybody have any suggestions? Thanks

nvm I found a workaround. I will issue a fix soon. Thanks.

@MiracleBlue @liz-muehlmann @raketenlurch should be fixed now. Thanks

yep, fixed - thanks Yiyi Wang!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StefanoCecere picture StefanoCecere  ·  5Comments

AdexoMing picture AdexoMing  ·  3Comments

ckdanny picture ckdanny  ·  5Comments

AdamBear-Me picture AdamBear-Me  ·  5Comments

rcmalli picture rcmalli  ·  4Comments