Glavin001 / atom-preview

:construction: (NO LONGER MAINTAINED) :construction: - :eyeglasses: Ultimate previewer of source code in Atom.
https://atom.io/packages/preview
MIT License
51 stars 23 forks source link

Update for Atom API breaking changes causing blank screen #88

Closed screendriver closed 9 years ago

screendriver commented 9 years ago

Since one of the last updates of Atom it is not working anymore with my CoffeScripts. The "untitled preview" tab remains empty. Mac OS X 10.10.2 + Atom 0.186.0

Glavin001 commented 9 years ago

Could you add version of Atom Preview (for the record)? Thanks.

screendriver commented 9 years ago

Of course: 0.13.4

Glavin001 commented 9 years ago

Thank you.

I have no ETA when I'll be able to find time to investigate this. I hope to resolve this ASAP. Maybe this weekend?

screendriver commented 9 years ago

There's no hurry for that :wink:

ariririos commented 9 years ago

I'm also experiencing this bug, and I'm getting this error in the console:

Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'"

in the file ~/.atom/packages/preview/node_modules/jade/node_modules/constantinople/node_modules/acorn-globals/node_modules/acorn/acorn.js

at line 508 in the makePredicate function.

PyroSA commented 9 years ago

My window gives the standard "Please type in a Text Editor to render preview", then changes to a blank-looking window with horizontal and vertical scrollbars. The scrollbar seems to be of the right proportions for the compiled JS.

Selecting and copying the text (Select-All, Copy) does copy the JS, but no text shows.

It is NOT limited to Coffeescript in my case, Jade files also compile to HTML fine, but do not show.

This is in Windows 7, Atom 0.186

anderson-arlen commented 9 years ago

+1

decker-brower commented 9 years ago

+1

Glavin001 commented 9 years ago

I am working on this right now. I am able to reproduce. Thank you all for your patients.

Glavin001 commented 9 years ago

Looks like they have switched off of the TextEditorView and onto using atom-text-editor elements. See https://github.com/atom/atom/issues/5503 for discussion about using it in packages.

This looks like it will be a big change. It may take some time.. it is unfortunate that Atom changes so drastically and so often. It is difficult to keep up.

Glavin001 commented 9 years ago

Published patch to v0.13.5

Please let me know if it works for you.

decker-brower commented 9 years ago

dude. nice work. thanks for getting this done so fast.

anderson-arlen commented 9 years ago

Works great now. Thanks!

PyroSA commented 9 years ago

CoffeeScript is now rendering - which is the realy need, thanks!

I got a possibly unrelated error with a Jade file:

Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".

Previewing Failed…

EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".
 at Function (native)
 at makePredicate (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\node_modules\acorn-globals\node_modules\acorn\acorn.js:508:12)
 at C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\node_modules\acorn-globals\node_modules\acorn\acorn.js:513:25
 at exports.version (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\node_modules\acorn-globals\node_modules\acorn\acorn.js:25:71)
 at Object.<anonymous> (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\node_modules\acorn-globals\node_modules\acorn\acorn.js:28:3)
 at Module._compile (module.js:475:26)
 at Object.loadFile [as .js] (D:\programs\atom\app-0.187.0\resources\app\src\babel.js:162:21)
 at Module.load (module.js:370:32)
 at Function.Module._load (module.js:325:12)
 at Module.require (module.js:380:17)
 at require (module.js:399:17)
 at Object.<anonymous> (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\node_modules\acorn-globals\index.js:3:13)
 at Module._compile (module.js:475:26)
 at Object.loadFile [as .js] (D:\programs\atom\app-0.187.0\resources\app\src\babel.js:162:21)
 at Module.load (module.js:370:32)
 at Function.Module._load (module.js:325:12)
 at Module.require (module.js:380:17)
 at require (module.js:399:17)
 at Object.<anonymous> (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\node_modules\constantinople\index.js:3:14)
 at Module._compile (module.js:475:26)
 at Object.loadFile [as .js] (D:\programs\atom\app-0.187.0\resources\app\src\babel.js:162:21)
 at Module.load (module.js:370:32)
 at Function.Module._load (module.js:325:12)
 at Module.require (module.js:380:17)
 at require (module.js:399:17)
 at Object.<anonymous> (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\lib\parser.js:8:22)
 at Module._compile (module.js:475:26)
 at Object.loadFile [as .js] (D:\programs\atom\app-0.187.0\resources\app\src\babel.js:162:21)
 at Module.load (module.js:370:32)
 at Function.Module._load (module.js:325:12)
 at Module.require (module.js:380:17)
 at require (module.js:399:17)
 at Object.<anonymous> (C:\Users\-snip-\.atom\packages\preview\node_modules\jade\lib\index.js:13:14)
 at Module._compile (module.js:475:26)
 at Object.loadFile [as .js] (D:\programs\atom\app-0.187.0\resources\app\src\babel.js:162:21)
 at Module.load (module.js:370:32)
 at Function.Module._load (module.js:325:12)
 at Module.require (module.js:380:17)
 at require (module.js:399:17)
 at Object.module.exports.grammars.Jade.render (C:\Users\-snip-\.atom\packages\preview\lib\renderer.coffee:95:16)
 at atom-preview-editor.PreviewView.renderPreviewWithRenderer (C:\Users\-snip-\.atom\packages\preview\lib\preview-view.coffee:347:27)
 at atom-preview-editor.PreviewView.renderPreview (C:\Users\-snip-\.atom\packages\preview\lib\preview-view.coffee:229:6)
 at later (C:\Users\-snip-\.atom\packages\preview\node_modules\underscore-plus\node_modules\underscore\underscore.js:724:25)
Glavin001 commented 9 years ago

@PyroSA could you please create a separate issue for that one? It's Jade specific, and I think I know what it is, too. :+1:

PyroSA commented 9 years ago

Submitted issue #90

Glavin001 commented 9 years ago

Thanks @PyroSA. I'll take a look.

Also is anyone experiencing issue where it does not refresh on file contents change? Tab change is working though.

Glavin001 commented 9 years ago
Glavin001 commented 9 years ago

Published patch to v0.13.6