Glavin001/atom-preview

JSX (React) support

Glavin001 opened this issue · 18 comments

I am trying the atom-preview package for the first time. When I try to preview my react .jsx, I get the message, 'Please type a Text Editor to render preview- Previewing Failed'

Thanks for letting me know, @meaningofshape. It is a typo: should be "Please type in a Text Editor to render Preview". Simply select your desired Text Editor and it should render appropriately.

Thanks, @Glavin001 . Where/ how do I select the Text Editor?

Right. So I just opened a text editor to a blank doc, and then tried again. Presto! Results.

Well, the preview is of your desired code. So for instance, you are coding in JSX and want to see a preview of it. You should simply select your text editor which has the JSX code in it.

Update: Excellent! Glad it's working for you now.

What message would you think is clear to indicate someone to do that? I thought Please type in a Text Editor would be sufficient. Ideally, I'd like to have it automatic. Now that Atom v1.0 API is out, I think I will revisit this. It used to be automatic but Atom's API changed and broke everything and I scrambled to fix it all.

I did not see any place to 'type' a Text Editor. I think the idea is to 'open' a Text Editor. I do still see the error message 'Please type a...' superimposed over the translated text, however. But that does not bother me much.

Regarding the error message, now that I have clicked on my original .jsx fine in atom, the error message has ended. Thanks for you help. This is a great tool.

How about "Please open and type in a Text Editor to render its preview"?

image

I think it is helpful to include the word 'open', but I did not have to type anything. How about, ‘Please open any text editor to render a preview of your code' ?

I assumed that the Text Editor would be open, however like you said, this may not be the case.

Opening isn't really the trigger, it's actually selecting a Text Editor -- that is not the Preview Text Editor. I figured users would open a Text Editor on their own, if not already, and type in it without saying so.

How about Please open and select your Text Editor to render a preview of your code?

I type all of my code directly into Atom and then would like to preview it. No text editor involved. Isn't the Text Editor selected by default in the process of opening it? If I see both 'open' and 'select', it makes me think that I should be performing two distinct activities. Is it possible to 'select' without opening? If not, I think having 'select' might add confusion for some of us..

Selecting the Text Editor is really the important part, but would users know to open a Text Editor if they have not already? I have assumed yes before, however it's sounding like a no now.

I type all of my code directly into Atom and then would like to preview it. No text editor involved.

I do not understand. How are you typing into Atom if not using one of it's Text Editor views? 😕

When Atom launches, the default panel is of type 'All Files(.)'. Is this considered a Text Editor view? It is not of any type '.txt'. I set the Grammar as .jsx, save it as a .jsx file, ect. I leave this panel open select 'Preview' from the 'Packages' menu. It is at this point I get the error message, even though my original .jsx panel is still open. However, if I now go my Windows 7 Start menu and open WordPad, the atom-preview comes up in Atom in a split panel.

When Atom launches, the default panel is of type 'All Files(.)'. Is this considered a Text Editor view? It is not of any type '.txt'.

When Atom starts for me it automatically creates an Atom Text Editor:

image

By opening Preview and selecting that Text Editor I can try to preview it:
image

It has default grammar Plain Text which is not usable.

This element is considered a Text Editor view and is previewable, however as we know, Plain text is not a supported grammar, so you will see an error message.

I leave this panel open select 'Preview' from the 'Packages' menu. It is at this point I get the error message, even though my original .jsx panel is still open.

Preview creates a new Text Editor, on the right side, that is used for rendering the preview text in Atom. Unfortunately, it de-selects your previous Text Editor. When you re-select your desired Text Editor it will start previewing. This is what the error message should indicate.

However, if I now go my Windows 7 Start menu and open WordPad, the atom-preview comes up in Atom in a split panel.

This must mean that Atom has selected your Text Editor with your original .jsx code when you took focus off of the Atom application. The Text Editor change event was triggered and Preview handled that by updating the preview, which was successful this time.


I am going to settle with Please select your Text Editor view to render a preview of your code as it sound fairly clear.

I plan on looking into atom/markdown-preview now that Atom v1.0 API is settled. This will remove this message entirely and make it much more user friendly. So happy now that Atom will stop breaking packages 😉.

'Please select your Text Editor view to render a preview of your code' makes perfect sense. Thank you for the clarification and time spent.

Published a patch to v0.16.2

Thanks for your feedback!

Please select your Text Editor view to render a preview of your code means? i cant use preview, it gives this error and i dont know what to do.