Make splitting while pasting multiline instructions configurable
Recently this message was posted in another issue:
Hi @christianlupus I hope you don't mind if I add a comment here, since it is somehow related (newlines).
I'm also a new user and created my first recipe today. I stumbled over the creation process for the instructions, where any newline creates a new instruction step. When you really create all the instructions in that moment this is very helpful. You can create multiline steps with Shift+Enter and a new step with Enter.
But I wanted to copy paste a multiline text in one instruction step, which is not possible, because any newline in the clipboard also creates new steps. For me it would be really great if only a manually pressed Enter key would create a new step and not newlines from the clipboard. I could also imagine having a special character (e.g.
<br>or something) which is interpreted as "inside instruction step" newline but not "create a new step" newline.If this is even possible?
Led me add, that having less instruction steps, also saves space in the printed version of a recipe.
Originally posted by @efelon in https://github.com/nextcloud/cookbook/issues/1231#issuecomment-1326711751
As this issue was unrelated to the topic it was posted in, it should be tracked in a new issue (here).
Related subtopics:
- [ ] Find consent on what is the best UI/UX solution to allow for pasting
- [ ] Enable merging of adjacent instructions while editing
Depends on #1067
Hello @efelon. The behavior you describe is intended behavior and is dedicatedly programmed as such. It is designed to copy over from websites hosting recipes that do not conform to the schema.org standard. There, the instruction steps are separated by newlines. Thus, to import these recipes in a quick copy&paste manner, any newlines are parsed and the instructions are separated at these points.
Having this in mind, I see multiple tasks at hand. First, there could be a user-global setting if the splitting of recipes should be done (current behavior), should not be done or each time a question should be triggered on the user.
Also, I see it was necessary to allow merging two adjacent instructions into one to undo the separation process.
One idea I has was to use a modal dialog in which the imported text can be configured in a way that the user can select where new instructions are starting and where just a line break is to be inserted. This would be the variant with the question mentioned above.
Let's see how others think of this issue and if there are even better suggestions...
Is it true that usually in cases where we want multiple ingredients / instructions to be added, each line starts with a bullet (e.g. -) or a number? If yes, we could only separate lines if such markers are present. We already have a way to identify and remove such common prefixes, which we could leverage for this.
Thanks @christianlupus for taking the time to create a new issue and your explanation.
user-global setting if the splitting of recipes should be done (current behavior), should not be done or each time a question should be triggered on the user.
I would be fine with a global setting, which I could disable for the time when copy pasting existing recipes. Usually there are more then one. And enable it afterwards. Having the user questioned every time feels like too much overhead in the workflow.
Maybe you could provide a new button in the create/edit view like so:
exact optics are not important here
+ No global option which needs to be remembered + No need for a "pop-up" question option + Can be switched individually before adding any new step - Always visible - Not relevant/available for import I suppose
allow merging two adjacent instructions into one
Also a nice proposal, which would be nice to have anyway. 😉
use a modal dialog in which the imported text can be configured
That is much more effort than the other ones, I believe. This would also open the floor to an infinite amount of new request (e.g. Pictures, Links, Text formatting, ...) and you would end up with a full fledged WYSIWYG editor. I mean, I wouldn't say no, but seams overkill?!
I would rather avoid cluttering the default view here. We are aiming at a clear interface and this would just seem to be counter-effective. If there was an option, this must be in the settings. It might be non-permanent but I see already the feature requests coming in.
I will add the thing with the adjacent steps to the todo list.
I did not intend to put a WYSIWYG editor in the popup. There was not even an option to edit anything. If I pasted a text
Heat up the pan. Put some oil there. Be careful not to attach any water to the hot oil.
I would expect some popup like this (just a mockup here) to appear:

I would like to slightly modify my proposal from before. I read you comment and I looked at the GUI again and think the following position would be better for a step specific setting:
This is the minimal height for an instruction step, so the space for this option is always there.
Furthermore, the default (on or off) of this button can be controlled by a global setting and it may be only visible for the selected step (not to clutter the GUI too much, as you said).
I would expect some popup like this
In my opinion this is too much for just adding an instruction. If you turned off the "Auto split" on step level (or globally), you can edit most of what your popup mock does in the normal text entry field just by using the Enter key.
This should be addressed in #1244