Feature request: collapse and expand all notes


#1

I often write several paragraphs of notes in the projects. It looks strange if the notes are much larger block than project & task. I think it’ll help if I could collapse and expand the notes only and keep the project & task unchanged.


#2

Instead of a specialized folding command could you do this with a not @type = note search?


#3

It could but not good, I think. Taskpaper intriguing me lies that I could write notes conveniently in it and display them naturally. It hampers its advantages if the toggle so inconvenient.

Or it could be done by a script, I guess.


#4

You could try something like this:

http://guide.taskpaper.com/using_scripts.html

(function () {
    'use strict';

    // TASKPAPER CONTEXT

    function toggleNoteExpansion(editor, options) {
        'use strict';

        var lstNoteParents = editor.outline.evaluateItemPath(
                '//@type=note/parent::*'
            ),
            // Toggle all on state of first note parent found in document
            oParent = lstNoteParents.length ? lstNoteParents[0] : undefined,
            strState = oParent && editor.isExpanded(oParent) ? (
                'Collapsed'
            ) : 'Expanded';

        return (
            oParent && editor['set' + strState](lstNoteParents),
            oParent ? strState : "No notes found"
        );
    }

    // JAVASCRIPT FOR AUTOMATION CONTEXT

    var tp3 = Application('com.hogbaysoftware.TaskPaper3'),
        ds = tp3.documents,
        d = ds.length ? ds[0] : undefined;

    return d && d.evaluate({
        script: toggleNoteExpansion.toString()
    });
})();


#5

It works so great, thanks!