I’m new to Drafts but excited to learn hitting a couple stumbling blocks. I like that I can write with my Apple Pen but its not easy to start a new line or bullet point. If I select text the keyboard will open and I can hit Return but that is clunky to the process, I prefer writing when being reflective. The toolbar stays available when writing so I just wanted to add a New Line action but not sure how to do this.
When I insert text it treats it as a template and not a carriage return. I then tried a couple scripts but neither worked.
editor.setSelectedText("\n");
and
editor.setText("\n");
I would think this is simple so perhaps I’m overthinking it but would appreciate any help I could get
The floating Scribble toolbar also includes a new line button (undo|redo|mini keyboard|newline|more) wherever you use it. You can use it in any app that way, but you do get the floating toolbar taking up a bit of extra space on screen.
That did help thanks. I was stuck on the space being selected (above the new line at that) so moving the cursor addressed the issue. How would you address the this though? When I hit enter on the keyboard when in a list it properly creates the next bullet, but when I use this script it just makes a new line and moves to it.
Inserting a newline character is not the same as pressing the enter key. The editor is detecting a key press to create the next bullet, not the addition of the character.
You could create a second action for bullet new lines, or you could modify the newline action to insert more content (a bullet and space after the newline) if the line it is appending the newline to begins with a bullet.
The selection functions already used should allow you to get the content of the line where the cursor starts and you can then check for matches.
You might want to incorporate regular expressions to take account of things like nesting of bullets should you use them.
In part I realized that from the beginning but I didn’t know what my options were. I had wished that I could just run a macro the pushes the Return key but there is no option to set “Return” in the options.
Anything more complicated I’m not sure how to do and I consider overcomplicated because I would need to account for too many circumstances to cover my intended result. That’s why in my OP I tried to outline my use case in case I wasn’t asking the right question.
I appreciate that, if it’s not too much trouble. I’m just trying to enter a new line when writing with my pen. I don’t always need bullets and typically I’m coming from a previous line, I would say I have the following situations
I’m in the middle of a sentence and I want to go to a new line
I’m on the next line and I want another line to start a new paragraph
I’m in the middle of a bulleted list, a line that begins with - for unordered list and 1., 2., 3,etc. for ordered list
I’m at a line that now has a blank bullet and I run it again to remove the bullet and start a new line. I think this answers your last question to outdent / delete the bullet.
I don’t necessarily need indenting for level one list, but I suppose I would need a way to tab and shift+tab to indent deeper list. Typically it’s 4 spaces I think, whatever is standard cause I will likely be copying and pasting content into their actual uses cases after the draft.
A while back Greg added a per syntax setting in Drafts (under the editor preferences) for tab key inserts - tab/2 spaces/4 spaces. This is usually the best option to reference in an action to determine how to indent for a user’s setup as it gives the user the control and the consistency.