Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AsciiDoc extension does not show images in preview #244

Closed
vincenzocaselli opened this issue Dec 3, 2022 · 6 comments
Closed

AsciiDoc extension does not show images in preview #244

vincenzocaselli opened this issue Dec 3, 2022 · 6 comments

Comments

@vincenzocaselli
Copy link

Hi,
I am trying to use the following VS extension
AsciiDoc
asciidoctor.asciidoctor-vscode
on Theia Blueprint 1.32.0 (Beta) - VS Code API Version: 1.55.2

I am already using this extension on VsCode, so I decided to try it on Theia.
The extension is searchable and installable from the Extensions view and the installation ends successfully.
However, when previewing an asciidoc file with
image

then images are not shown
image
(unlike VsCode, where they are visible)

Steps to Reproduce:

  1. in Theia Blueprint, go to Extension view, type asciidoc in search
  2. click install on AsciiDoc extension
    image
  3. open an asciidoc file with an image
    or create a brand new one, like the following (name it anyway, but with .adoc extension)
:imagesdir: ./img

== Chapter 1
here is the image

image::image1.png[]

(ensure to have an image named image1.png in a subfolder named img with respect of the .adoc file)

  • Operating System: Windows 10
  • Theia Version: Theia Blueprint 1.32.0 (Beta) - VS Code API Version: 1.55.2

Any hints?
Thank you very much
Vincenzo

@jfaltermeier
Copy link
Contributor

jfaltermeier commented Dec 5, 2022

Thanks for the report. Root cause seems to be

Refused to load the image 'http://fdd8cdf0-ce21-443a-b44f-e101721b1a49.webview.localhost:34741/webview…/project/files/img/image1.png' because it violates the following Content Security Policy directive: "img-src vscode-resource: https: data:".

We'll have to check further

@marcdumais-work
Copy link
Contributor

In the upper-right corner of the preview window, there are tree dots "...", under which there are options. Click "change preview security settings". I was only able to make it work with local images using the third option. Ideally the second option would work, limiting the "trust" to local content. I also noted that "refresh preview" does not seem to work - I needed to close the preview and re-open it.

image
image
image

@vincenzocaselli
Copy link
Author

Wow, it works! Great!

A question though:
since the extension is the same and the behavior is different between VsCode and Theia, so what is causing Theia to need this security change while VsCode works out-of-the-box ?

@marcdumais-work
Copy link
Contributor

A question though: since the extension is the same and the behavior is different between VsCode and Theia, so what is causing Theia to need this security change while VsCode works out-of-the-box ?

Good question - after some investigation, I think it's due to a bug in generic Theia's WebView code, used to display the preview window. I will open an upstream issue when I conclude my investigation - I'm optimistic we can have a fix for this, relatively quick.

@marcdumais-work
Copy link
Contributor

A fix for this has been merged upstream and will be part of this month's Eclipse Theia release. We usually update blueprint shortly after a Theia release.

@vince-fugnitto
Copy link
Member

A fix for this has been merged upstream and will be part of this month's Eclipse Theia release. We usually update blueprint shortly after a Theia release.

As mentioned, the issue should be fixed in newer versions of Eclipse Theia Blueprint.

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

No branches or pull requests

4 participants