Generating a link to document root

Hi - really enjoying the recent versions of the Bike 2 beta. Just wondering if there could be a menu item for copying the bike link to a document (rather than to an individual row)? Sometimes I want to link to a whole document, without triggering focus on a specific row.

It’s possible to copy a row link, and then just remove the row ID at the end, but it would be simpler to have a command for it.

In the meanwhile you could attach a keystroke (via something like Keyboard Maestro or FastScripts 3), to this JavaScript for Automation script:

(() => {
    ObjC.import("AppKit");

    const main = () => {
        const script = "bike.frontmostOutlineEditor.outline.root.ensuredPersistentId";

        return setClipOfTextType("public.utf8-plain-text")(
            `bike://${Application("Bike").evaluate({ script })}`
        );
    };


    // setClipOfTextType :: String -> String -> IO String
    const setClipOfTextType = utiOrBundleID =>
        txt => {
            const pb = $.NSPasteboard.generalPasteboard;

            return (
                pb.clearContents,
                pb.setStringForType(
                    $(txt),
                    utiOrBundleID
                ),
                txt
            );
        };

    return main();
})();


@complexpoint Thanks for the script solution.

@saaaa I’m trying to decide. On one hand easy to add. On another hand it’s a new menu item. Invites the question what’s difference between row and document link. I wonder if it’s worth the distinction, or if we could do better.

For example maybe we just have “Copy View Link” and it creates a link that opens the outline in the same configuration that is set when the copy happens. So the link includes focus, selection, maybe filter too? Also, I’m pretty sure I implemented this at some point, but can’t see to find in code at moment. Hum.

With that setup you could “Go Home” for a document link. Or focus into a specific row for a row link.

2 Likes

@complexpoint thanks for the script! I’ll give that a go.

@jessegrosjean ah interesting! That would be a better + more flexible solution. Being able to easily save links to filtered views would be useful as well. Although I think keeping a simple “link to row” command, like you have already have, would still be good!

Slightly related to this - do you have any thoughts about links surviving moving a branch between documents?

The use case I’m imagining is, starting making notes in a large journal outline (with lots of internal links) and then deciding to move a chunk of that outline into a specific project file or something similar, but without breaking the row links into that branch.

I’ve added option to Copy > Document Link in latest preview release:

1 Like

Thanks!

The view state idea sounds nice in theory, but wouldn’t links with saved selections get pretty brittle? If someone reorganizes the doc or you collapse a section, a link pointing to a specific selection might break or point to the wrong spot. Maybe the simple doc-root link is the right move precisely because it’s durable.

Not too brittle, because they are ID based. So the target row can be moved, ancestors collapsed, edited. And the link won’t break. Only if the row is removed from the document.