Maintain frame when file externally edited

and to simply look for the first line which has a particular .bodyString text, and restore focus to it, perhaps something like:

Expand disclosure triangle to view JS source
(() => {
    "use strict";

    // FOR EXAMPLE: (focusing on line with this bodyString, if found)
    const focusText = "To Organize Items:"

    const TaskPaperContext = (editor, options) => {

        const { focusText } = options;

        const rowFocusedLR = s => {
            const
                items = editor.outline.items,
                i = items.findIndex(x => s === x.bodyString);

            return -1 !== i
                ? (
                    editor.focusedItem = items[i],
                    { Right: `Focus restored to: '${s}'` }
                )
                : { Left: `Row not found as spelled: '${s}'` };
        };

        return "string" === typeof focusText && 0 < focusText.length
            ? rowFocusedLR(focusText)
            : { Left: "No focal row supplied" };
    };

    // main :: IO ()
    const main = () => {
        const
            document = Application("TaskPaper")
                .documents.at(0)

        return document.exists()
            ? document.evaluate({
                script: `${TaskPaperContext}`,
                withOptions: { focusText }
            })
            : "No document open in TaskPaper."
    };

    return JSON.stringify(main(), null, 2);
})();