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

Better new file dialog #218

Open
TheInitializer opened this issue Mar 22, 2016 · 44 comments
Open

Better new file dialog #218

TheInitializer opened this issue Mar 22, 2016 · 44 comments

Comments

@TheInitializer
Copy link

https://thimbleprojects.org/theinitializer/46355/
here's a thing I made

someone implement it and pr it

@TheInitializer
Copy link
Author

just realized we have 218 issues/prs - waaaat

@TheInitializer
Copy link
Author

btw there are supposed to be images on the buttons - I was lazy so didn't use an iconfont

@matthewr6
Copy link
Contributor

implement it pls
I'm busy making a brain

@towerofnix
Copy link
Member

implement it pls
I'm busy making a brain

A gopher-brain! :P

@matthewr6
Copy link
Contributor

who is implementing this? @ElementalCode/programmers

@joker314
Copy link

joker314 commented Jul 20, 2016

Hello, I am not a developer.

That thing looked lovely. Do you think there is a way to keep the cursor from going into a text selection cursor when you hover over the text within the button. Perhaps by using the cursor: ... CSS thing? It doesn't matter too much though.

Otherwise it looks great! :)

P.S. Remember to check if the user types the file extension in themselves: if they do, then you shouldn't apend it again. You could do a regex: /\.html$/i To match it, and then you could use the .test() method to check if they have typed it in. To create the RegExp so that it can match any extension that you choose, you can use ext to store the extension you are testing against and then do new RegExp("\\." + ext + "$") to do that

@mrjacobbloom
Copy link
Contributor

What about something like this? http://jsfiddle.net/Airhogs777/9jnhmku6/embedded/result/

(I know it's hacky but it can be rewritten later)

@PullJosh
Copy link
Contributor

Cursor pointer pls: http://jsfiddle.net/PullJosh/6sp0podq/

@mrjacobbloom
Copy link
Contributor

Cursor pointer pls: http://jsfiddle.net/PullJosh/6sp0podq/

pshh who needs usability when you have design (jkjk)

that was more of a proof of concept for the inputbox than the buttons anyway 📦

@joker314
Copy link

Yes, that is what I had in mind. Well Done everybody!

Out of interest, are you guys accepting any more developers

@mrjacobbloom
Copy link
Contributor

How's this look? It's less sketchy than the last version: http://jsfiddle.net/Airhogs777/7hb4tj8a/

@PullJosh
Copy link
Contributor

How's this look? It's less sketchy than the last version: http://jsfiddle.net/Airhogs777/7hb4tj8a/

Ctrl+a will show the file extension is also before the file name as well as after. It's a clever trick for centering everything nicely, but I'd be great if there was a better solution...

@mrjacobbloom
Copy link
Contributor

Ctrl+a will show the file extension is also before the file name as well as after. It's a clever trick for centering everything nicely, but I'd be great if there was a better solution...

Once we know how wide the extension text is, we could probably use relative positioning or a transform

@mrjacobbloom
Copy link
Contributor

Okay, try this: http://jsfiddle.net/Airhogs777/7hb4tj8a/

@mrjacobbloom
Copy link
Contributor

more robust JS and sassified, I think this is almost ready to go into the editor: http://jsfiddle.net/Airhogs777/7hb4tj8a/

@mrjacobbloom
Copy link
Contributor

mrjacobbloom commented Aug 2, 2016

todo: put standard validation on the file name

@joker314
Copy link

joker314 commented Aug 2, 2016

Maybe you could do an onkeyup -> check for invalid chars, if found, show notice, and remove?

@mrjacobbloom
Copy link
Contributor

Maybe you could do an onkeyup -> check for invalid chars, if found, show notice, and remove?

Either that or when you try to create the file it throws an error... I haven't decided yet

@joker314
Copy link

joker314 commented Aug 2, 2016

If you do that, it always looks cool if you make the filename go really red then fade back to black? Or just keep it red?

@joker314
Copy link

joker314 commented Aug 2, 2016

I think it is annoying for a user to type something like ¬!"£$%^&I&^%$£"£$%^&*(.html only to have all their work rejected. If, when they type ¬.html it turns red immediately, they don't waste their time...

@matthewr6
Copy link
Contributor

matthewr6 commented Aug 2, 2016

Maybe do a regex to match something like [a-zA-Z0-9] and if the match fails, turn the border red (and reject it if they try to submit)

@mrjacobbloom
Copy link
Contributor

@matthewr6
Copy link
Contributor

Awesome! This is just me, but it'd be nice to make the red border a bit brighter and gray out the Create button if you can't create the file.

@mrjacobbloom
Copy link
Contributor

done http://jsfiddle.net/Airhogs777/7hb4tj8a/7/

@joker314
Copy link

joker314 commented Aug 2, 2016

I like it, maybe you could add some kind f explanation when th user hovers over the disabled "Create" button? Like a "Filename too short" or a "Filenames can only contain characters a-z 0-9 - _"?

@matthewr6
Copy link
Contributor

Can a filename even be too short? :P

The only exceptions I can think of:

  • no file name (which might still be valid)
  • duplicate file name
  • invalid characters

@mrjacobbloom
Copy link
Contributor

Right now I'm using the regex /^[\w,\s-]{1,255}$/, which limits it to valid characters and length. I'll have to wait until I add it into the editor to check for duplicate file names. As for telling the user what they did wrong, I can probably add an errorbox

@joker314
Copy link

joker314 commented Aug 2, 2016

Yeah when I said too short I meant length 0 :P

@mrjacobbloom
Copy link
Contributor

how's this? http://jsfiddle.net/Airhogs777/7hb4tj8a/8/

I can tailor it to the specific error but that'll be more work

@joker314
Copy link

joker314 commented Aug 2, 2016

I can do it for you if you like? Give me a sec to do it

@joker314
Copy link

joker314 commented Aug 2, 2016

Your regex is faulty somehow: file with spaces.html is valid, but spaces .html is not

@mrjacobbloom
Copy link
Contributor

good catch, it looks like contenteditable automatically converts trailing spaces to nbsp

@mrjacobbloom
Copy link
Contributor

same for spaces at the start. That might be as simple as a find-and-replace

@joker314
Copy link

joker314 commented Aug 2, 2016

Yup

@joker314
Copy link

joker314 commented Aug 2, 2016

I am in UTC+3 so I better go to bed soon...

@matthewr6
Copy link
Contributor

You theoretically could have .html :P

@joker314
Copy link

joker314 commented Aug 2, 2016

Well yeah but should you allow it?

EDIT: Why am I using first person? I am not on the team.. :P

@matthewr6
Copy link
Contributor

matthewr6 commented Aug 2, 2016

Sure. As long as they don't have two files with the same (lack of) name, there's nothing really wrong.

Probably not though because it won't show up in most file explorers

@joker314
Copy link

joker314 commented Aug 2, 2016

It seems a little weird but you do have a point

@mrjacobbloom
Copy link
Contributor

It makes me uncomfortable, but... low floor, wide walls, as the ST likes to say

@TheInitializer
Copy link
Author

wow, people have made so many great improvements to my original design!

one thing is I don't like how the text becomes unselected when you click a button; is there a way for it to stay selected?

@mrjacobbloom
Copy link
Contributor

is there a way for it to stay selected?

You mean, when you click the JS/HTML/CSS buttons, the caret should stay in the same place in the textbox?

@PolyEdge
Copy link
Member

PolyEdge commented Nov 5, 2016

(Sorry, I had to bump...)
Why not just remove any invalid characters with a keydown callback?

@mrjacobbloom
Copy link
Contributor

shrug

mrjacobbloom added a commit that referenced this issue May 5, 2017
mrjacobbloom added a commit that referenced this issue May 10, 2017
* fancier new-file dialog (#218)

* fix validation to check for duplicate file names

* style file pane in same style as new file popup

* sassier variables
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

7 participants