TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
8.04k stars 1.19k forks source link

Feature Request: Replacing the "editTemplate" fields from input to textarea #1932

Closed Spangenhelm closed 11 months ago

Spangenhelm commented 9 years ago

Hi everybody, i don't know if this has been discussed before but when editing a tiddler i think this: capture

should be textareas instead (to allow multiline edition, obviously with a better look this is just for the example): capture-1

and of course so does this (to allow editing the field easily after its creation): capture-2

In my example i would like to add my recipes to my tw, using a template to display the differents fields (picture of the dish, ingredients and instructions) in a certain way, like this i can easily modify the layout of all my receipes at once without needing to dig into each tiddler individually.

Final example (only possible if the fields are textareas instead of regular inputs AFAIK): capture-3

Ps: for those interested in such modifications i have only edited this tiddler: $:/core/ui/EditTemplate/fields

I have added the tag attribute to this line: <$edit-text tiddler=<<currentTiddler>> tag="textarea" field=<<currentField>> placeholder={{$:/language/EditTemplate/Fields/Add/Value/Placeholder}}/>

and changed the tag attribute of this line: <$edit-text tiddler="$:/temp/newfieldvalue" tag="textarea" default="" placeholder={{$:/language/EditTemplate/Fields/Add/Value/Placeholder}} class="tc-edit-texteditor"/>

Thank you

pmario commented 9 years ago

Create your own edit template and use it. -done imo no need to modify the core.

tobibeer commented 9 years ago

:+1:

I think it's quite reasonably to default to textarea instead of a basic input. What reason would there be not to? (Having to figure out the css to make it initially look as if an input would not be a reason.)

Another related discussion wishing to use fields for SQL statements: https://groups.google.com/forum/?fromgroups=#!topic/tiddlywiki/kqK5hsDvHuw

twMat commented 9 years ago

@pmario

imo no need to modify the core.

Assuming it is possible to set the default size to be as small as it is currently, I can only see advantages with this proposal. Are there any disadvantages?

There is also an "educational" aspect in this; it took me quite some time before I understood that all those elements in the edittemplate are fields - and that this is what a tiddler "is".

Spangenhelm commented 9 years ago

@pmario i was not thinking of it only for myself: i'm surely not the only one who needs this and i don't see any good reason to not do it. -done

Also, after all, the body itself of the tiddler is nothing but a field like any other except that this one is a textarea !

Jermolene commented 9 years ago

There are a couple of reasons not to change the defaults such that all fields are displayed with a textarea:

In the meantime, I believe that the best solution is as @pmario suggests:

  1. Adding custom edit template segments containing something like <$edit-text field="myfield" tag="textarea"/>
  2. Hiding the same fields from the main field listing by creating a tiddler $:/config/EditTemplateFields/Visibility/myfield and setting it's text to hide
buggyj commented 9 years ago

Maybe we can have a new file extension for tiddlers- .jtid and serialize to json.

Jermolene commented 9 years ago

Hi @buggyj right now we use .json for json files containing tiddlers, which is arguably inconsistent with tiddlywiki.files, plugin.info and tiddlywiki.info.

pmario commented 9 years ago

Exporting tiddlers from within "advanced filters" creates tiddlers.json. So we could use this format

tobibeer commented 9 years ago

In the meantime, I believe that the best solution is as @pmario suggests

...with the restriction that it would break the tiddler under node.js, so it's only available for standalone TiddlyWiki. Correct?

Jermolene commented 9 years ago

...with the restriction that it would break the tiddler under node.js, so it's only available for standalone TiddlyWiki. Correct?

Yes, that's right.

twMat commented 9 years ago

textareas take up more vertical space

This is not correct. For example; <div style="line-height:80%"><textarea rows="1" cols="30"></textarea></div>

where the most important bit is rows="1"

Jermolene commented 9 years ago

@twMat but if we make a textarea that's a single row then I'd say we've lost the advantages of using a textarea. My experience is that users will not realise that such a textarea can hold more than one line of text.

twMat commented 9 years ago

@Jermolene Hm, at least in FF and Chrome there's a small "expand textbox" indicator. I would think most tw users are familiar with this indicator. But, regardless, it would at least allow for multiple lines which is not possible currently.

Jermolene commented 9 years ago

I think textareas that scroll so that you can't see all of the content at once are deeply confusing for ordinary users.

Anyhow, we could add a hidden configuration option for specifying whether input or textarea should be used for the field editors. Might make a good first pull request for someone! :)

twMat commented 9 years ago

I agree with the point that the user must clearly see there is more when there is more. Maybe I can find some method for this... and then someone can proudly make his second pull request as he very proudly actually made one a few versions back. I can't remember what it was but let's just say I didn't exactly revolutionize anything, hehe ;-)

tobibeer commented 9 years ago

I think if inputs were textareas, the documentation would clearly state it and so the first time you used it, there is nothing confusing about that anymore. What would perhaps be desired at that point was an ability to define the editor size for a given field-name, i.e. configuration-options specifying such options and, perhaps, in some distant future, maybe, also validation rules, etc...

Jermolene commented 9 years ago

I think if inputs were textareas, the documentation would clearly state it and so the first time you used it, there is nothing confusing about that anymore

I'm afraid that people don't read the docs. Look at how many beginner questions get asked on the groups despite being in the docs. I'm not complaining about it; it's human nature. It's up to us to make the app as easy for people to learn as possible.

What would perhaps be desired at that point was an ability to define the editor size for a given field-name, i.e. configuration-options specifying such options and, perhaps, in some distant future, maybe, also validation rules, etc...

All of that is possible right now using the technique I outlined above.

twMat commented 3 years ago

Revisiting this after fellow David requested this feature elsewhere.

@Jermolene , wrote:

fields containing newlines don't get saved properly under Node.js (the reason is that the .tid file format can only cope with newlines in the text field). It can be fixed by switching to JSON tiddlers as required.

Does the new JSON storing of tiddlers change this? Restricting custom fields to single lines clearly interferes with usability.

As for a textarea not showing all its content... can't it just auto expand? (example method).

saqimtiaz commented 3 years ago

Does the new JSON storing of tiddlers change this?

No. That change is only relevant to saving in single file TW.

pmario commented 11 months ago

@Jermolene -- IMO can be closed.

Jermolene commented 11 months ago

Thank you @pmario