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

JSX (React) support #41

Closed
Glavin001 opened this issue Aug 7, 2014 · 18 comments
Closed

JSX (React) support #41

Glavin001 opened this issue Aug 7, 2014 · 18 comments
Assignees

Comments

@Glavin001
Copy link
Owner

See https://www.npmjs.org/package/react-tools

@Glavin001 Glavin001 self-assigned this Aug 7, 2014
@Glavin001
Copy link
Owner Author

image

@Glavin001
Copy link
Owner Author

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.

Glavin001 added a commit that referenced this issue Jun 15, 2015
@wadehenning
Copy link

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

@wadehenning
Copy link

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

@Glavin001
Copy link
Owner Author

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.

@Glavin001
Copy link
Owner Author

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.

@wadehenning
Copy link

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.

@wadehenning
Copy link

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.

@Glavin001
Copy link
Owner Author

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

image

@wadehenning
Copy link

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' ?

@Glavin001
Copy link
Owner Author

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?

@wadehenning
Copy link

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..

@Glavin001
Copy link
Owner Author

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? 😕

@wadehenning
Copy link

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.

@Glavin001
Copy link
Owner Author

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 😉.

@wadehenning
Copy link

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

Glavin001 added a commit that referenced this issue Jun 15, 2015
"Please select your Text Editor view to render a
preview of your code"

See discussion at
#41 (comment)
@Glavin001
Copy link
Owner Author

Published a patch to v0.16.2

Thanks for your feedback!

@zenzozen
Copy link

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.

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

No branches or pull requests

3 participants