Bike 1.13 (145)

thanks :slight_smile:

Row type replacements were off by default in my case – (as was detect links).

Funnily enough I just opened another document to view the checking settings and found both of those off again there.

Are those settings document-specific, rather than global for the application ?


But now that I’ve restarted Bike and created a new document, detect links and row type replacements have both retained their ON state, so perhaps it was something about documents that were already open during the upgrade ?

1 Like

Oops, I now see that I wrote the function to turn these one, but never actually called it.

Yes, but I had forgotten that when I put the setting there.

If you have two document open, and change the settings in one, that change will effect all future documents, but not already open documents. I think this makes sense for view settings like spell check, but maybe not for settings such as detect links and row type replacements.

What I am trying to allow is that in some future version of Bike I want to add other “checking” decorations, such as maybe sentence sentiment, or reading level, etc. I want these settings to be document view specific.

I am now thinking that behavior settings (such as corrections and replacements) should be global and located in a settings window. In other words I can imagine wanting to see spelling lines in one window and some other checking decoration in another window. But I think it’s not usual that I would want row type replacements on in one window and off in another window.

Assuming that makes sense I’ll try to make that change soon.

1 Like

What’s the quickest way, at the moment, of detecting the type of a row ?

( Distinguishing, for example, between a heading and bold-formatted row, or between a quote and an italic-formatted row )


Ah … perhaps ⌘K

Screenshot 2023-07-12 at 21.28.53

Yes, that’s best for now, though still need something more I think. Options are add the same ⌘K formatting controls in the bottom status bar. Or make all row types visually distinguishable by adding some extra icon. I think I’ll probably add options to the bottom status bar, but if anyone else has a better idea let me know.

1 Like

Could you tell me the difference between Code and Row > Code Block ? Does the latter allow for multiline rows ?

The difference is where the attribute is set, and in the future that may unlock more differences.

For “Code” the attribute is set as a inline span in a paragraph of text.

For “Code Block” the attribute is set higher, at the row level.

Generally if you have a full line (or multiple) of code you should use “Code Block”. On feature that I expect (though again probably not right away) is that I’ll perform syntax highlighting for code blocks. Treating consecutive code blocks as a single piece of code to be highlighted.

4 Likes

Update of screen display after scripted row type update ?

I notice (preview build 139) that:

  1. We can already use a script to successfully flag a row as data-type = "task", and give it an ISO string value for the data-done attribute, but
  2. the task checkbox for the script-updated row only becomes visible after the file is closed and reopened.

( Might it be possible to find a way of repainting the screen display after script events of that kind ?)


This is the test that I have tried so far:

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

    // Testing script:
    // Script updating of a selected Row in Bike.

    // setting data-type to "task"
    // setting data-done to ISO8601 string for <now>.

    // Comment
    // This works in Preview 139 - the attribute values are
    // created or updated
    // and written out on save
    // BUT the task prefix appears *only when the file is reopened*.

    const main = () => {
        const
            bike = Application("Bike"),
            doc = bike.documents.at(0);

        return doc.exists() ? (() => {
            const
                rows = doc.rows.where({
                    selected: true,
                    _not: [{
                        name: ""
                    }]
                });

            return 0 < rows.length
                ? (() => {
                    const
                        selnRow = rows.at(0),
                        [doneAttrib, typeAttrib] =
                            ["done", "type"].map(
                                k => attribFoundOrCreated(
                                    bike
                                )(selnRow)(`data-${k}`)
                            );

                    return [
                        selnRow.name(),
                        (
                            doneAttrib.value() || (
                                doneAttrib.value = (
                                    new Date()
                                )
                                .toISOString()
                            ),
                            doneAttrib.value()
                        ),
                        (
                            typeAttrib.value() || (
                                typeAttrib.value = "task"
                            ),
                            typeAttrib.value()
                        )
                    ]
                    .join("\n");

                })()
                : "No rows selected in Bike";
        })() : "No documents open in Bike";
    };

    // ---------------------- BIKE -----------------------

    // attribFoundOrCreated :: Application -> Bike Row ->
    // Attribute Name -> IO Attribute
    const attribFoundOrCreated = bikeApp =>
        row => k => {
            const
                attribs = row.attributes,
                foundAttrib = attribs.byName(k);

            return foundAttrib.exists()
                ? foundAttrib
                : (() => {
                    const
                        newAttrib = new bikeApp.Attribute({
                            name: k
                        });

                    return (
                        row.attributes.push(newAttrib),
                        newAttrib
                    );
                })();
        };

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

The fact that doesn’t work is a bit of surprise to me, but I guess this is the first time we are really testing row attributes. Thanks for example script, I see the problem too. Will get this fixed!

1 Like

UI conversion of rows from (completed) Task to Body reverts after a file is saved and reopened ?

If I use the UI ( ⌘K menu ) I seem to be able to convert a completed task row back to a Body type, but
if I then save and reopen, the row type seems to have reverted to task.

Perhaps by design, to avoid discarding the data-done value ?

1 Like

I’m working on ordered list numbering now.

  1. Iterate each set of siblings while maintaining a “count” that starts at 0.
  2. If row is of type .ordered then increment the count and set on row
  3. If row is not of type .ordered then reset the count to 0

Question.

Any thoughts one special whitespace handling? For example do you want me to allow empty lines between ordered list rows without resetting the number count?

As I see it:

  • Styling/numbering implementation is easy
  • It would allow a bit more flexibility in formatting
  • It seems to match markdown editing experience
  • It might complicate outline processing down the road.
  • It doesn’t seem to be a standard rich text interaction. For example I can’t seem to insert whitespace between ordered list items in TextEdit.

I have a feeling that the meaning of a blank row (list item ? body ?) interrupting an ordered list is not very well defined, and might well introduce confusions.

(We do see such things in MD, but, of course, that’s really more of a decorative markup than a well-defined outline structure)

Something that I do see in MS Word etc is a choice to resume numbering from a previous list, or start it at a given value.

1 Like

Ok, I’ll leave it simple then. Easy enough to add later if we decide it’s needed.

1 Like

No, not by design. This is happening for all types. Issue was that originally I stored row type in row.attributes. Then changed to own field. But some of the code was still storing/loading from row.attributes… fixing now.

1 Like

Ok, I see what’s happening. It’s related to the other problem. Instead of setting type by setting data-type attribute, you need to use row.type. Then I think it should work.

1 Like

With the 140 (bugs) 141 release I think all the big glaring holes are filled for row types in Bike, at least the ones that I see. Let me know if there are ones that I don’t see.

Future work on this release may include:

  • Adding visible type decorations to blockquote and code
  • Adding formatting buttons and status to bottom status bar
  • Wondering if I should try to get any of this formatting into the Copy as Rich Text and HTML representations. Of course it would be nice, but also maybe a lot of work. So it’s in consideration phase.

For the next week I’m going to be taking a code break, so good time to think about what’s been done so far on row types for Bike and make suggestions on what changes you would like to see. Then maybe in a few more weeks I’ll push out the row types release and start something new.

1 Like

Thanks for all the improvements! This may be related to my default font size, but when I do a task list the box that goes with it is not center aligned with the text. It’s close, but also noticeably off. Screenshot below shows what I mean:

Hum, I think it has to do not with font size, but font. Try the system font (top of the list) and see if it looks right at different sizes. Also what font are you using that’s causing things to not line up? I’ll see if I can find a fix.

I was using Helvetica Nue at 20 pixels.

I did change to System, quit and restarted. The result is better, but still not lined up right (at least by my eyes). Here’s with system font;

Well earned !!

( Many thanks for all this work on types )

Enjoy the summer

Thanks for all the testing. So far it’s types have been a bit easier than I had expected, and more fun too!

2 Likes