bilalq / Tranquillity-Editor

An IDE for poets
MIT License
141 stars 18 forks source link

Give text fields name attributes so I can link to a specific poem #2

Open roryokane opened 11 years ago

roryokane commented 11 years ago

Add name attributes to the textarea and input elements containing the poem title, body, and rhyme scheme. This will allow people to link to the editor prefilled with certain text.

For example, this link to the GitHub support page prefills the Subject field on that page, which has name="form[subject]", with the text “Some problems”. I would like to be able to link to http://tranquillpoet.com/?title=A+Poem&body=This+is+my+poem to prefill the appropriate fields.

Uses of allowing this linking method:

(It looks like the “scheme” field already has a name of scheme, but when I link to http://tranquillpoet.com/?scheme=ABA, the scheme still defaults to “AABB”, so something is wrong. Perhaps the page overwrites the existing value with JavaScript instead of just letting the value attribute set the value, or perhaps I don’t understand how form-filling URLs work and an input’s value attribute is supposed to override the value in the URL.)

bilalq commented 11 years ago

This is definitely something that should be done. Thanks for all the bug reports, by the way!

I've been busy with a lot of things lately, and won't get around to fixing things until this weekend. If no one submits a pull request by Saturday, I'll take care of this, as well as issue #7, #8, and #1.

drusepth commented 11 years ago

How would newlines be handled in the poem content? Would the URL look something like http://tranquillpoet.com/?title=A+Poem&body=This+is+my+poem\nIt's+what+I+call+home ?

bilalq commented 11 years ago

Special characters like that would be escaped. Spaces are represented as "%20", for example. I've been inactive here (to put it lightly), but now that school's on break, it's time to resume work on this. Starting now.

I think I'll add support for prefilling fields as you've requested, but it's probably better to add some sort of persistance.