Archive completed

Any way to do this in Folding Text for Atom?

Hi, you can add this code to your Atom > Open Your Init Script file:

atom.commands.add 'ft-outline-editor',
  'outline-editor:archive-done': ->
    outline = @editor.outline
    outline.beginUpdates()
    
    archive = outline.evaluateItemPath('@text = Archive')[0]
    unless archive
      archive = outline.createItem 'Archive'
      archive.addElementInBodyTextRange 'B', {}, 0, 7
      outline.root.appendChild archive
    
    items = outline.evaluateItemPath('@status = complete except @text = Archive//*')
    if items.length
      archive.insertChildrenBefore items, archive.firstChild
    
    outline.endUpdates()

And then (when editing an outline) do Command-Shift-P and type to select the command “Outline Editor: Archive Done”.