Editorial Workflows

Move up v2

public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: V2.1 (2017-09-27)

Shifts selected text up one line. If no text selected, current line is selected by default. Started as a quick response to a forum request. Existing drag handles do something similar, but this allows movement of selected items to be attached to a keyboard shortcut— it works for me, but test it before using on anything mission critical.

V2 checks for indent levels (Taskpaper)— if you're moving a line or selection of items between project headings, the selection should be correctly indented automatically. Selected text with project headings maintains whatever indent levels it starts with. Pair with workflow "Move down v2".

+ deselect text if nothing was selected in the first place

Known flaw: doesn't currently retain variable indent levels between items in the same project (unless the project header or a line containing a # is included in the selection). Any other suggestions for improvement welcomed.

Shared by: @jsamlarose

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Selected Text ?
Entire Line(s)
OFF
Empty Selection Output
  • No Output
  • All Text
  • Closest Word
Folded Text
  • Include
  • Replace with:
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Set Variable ?
Variable Name
deselect
Value
true
Extend Selection ?
Direction
  • Backward
  • Forward
  • Both
Unit
  • Start/End of Document
  • Start/End of Line
  • Number of Characters...
1
…End If
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
#
Repeat… ?
Repeat with
  • Every Line
  • Every Match of Regular Expression:
Match Group
0 (entire match)
Reverse
OFF
Remove Whitespace ?
  • Trim leading/trailing whitespace
  • Remove empty lines
…End Repeat
…End If
Set Variable ?
Variable Name
moveme
Value
Input
Extend Selection ?
Direction
  • Backward
  • Forward
  • Both
Unit
  • Start/End of Document
  • Start/End of Line
  • Number of Characters...
1
Replace Selected Text ?
Replacement Text
Move Caret ?
Direction
  • Backward
  • Forward
  • Start/End of Document
  • Start/End of Line
  • Number of Characters:
1
Move Caret ?
Direction
  • Backward
  • Forward
  • Start/End of Document
  • Start/End of Line
  • Number of Characters:
1
Extend Selection ?
Direction
  • Backward
  • Forward
  • Both
Unit
  • Start/End of Document
  • Start/End of Line
  • Number of Characters...
1
Set Variable ?
Variable Name
anchor
Value
Input
Run Python Script ?
Source Code
#coding: utf-8
import workflow

anchor = workflow.get_input()
tabcount = anchor.count('\t')
if '#' in anchor:
	tabcount = tabcount + 1

#TODO: Generate the output...
taboutput = '\t' * tabcount

workflow.set_output(taboutput)
Set Variable ?
Variable Name
tabcheck
Value
Input
Generate Text ?
Text
moveme
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
#
Repeat… ?
Repeat with
  • Every Line
  • Every Match of Regular Expression:
Match Group
0 (entire match)
Reverse
OFF
Generate Text ?
Text
tabcheck%repeat:text
…End Repeat
…End If
Set Variable ?
Variable Name
moveme
Value
Input
Count ?
What to Count:
  • Words
  • Sentences
  • Lines
  • Characters
Set Variable ?
Variable Name
charcount
Value
Input
Move Caret ?
Direction
  • Backward
  • Forward
  • Start/End of Document
  • Start/End of Line
  • Number of Characters:
1
Replace Selected Text ?
Replacement Text
moveme
If… ?
Run the block if
deselect
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
true
Extend Selection ?
Direction
  • Backward
  • Forward
  • Both
Unit
  • Start/End of Document
  • Start/End of Line
  • Number of Characters...
charcount
…End If