Is this behaviour expected for `hoistedRow` property?

This is hoistedRow property from Document class definition:

If I start from this outline,

and run this code snippet

(() => {
    "use strict";

    // jxaContext :: IO ()
    const jxaContext = () => {
        // main :: IO ()
        const main = () => {
            const
                bike = Application("Bike"),
                doc = bike.documents.at(0);
            return doc
                .hoistedRow()
                .rows()
                .map(x => x.name())
                .join("\n")
        };

        // MAIN --
        return main();
    };

    return jxaContext();
})();

I obtain (as expected):

Welcome to Bike!

Use Bike to record and process your ideas. You'll need to spend a little time learning Bike to get the most out of it.

Watch intro movie
Browse the User's Guide
Learn the keyboard shortcuts
Learn Bike's innovative rich text editing

Feel free to delete this text. Uncheck "Show Welcome in new documents" in Bike's preferences to stop including this text in new outlines.

Thanks,
Jesse

However, if I run the same code on this focused outline:

I obtain the same result. Isn’t the purpose of hoistedRow property to allow access just to focused rows ?

The value returned by Outline.Editor.hoistedRow() is simply a reference to the parent (container) row.

(The .rows() property of that parent will always return the full collection of its children, regardless of editor state)

Not sure if this is what you are talking about, but …

The hoisted row is a bit confusing at the root level, because it doesn’t change when you focus on a top level row. For example if you have this outline:

  • hidden root
    • one
      • a
        • a.1
      • b
    • two
  1. By default the hidden root is the hoisted row and the focus row is null.
  2. If you focus on “one” then the hoisted row is STILL the hidden root, while the focus row becomes “one”
  3. If you focus on “a” THEN the hoisted row becomes “one” and the focus row becomes “a”.

It’s a bit confusing and actually in Bike 2 I have removed this distinction between hoisted and focused. What this current design allows is that you have two options when “focusing” into a row:

  1. You can mark it hoisted, in which case you don’t see the row, you only see it’s children
  2. Or you can focus it, in which case you will see the row and it’s children.

Hope that helps more then confuses.

Exactly. That’s what I found in my tests. At first, I expected hoistedRow to respect focus state. I focused on one, and rows() property returned every parent row. However, when I focused “a”, then I got expected results

How can I mark it hoisted ?

For example in the default document this will hoist the “Welcome to Bike!” row:

tell application "Bike"
	tell front document
		set hoisted row to first row
	end tell
end tell

When you run this script the editor will go blank, since “Welcome to Bike!” doesn’t have any children… but you can start typing to add them.

2 Likes

It sounds as if the underlying question might be the relationship between:

  1. The model of the outline, and
  2. the model of the editor state (visibility of particular rows in the outline)

Rows that are folded or focused out of view clearly can’t vanish from the outline model itself – or we wouldn’t be able to bring them back into view – but the “row” object does have properties which reveal its current status in an editor view:

visible (boolean, r/o) : True if this row is visible in the window (may require scolling).
selected (boolean, r/o) : True if this row is selected in the window.
expanded (boolean, r/o) : True if this row is expanded in the window.
collapsed (boolean, r/o) : True if this row is collapsed in the window.
2 Likes